Hi Sunil,

Use the non-relational goal "project" to get the value of a lvar.

The "is" operator in Prolog does similar things AFAIK.

Untested:

(defnu lengtho [l n]
  ([[] 0])
  ([[_ . rst] _] (fresh [n1]
                        (lengtho rst n1)
                        (project [n n1]
                             (== n (+ n1 1)))))

Thanks,
Ambrose

On Sat, Oct 8, 2011 at 3:50 PM, Sunil S Nandihalli <
sunil.nandiha...@gmail.com> wrote:

> Hi everybody,
>  I was just trying to implement a simple length of a list in core.logic
> (basically solving the 99-problems-in-prolog). I am not able to find a way
> to increment values.. Can somebody help me with this... I would like some
> thing like the following to work..
>
> (defnu lengtho [l n]
>   ([[] 0])
>   ([[_ . rst] _] (fresh [n1]
>                         (lengtho rst n1)
>                         (== n (+ n1 1))))
>
> but I can't do "(== n (+ n1 1))" can somebody help me? Even if you tell me
> as to how I can covert the regular count function so that I can use it as a
> goal.. that would work too.
> Thanks,
> Sunil.
>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to