unexpected behavior in core.logic conjo goal

I have hard time understanding the following behavior of the conjo goal in core.logic.

First, everything seems fine.

(l/run* [q]   (l/conjo q 2 3 [1 2 3] )) => ([1]) 

The goal succeeds when q = [1], since (conj [1] 2 3) == [1 2 3]

When on the otherhand I ask for 2 lvars then I get the following result that I don't understand. I was expecting a = [1] and b = 2.

(l/run* [a b]   (l/conjo a b 3 [1 2 3] )) => (([_0 _1] :- (clojure.core.logic/conjo <lvar:a__25296> _1 3 [1 2 3]))) 

What does the syntax :- (clojure.core.logic/conjo <lvar:a__25296> mean? Why do I get unbound lvars for a and b? there is only one possibility for the goal to suceed.

Maybe I need to hint it some more.

(l/run* [a b]   (l/== b 2)   (l/conjo a b 2 [1 2 3])) => () 

That's really strange now. I set b to be explicitly be 2 and then no solution for a exists.

Any clue what I miss here?

Replay

Category: clojure Time: 2016-07-29 Views: 0

Related post

iOS development

Android development

Python development

JAVA development

Development language

PHP development

Ruby development

search

Front-end development

Database

development tools

Open Platform

Javascript development

.NET development

cloud computing

server

Copyright (C) avrocks.com, All Rights Reserved.

processed in 0.234 (s). 12 q(s)