dyoo / whalesong

Whalesong: Racket to JavaScript compiler
http://hashcollision.org/whalesong
250 stars 30 forks source link

map doesn't work on more that two lists #44

Closed dyoo closed 13 years ago

dyoo commented 13 years ago

Issue reported by Jens:

Today I got this error (in red in the browser) from Whalesong:

Error: map: expected 2 value(s), received 3 value(s) at Object.raiseArityMismatchError

I've traced this down to a bug in apply. The reason my tests cases didn't catch this earlier is because the version that's unit tested comes from kernel and doesn't use apply. The version of map that's exposed from the toplevel whalesong language is the one specialized by private/lang/map.rkt, which uses apply underneath the service.

Now trying to figure out why apply is doing the wrong thing.

dyoo commented 13 years ago

Bug is actually not apply, but isArityMatching. For some reason,

plt.baselib.arity.isArityMatching(plt.baselib.lists.makeList(2, 3, plt.baselib.arity.makeArityAtLeast(1)), 4)

is evaluating to false. Staring at the code to see why this is the case... ok, bug corrected in 23bd9eb9996043689ac1b3c85b7adc019956a438