Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for anonymous functions in excellent #1063

Merged
merged 1 commit into from
Nov 8, 2021

Conversation

rowanseymour
Copy link
Member

@rowanseymour rowanseymour commented Nov 4, 2021

Currently support just named functions, e.g.

@(foreach(array("a", "b", "c"), upper)) -> [A, B, C]
@(foreach(array("the man", "fox", "jumped up"), word, 0)) -> [the, fox, jumped]

But this adds syntax for anonymous functions (aka lambdas #768), e.g.

@(foreach(array("a", "b", "c"), (x) => x & "1")) -> [a1, b1, c1]
@(foreach(array("a", "b", "c"), (x) => object("v", x))) -> [{v: a}, {v: b}, {v: c}]

Will be helpful for nyaruka/courier#380

@codecov
Copy link

codecov bot commented Nov 4, 2021

Codecov Report

Merging #1063 (837b308) into excellent3 (7330215) will increase coverage by 0.00%.
The diff coverage is 92.10%.

Impacted file tree graph

@@             Coverage Diff             @@
##           excellent3    #1063   +/-   ##
===========================================
  Coverage       86.63%   86.64%           
===========================================
  Files             256      256           
  Lines           10696    10720   +24     
===========================================
+ Hits             9267     9288   +21     
- Misses           1002     1004    +2     
- Partials          427      428    +1     
Impacted Files Coverage Δ
excellent/functions/builtin.go 97.94% <ø> (ø)
excellent/types/function.go 68.75% <83.33%> (-0.49%) ⬇️
excellent/evaluate.go 89.65% <84.61%> (-2.35%) ⬇️
excellent/base.go 100.00% <100.00%> (ø)
excellent/tree.go 100.00% <100.00%> (ø)
excellent/visitor.go 93.33% <100.00%> (+0.56%) ⬆️
flows/runs/run.go 80.08% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7330215...837b308. Read the comment docs.

@rowanseymour rowanseymour merged commit 0fda792 into excellent3 Nov 8, 2021
@rowanseymour rowanseymour deleted the anon_funcs branch November 8, 2021 17:06
@rowanseymour rowanseymour mentioned this pull request Nov 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants