Added backtrack library

db4
U-WSCHLIEP-PC\wschliep 2008-07-08 13:22:18 -04:00
parent ceac27d4de
commit 9f002ca524
3 changed files with 22 additions and 0 deletions

1
extra/backtrack/authors.txt Executable file
View File

@ -0,0 +1 @@
William Schlieper

View File

@ -0,0 +1,20 @@
! Copyright (C) 2008 William Schlieper
! See http://factorcode.org/license.txt for BSD license.
USING: kernel continuations sequences namespaces fry ;
IN: backtrack
SYMBOL: failure
: amb ( seq -- elt )
failure get
'[ , _ '[ , '[ failure set , , continue-with ] callcc0 ] each
, continue ] callcc1 ;
: fail ( -- )
f amb drop ;
: require ( ? -- )
[ fail ] unless ;

View File

@ -0,0 +1 @@
Simple non-determinism