JavaScript has much in common with Scheme. It is a dynamic language. It has a flexible datatype (arrays) that can easily simulate s-expressions. And most importantly, functions are lambdas.
Because of this deep similarity, all of the functions in The Little Schemer can be written in JavaScript. The syntaxes of these two languages are very different, so some transformation rules are needed.
(define foo (lambda (a b c) (body))) | var foo = function (a, b, c) { return body; };
(foo a b c) | foo(a, b, c);
(and p1 p2 ... pn) | (p1 && p2 ... && pn)
(quote (a b c)) | ['a', ['b', ['c']]]
foo? | isFoo
Name:
Anonymous2011-09-09 23:56
function (too {bad function(Javascript {is(function ("unreadable");)} (function([as{'fuck'}]);));});
depends what you are using it for. javascript (in chrome and firefox) is hells of faster than it used to be a few years ago. the intense competition between browser vendors is really pushing javascript speeds tO tHe ExTrEmE!!!!
javascript's new byte arrays and web workers are also a welcome addition.
>>2
Did you mean function (too function({bad function(Javascript function({is(function("unreadable");)}, (function(function([function(as{('fuck')});]);));));}));
?
function = function(function("Are");){function(function();,[function("you"), function(function(function(), function(["frustrated"]))), function([">>23?"])])}; // FIXME: function