Re: Mutual Recursion Doesn't Compile

2016-04-01 Thread Ashish Negi
Yeah.. protocols are more right answer to this problem , rather than using declare. -- 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

Re: Mutual Recursion Doesn't Compile

2016-03-31 Thread Lucas Sloan
declare worked great. Thanks! On Thursday, March 31, 2016 at 10:56:02 AM UTC-7, Aaron Cohen wrote: > > > On Thu, Mar 31, 2016 at 1:36 PM, Lucas Sloan > wrote: > >> I have some mutually recursive code as follows: >> >> > Depending on your preferences, either forward declare using "declare" or >

Re: Mutual Recursion Doesn't Compile

2016-03-31 Thread jeaye
On Thu, Mar 31, 2016 at 10:36:45AM -0700, Lucas Sloan wrote: > I have some mutually recursive code as follows: > > (ns tester.core > (:require [clojure.data.json :as json]) > (:gen-class)) > > (defn getValuePathPairs > [json] > (cond > (instance? clojure.lang.PersistentVector json) (g

Re: Mutual Recursion Doesn't Compile

2016-03-31 Thread Timothy Baldridge
This is almost a perfect example of something that protocols could help with (http://clojure.org/reference/protocols): (defprotocol IGetValuePathPairs (getValuePathPairs [json])) (extend-protocol IGetValuePathPairs Number (getValuePathPairs [json] ...) String (getValuePathPairs [json] .

Re: Mutual Recursion Doesn't Compile

2016-03-31 Thread Aaron Cohen
On Thu, Mar 31, 2016 at 1:36 PM, Lucas Sloan < predictably.defenestra...@gmail.com> wrote: > I have some mutually recursive code as follows: > > Depending on your preferences, either forward declare using "declare" or use "letfn". Your next question will likely be, "How do I make mutually recursi

Mutual Recursion Doesn't Compile

2016-03-31 Thread Lucas Sloan
I have some mutually recursive code as follows: (ns tester.core (:require [clojure.data.json :as json]) (:gen-class)) (defn getValuePathPairs [json] (cond (instance? clojure.lang.PersistentVector json) (getVectorValuePathPairs json) (instance? clojure.lang.PersistentArrayMap json