core.logic

2011-10-08 Thread Sunil S Nandihalli
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] ([[]

Re: core.logic

2011-10-08 Thread Sunil S Nandihalli
Please replace rst with ?rst .. Sunil. On Sat, Oct 8, 2011 at 1:20 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 > t

Re: core.logic

2011-10-08 Thread Sunil S Nandihalli
Here is my solution... (defnu succ [n n+1] ([0 1]) ([1 2]) ([2 3]) ([3 4]) ([4 5]) ([5 6]) ([6 7]) ([7 8]) ([8 9]) ([9 10])) (defn pred [n n-1] (succ n-1 n)) (defnu lengtho [l n] ([[] 0]) ([[_ . ?rst] _] (fresh [n1] (lengtho ?rst n1)

Oxjure - Oxford Clojure Group

2011-10-08 Thread Folcon
Hi Everyone, I'm interested in seeing if there are enough people in Oxford, United Kingdom to start an Oxford Clojure group. I'm willing to run the group in my spare time, but it would be useful to see if there are people here who would be interested in joining. I don't know if this is the rig

Re: core.logic

2011-10-08 Thread Ambrose Bonnaire-Sergeant
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]

Re: core.logic

2011-10-08 Thread Sunil S Nandihalli
Thanks Ambrose. that fixed it .. I tried the following along the same lines but didn't work.. can you suggest as to how I can do it? (defn nlasto [l last-val] (project [l last-val] (== last-val (last l (run* [q] (nlasto [1 2 3 4 5] q)) I do know how to do it in pure relational t

Re: core.logic

2011-10-08 Thread David Nolen
Your projecting last-val which is unbound. Once projected you have a value not a logic var. David On Saturday, October 8, 2011, Sunil S Nandihalli wrote: > Thanks Ambrose. that fixed it .. I tried the following along the same lines but didn't work.. can you suggest as to how I can do it? > (defn

Re: core.logic

2011-10-08 Thread Sunil S Nandihalli
oh I see. I removed last-val from project and it worked fine.. Thanks, Sunil. On Sat, Oct 8, 2011 at 7:55 PM, David Nolen wrote: > Your projecting last-val which is unbound. Once projected you have a value > not a logic var. > > David > > On Saturday, October 8, 2011, Sunil S Nandihalli < > suni

Re: core.logic

2011-10-08 Thread Ambrose Bonnaire-Sergeant
If you're interested in relational arithmetic you might enjoy hacking away with this page. https://github.com/frenchy64/Logic-Starter/wiki/Arithmetic Ambrose On Sat, Oct 8, 2011 at 10:17 PM, Sunil S Nandihalli < sunil.nandiha...@gmail.com> wrote: > Thanks Ambrose. that fixed it .. I tried the f

Can someone help me understand how to properly reference clj macros from ClojureScript?

2011-10-08 Thread Conrad
Hi everyone- I've spent a couple of hours now trying to create a macro that will work in ClojureScript and keep hitting a wall- Any pointers would be greatly appreciated! OK, so I'm running Ubuntu and have clojurescript installed at "~/ clojurescript". I have a clojurescript file "bar.cljs" in dir

Re: Can someone help me understand how to properly reference clj macros from ClojureScript?

2011-10-08 Thread Michał Marczyk
Hi, I use the following layout for my Clojure + ClojureScript coding: project-directory/src/clj -- Clojure source project-directory/src/cljs -- ClojureScript source (I seem to recall that putting the directory with your cljs source on the classpath causes weird problems when trying to compile, h

Re: Can someone help me understand how to properly reference clj macros from ClojureScript?

2011-10-08 Thread Michał Marczyk
Just to highlight the key point: with the above setup, custom macros defined in files under src/clj/ are available to cljs code under src/cljs/ because src/clj/ is included on the classpath in the above -cp command (so the cljs compiler can find them). Sincerely, Michał -- You received this mess

Re: Can someone help me understand how to properly reference clj macros from ClojureScript?

2011-10-08 Thread Conrad
Thanks Michal! That worked like a charm :-) On Oct 8, 4:10 pm, Michał Marczyk wrote: > Just to highlight the key point: with the above setup, custom macros > defined in files under src/clj/ are available to cljs code under > src/cljs/ because src/clj/ is included on the classpath in the above >

Re: Can someone help me understand how to properly reference clj macros from ClojureScript?

2011-10-08 Thread Michał Marczyk
Great! See also https://github.com/michalmarczyk/clojurescript/tree/extra-libs-in-repl-launcher-script for a patch to current master's script/repl which should allow you to say $CLOJURESCRIPT_HOME/script/repl -l extra-directory -l extra-directory-2 ... to start a REPL with the ClojureScript co

Re: Oxjure - Oxford Clojure Group

2011-10-08 Thread jaime
Why not use this group directly?? I personally think separating people in different groups will disperse people's attention only.what is the benefit? On Oct 8, 7:49 pm, Folcon wrote: > Hi Everyone, > > I'm interested in seeing if there are enough people in Oxford, United > Kingdom to start an

Re: Suggestion needed for namespace management in modular clojure app

2011-10-08 Thread Stephen Compall
On Fri, 2011-10-07 at 19:07 +0530, Vivek Khurana wrote: > I would prefer to have a > modules directory where each module will create a sub directory and > all files in the module sub directory expose a single namespace. So it sounds like you intend for module writers to be writing Clojure, but wan

Re: Oxjure - Oxford Clojure Group

2011-10-08 Thread Alan Malloy
He is talking about going to a location in the real world. I'm sure you would be welcome at the Oxford group next time you are in Oxford. On Oct 8, 8:00 pm, jaime wrote: > Why not use this group directly?? I personally think separating people > in different groups will disperse people's attention

Anyone have any tips on functional - relational db data mapping?

2011-10-08 Thread Si
Hi all, I have a PostgreSQL database, which I am using via ClojureQL, and whilst basic relational operations are going smoothly, I'm wondering how to best tackle the "n+1 selects" issue and more generally how to construct a graph of maps and arrays from the relational data. As a specific example,

Re: Exception handling changes in Clojure 1.3.0

2011-10-08 Thread Constantine Vetoshev
I finally came up with a simple example which shows the broken exception handling behavior I described in my earlier post on this thread. (defn broken-catch [filename] (try (java.io.FileReader. filename) (catch java.io.FileNotFoundException fnfe "FileNotFoundException caught")