Archive for July, 2007

Functional JavaScript

Saturday, July 21st, 2007

Functional is a JavaScript library for functional programming. It defines the standard higher-order functions (map, reduce, filter) that you can read about elsewhere on the web. It also defines functions for partial function application and function-level programming: curry, partial, compose, guard, and until. Finally, it introduces “string lambdas”, which let you write 'x -> x+1', 'x+1', or even '+1' as synonyms for function(x) {return x+1}.


Read the rest of this entry »

Division-free LCM

Sunday, July 8th, 2007

Division-free GCD

A few years ago I described an algorithm for computing the greatest common denominator without division. (Euclid’s algorithm requires division, in order to compute the remainder.) Although less efficient than the standard algorithm, I found it easier to teach to my children when they were learning to add fractions.


Read the rest of this entry »