bartavelle / language-puppet

A library to work with Puppet manifests, test them and eventually replace everything ruby.
BSD 3-Clause "New" or "Revised" License
51 stars 8 forks source link

Error in reduce #276

Closed jfroche closed 5 years ago

jfroche commented 5 years ago

Hello ! The following expression fails:

$i = ['a', 'b'].reduce({}) |$result, $k| {
  merge($result, {"key.${k}" => $k})
}

with the following error message:

You can't combine chains of higher order functions (with .) and giving them parameters

I see here that the reduce is not implemented yet, would it be hard to implement it ?

Thank you !

bartavelle commented 5 years ago

I just pushed a completely untested implementation of the reduce function.

PierreR commented 5 years ago

LGTM