Skip to content

Instantly share code, notes, and snippets.

View msgodf's full-sized avatar

Mark Godfrey msgodf

View GitHub Profile
@ademar
ademar / gist:1016874
Created June 9, 2011 14:49
Combinators for logic programming
// Based on the article 'Combinators for logic programming' by Michael Spivey and Silvija Seres.
let rec inf_seq n = seq { yield n; yield! inf_seq (n+1) }
let rec lzw f l1 l2 =
LazyList.delayed ( fun () ->
match l1,l2 with
|LazyList.Nil, _ -> l2
|_, LazyList.Nil -> l1
|LazyList.Cons(p1,tail1),LazyList.Cons(p2,tail2)