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
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
>
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
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] .
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
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