Skip to content

Instantly share code, notes, and snippets.

@swannodette
Created November 1, 2011 03:14
Show Gist options
  • Save swannodette/1329766 to your computer and use it in GitHub Desktop.
Save swannodette/1329766 to your computer and use it in GitHub Desktop.
subchecko.scm
(define (subchecko w sl r o n)
(conde
((== sl ())
(fresh (a d)
(domfd a (range 1 n))
(conde
((conso a d r) (plusfd a 1 w)
(conso w r o))
((== r '()) (conso w r o)))))
((fresh (a b c ro0 ro1 nw nsl)
(domfd a b c (range 1 n))
(conso a nsl sl)
(plusfd a b w) (plusfd a w c)
(subchecko b nsl r ro0 n)
(subchecko w nsl ro0 ro1 n)
(subchecko c nsl ro1 o n)))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment