Created
August 30, 2012 09:57
-
-
Save yuanmai/3525188 to your computer and use it in GitHub Desktop.
Bowling Score in PicoLisp
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
(de frame @ | |
(when (next) | |
(link | |
(make | |
(if (= 10 (link (arg))) | |
(apply link (head 2 (rest))) | |
(when (= 10 (+ (arg) (link (next)))) | |
(link (car (rest))) ) ) ) ) | |
(pass frame) ) ) | |
(de score (Lst) | |
(apply + | |
(fish atom | |
(head 10 | |
(make (apply frame Lst)) ) ) ) ) | |
: (score (make (do 21 (link 1)))) | |
(score (make (do 21 (link 1)))) | |
-> 20 | |
: (score (make (do 21 (link 5)))) | |
(score (make (do 21 (link 5)))) | |
-> 150 | |
: (score (make (do 21 (link 10)))) | |
(score (make (do 21 (link 10)))) | |
-> 300 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment