minor adjustments

db4
Rex Ford 2008-07-22 04:43:27 -04:00
parent 967f2873ab
commit 5e61c97272
1 changed files with 1 additions and 12 deletions

View File

@ -6,19 +6,8 @@ parser io math prettyprint combinators
vectors words quotations accessors math.parser vectors words quotations accessors math.parser
backtrack math.ranges locals fry memoize macros assocs ; backtrack math.ranges locals fry memoize macros assocs ;
IN: 24 IN: 24-game
MACRO: amb-execute ( seq -- quot )
[ length ] [ <enum> [ 1quotation ] assoc-map ] bi
'[ , amb , case ] ;
: if-amb ( true false -- )
[
[ { t f } amb ]
[ '[ @ require t ] ]
[ '[ @ f ] ]
tri* if
] with-scope ; inline
: nop ;
: do-something ( a b -- c ) { + - * } amb-execute ; : do-something ( a b -- c ) { + - * } amb-execute ;
: maybe-swap ( a b -- a b ) { nop swap } amb-execute ; : maybe-swap ( a b -- a b ) { nop swap } amb-execute ;
: some-rots ( a b c -- a b c ) : some-rots ( a b c -- a b c )