google / mangle

Apache License 2.0
1.07k stars 38 forks source link

function fn:list expects -1 arguments, provided: [Code] #12

Closed maxott closed 1 year ago

maxott commented 1 year ago

I'm trying to understand lists. However, the example in the README seems to fail on me. I believe I run the latest version:

test.dl:

direct_conn(/ba001, /JFK, /LAX, 400).

one_or_two_leg_trip(Codes, Start, Destination, Price) :-
  direct_conn(Code, Start, Destination, Price)
  |> let Codes = [Code].

In the interpreter:

mg >::load test.dl
load failed: function fn:list expects -1 arguments, provided: [Code]

Using fn:list(Code) does work, though.

burakemir commented 1 year ago

This is a small bug, thanks for catching. Also, the documentation example should say "fn:plus" (which adds arguments) not "fn:sum" (which sums what is aggregated). Fix coming.