This file contains 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
> (test (match-all {0 1} (Set Integer) | |
[<cons $a_1 <cons $a_2 <cons $a_3 _>>> | |
{a_1 a_2 a_3}])) | |
{{0 0 0} {0 0 1} {0 1 0} {0 1 1} {1 0 0} {1 0 1} {1 1 0} {1 1 1}} |
This file contains 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
% cd sample/icfpc2012/ | |
% egisonc mine.egi | |
[1 of 1] Compiling Main ( _tmp.hs, _tmp.o ) | |
Linking mine ... | |
% ./mine maps/contest1.map | |
###### | |
#. *R# | |
# \.# | |
#\ * # | |
L .\# |
This file contains 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
(define $poker-hands | |
(lambda [$Cs] | |
(match Cs (Multiset Card) | |
{[<cons <card $S $n> | |
<cons <card ,S ,(- n 1)> | |
<cons <card ,S ,(- n 2)> | |
<cons <card ,S ,(- n 3)> | |
<cons <card ,S ,(- n 4)> | |
!<nil>>>>>> | |
<straight-flush>] |
This file contains 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
(define $Multiset | |
(lambda [$a] | |
(type | |
{[,$val [] | |
{[$tgt (match [val tgt] [(Multiset a) (Multiset a)] | |
{[[<nil> <nil>] {[]}] | |
[[<cons $x $xs> <cons ,x ,xs>] {[]}] | |
[[_ _] {}]})]}] | |
[<nil> [] | |
{[{} {[]}] |
NewerOlder