Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

What happens if you input a puzzle that's unsolvable? Does the program run forever trying to seek a solution, or can it realize the puzzle is unsolvable?


I think you get the core.logic equivalent of prolog's "no" result.

I know nothing of clojure and core.logic, but a quick test:

    *sum=> (run*  [q] (fresh [a b] (== a 1) (== b 2) (== a b) (== q [a b])))
    
    ()
    
    *sum=> (run*  [q] (fresh [a b] (== a 1) (== b 1) (== a b) (== q [a b])))
   
   ([1 1])

the first has no solutions, while the latter returns one of them.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: