Last active
August 29, 2015 13:59
-
-
Save jeremyheiler/10572988 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
: fib ( a b -- x y ) [ + ] keep swap ; | |
! My goal was to implement this with produce. | |
1 1 | |
[ dup 4000000 < ] [ fib dup ] produce | |
2nip ! Remove the workspace | |
dup length 1 - swap remove-nth ! Remove the extra value | |
[ dup odd? [ drop 0 ] when ] | |
map-sum |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks! I like how simple it is to replace logical sections of code with different words. After doing these two Euler problems, and you suggesting fixes that would be obvious to me in, say, Clojure, suggests that I am thinking too deeply about the stack. Needless to say, Factor is really messing with my brain, so that's good.