]> gitweb.factorcode.org Git - factor.git/commitdiff
24-game: add division operation.
authorJohn Benediktsson <mrjbq7@gmail.com>
Thu, 21 Jun 2012 00:55:11 +0000 (17:55 -0700)
committerJohn Benediktsson <mrjbq7@gmail.com>
Thu, 21 Jun 2012 00:55:11 +0000 (17:55 -0700)
extra/24-game/24-game.factor

index de9cfbeafc5b1debe532e82e5f573bef04f71652..94bc1ebd6a568890171d71dc80b28553309aa70e 100644 (file)
@@ -8,8 +8,10 @@ IN: 24-game
 
 : nop ( -- ) ;
 
+: ?/ ( a b -- c ) [ drop 1/0. ] [ / ] if-zero ;
+
 : do-operation ( a b -- c )
-    { + - * } amb-execute ;
+    { + - * ?/ } amb-execute ;
 
 : permute-2 ( a b -- a b )
     { nop swap } amb-execute ;