From: gabriele renzi Date: 2005-02-15T10:12:07+09:00 Subject: Re: Printing why's (poignant) guide to ruby Florian Gross ha scritto: > On another note it might be interesting to have a look at concatenative > languages like Joy. These have something very similar to blocks as well: > > [1 2 3] [2 *] map > > What does that code to? > > C:\dev.svn\ruby>irb -r joy > irb(main):001:0> joy = Joy.new > => # > irb(main):002:0> joy.execute "[1 2 3] [2 *] map"; joy.stack > => [[2, 4, 6]] wait: you wrote a joy interpreter? that's cool :) > It takes a list and applies the [2 *] predicate to it yielding a new > list. Note that Joy is stack based and utilizes reverse polish notation > so 2 * pushes a 2 to the stack and multiplies the item that was on top > before with it. I think even more mind boggling things relate to every function being unary and to the implicit recursive operators :D