News for hackers. Stuff that matters.
Re: wu.js -- A lazy, functional Javascript library by xtho on Monday June 07, 2010 @01:11PM (#1411069)
How many function objects are created to generate that result? From a certain point of view, that is interesting too of course.
Re: wu.js -- A lazy, functional Javascript library by silentbicycle on Monday June 07, 2010 @08:09PM (#1412518)
Without looking at the source: it could either generate a decision tree made of nested ifs and case statements (or the CPS equivalent), or it could just do a naive linear search over each list element. That's probably good enough until you have long lists of alternatives or structural matching against whole trees.

I have a quick hack of a Lua library that does pattern matching with linear search. Whenever I get around to making it actually do analysis and compile search functions, I'll put it on github. (The patterns can have variable captures in them, too.)

Re: wu.js -- A lazy, functional Javascript library by mnemonik on Monday June 07, 2010 @08:33PM (#1412582)