As a Xmas present I gave myself a copy of "Concepts, Teechniques and Models
of Computer Programming" and I'm enjoying myself reading it. The book uses
Oz/Mozart but I'm trying to translate some of the code in clojure.
The first computation model is declarative and variables behave much as
LVars in core.logic. The first data structure it implements using these
variables is a queue.
Can anyoone give me some hints about how to translate the code using
core.logic? My idea is to translate the functions to relations and evaluate
them inside a run, but all my attempts have failed.
For instance, the function to create a queue is (page 148):
fun {NewQueue} X in q(0 X X) end
where q is a recodr with slots N (number of elements in queue), the
elements in the list are the difference list S#E.
my translation is
(defn newqueueo [q]
(fresh [x]
[0 x x]))
I tried to use records, but I've had some problems (maybe they can't be
used) and I'm using vectors now.
Anyone has any hint?
Thanks,
Juan Manuel
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
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 unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.