Just evaluated this 12996734 is like 30 seconds. Very interesting little piece of code. Thanks for sharing.
Very nice indeed!I made a "crawling" factorial function, just as a proof of concept.(define (f:f y) (begin (setq f:n 1) (setq f:current 0) (push '(if (> y 1) (begin (inc f:current) (setq f:n (* f:n y)) (dec y) (if (and (> (length f:f) 3) (> f:current 2)) (pop f:f 2)) (push (last f:f) f:f -1)) f:n) f:f -1)))
And another one, where the list to be pushed is modified instead of using variables.http://pastebin.com/HdQ8hiyx
Brilliant, Joel!
Crawler tractors are known for their exceptional traction and stability.
Just evaluated this 12996734 is like 30 seconds. Very interesting little piece of code. Thanks for sharing.
ReplyDeleteVery nice indeed!
ReplyDeleteI made a "crawling" factorial function, just as a proof of concept.
(define (f:f y)
(begin
(setq f:n 1)
(setq f:current 0)
(push
'(if (> y 1)
(begin
(inc f:current)
(setq f:n (* f:n y))
(dec y)
(if (and (> (length f:f) 3) (> f:current 2))
(pop f:f 2))
(push (last f:f) f:f -1))
f:n)
f:f -1)))
And another one, where the list to be pushed is modified instead of using variables.
Deletehttp://pastebin.com/HdQ8hiyx
Brilliant, Joel!
ReplyDeleteCrawler tractors are known for their exceptional traction and stability.
ReplyDelete