[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Chicken-users] ANN: new egg, Stacktor
From: |
Mark Fredrickson |
Subject: |
[Chicken-users] ANN: new egg, Stacktor |
Date: |
Mon, 18 Feb 2008 22:34:29 -0600 |
Hi all,
I'm happy to announce my first egg: Stacktor.
Stacktor is a DSL for programming in a stack based style, like
languages such as Forth or Factor. The idea came from a talk at my
local Ruby user's group by Slava Pestov on Factor. While I know Slava
likes Lisp/Scheme, he made an offhand joke about Lisp, and I felt
obligated to show that the Lisp/Scheme world can do stack based
programming too.
Here's a real quick example. Let's say we want to find all the squares
of a list that are larger than a given value. In a functional style,
we'd either have to write it "backwards" or use a lot of intermediate
bindings. We can skip both with in stack programming:
(begin-stack
9
'(1 2 3 4 5)
(push (lambda (x) (* x x)))
map
stk-swap
(lambda (x) (lambda (y) (> y x))) ;; returns a function that will
be pushed on the stack
filter
)
=> (stack 16 25)
I won't bore you with a lot details. Feel free to hit me up if you
have more questions.
Cheers,
-Mark
- [Chicken-users] ANN: new egg, Stacktor,
Mark Fredrickson <=