Re: recursion in clojure.walk

2014-01-09 Thread Lee Spector
On Jan 9, 2014, at 6:33 PM, Stuart Sierra wrote: > I wrote clojure.walk, but I don't usually recommend it for anything but > casual use. > > clojure.walk very general, so it's not going to be the most efficient > approach. When you know more details about the data

Re: recursion in clojure.walk

2014-01-09 Thread Stuart Sierra
I wrote clojure.walk, but I don't usually recommend it for anything but casual use. clojure.walk very general, so it's not going to be the most efficient approach. When you know more details about the data structure you're working with, as in this case, you can make somethi

recursion in clojure.walk

2014-01-09 Thread Lee Spector
Perhaps this is well known to others, but on the chance that maybe it isn't I thought I'd share. In clojure.walk both prewalk and postwalk use recursion in ways that will blow the stack for sufficiently deep nested structures. We had been using them happily until recently when thin

Re: bug in clojure.walk in 1.3

2011-12-16 Thread Joost
type doesn't implement the full > IPersistentCollection contract (ie, there's no implementation of > empty). I'm not so sure this is the right way to look at the issue. clojure.walk doesn't work on records, for example, also because of a missing implementation of empty, an

Re: bug in clojure.walk in 1.3

2011-12-16 Thread Stuart Sierra
Please create a JIRA ticket for adding 'empty' support to `bean`. -S -- 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

Re: bug in clojure.walk in 1.3

2011-12-13 Thread Cedric Greevey
On Tue, Dec 13, 2011 at 2:51 PM, Alan Malloy wrote: > On Dec 13, 11:36 am, Stuart Sierra > wrote: >> It's not clojure.walk, it's bean: >> >> user=> (empty (bean "hi")) >> AbstractMethodError >> clojure.lang.APersistentMap.empty(

Re: bug in clojure.walk in 1.3

2011-12-13 Thread Alan Malloy
On Dec 13, 11:36 am, Stuart Sierra wrote: > It's not clojure.walk, it's bean: > > user=> (empty (bean "hi")) > AbstractMethodError > clojure.lang.APersistentMap.empty()Lclojure/lang/IPersistentCollection; > clojure.core.proxy$clojure.lang.APersistent

Re: bug in clojure.walk in 1.3

2011-12-13 Thread Phil Hagelberg
On Tue, Dec 13, 2011 at 11:38 AM, Alan Malloy wrote: > Issue is in bean, not walk. walk calls (empty foo) on its collection, > in order to make sure you get back a collection of the same type. bean > maps are, I guess, some special type rather than an ordinary > c.l.PersistentHashMap; and that typ

Re: bug in clojure.walk in 1.3

2011-12-13 Thread Alan Malloy
tract (ie, there's no implementation of empty). On Dec 13, 9:07 am, Jay Fields wrote: > I think I found a bug > > user=> (bean "hi") > {:empty false, :class java.lang.String, :bytes #} > user=> (clojure.walk/stringify-keys (bean "hi")) > AbstractMet

Re: bug in clojure.walk in 1.3

2011-12-13 Thread Stuart Sierra
It's not clojure.walk, it's bean: user=> (empty (bean "hi")) AbstractMethodError clojure.lang.APersistentMap.empty()Lclojure/lang/IPersistentCollection; clojure.core.proxy$clojure.lang.APersistentMap$0.empty (:-1) The generated class doesn't implement the 'e

bug in clojure.walk in 1.3

2011-12-13 Thread Jay Fields
I think I found a bug user=> (bean "hi") {:empty false, :class java.lang.String, :bytes #} user=> (clojure.walk/stringify-keys (bean "hi")) AbstractMethodError clojure.lang.APersistentMap.empty()Lclojure/lang/IPersistentCollection; clojure.core.proxy$clojure.lang.A

Re: bug: clojure.walk removes all the metadata

2010-07-21 Thread Pedro Teixeira
On Jul 21, 9:59 pm, Pedro Teixeira wrote: > On Jun 22, 6:23 pm, Krešimir Šojat wrote: > > > While traversing the data structure both prewalk and postwalk remove > > all the metadata: > > > user=> (require '[clojure.walk :as w]) > > nil > &g

Re: bug: clojure.walk removes all the metadata

2010-07-21 Thread Pedro Teixeira
On Jun 22, 6:23 pm, Krešimir Šojat wrote: > While traversing the data structure both prewalk and postwalk remove > all the metadata: > > user=> (require '[clojure.walk :as w]) > nil > user=> (def data {:a ^{:a :this-is-a} [1 2 3]}) > #'user/data > user=>

bug: clojure.walk removes all the metadata

2010-06-22 Thread Krešimir Šojat
While traversing the data structure both prewalk and postwalk remove all the metadata: user=> (require '[clojure.walk :as w]) nil user=> (def data {:a ^{:a :this-is-a} [1 2 3]}) #'user/data user=> (meta (:a data)) {:a :this-is-a} user=> (meta (:a (w/postwalk identity data))

Re: clojure.walk

2010-03-21 Thread Stuart Sierra
clojure.walk is a terrible hack that I wrote and abandoned 2 years ago. It never should have made it into the Clojure distribution, for which I apologize. I will campaign for its deletion just as soon as I find a suitable replacement. -SS -- You received this message because you are

Re: clojure.walk

2010-03-20 Thread cej38
I discussed prewalk and postwalk with a another Clojure user that I am friends with. He sent me the following, via email, this morning: I have a workaround/solution for you.I still don't know exactly why, but the :else clause in walk calls outer on form. This will give you all sorts of class

Re: clojure.walk

2010-03-19 Thread cej38
Kevin, thank you for your example. Ok here is what I get: (prewalk #(doto % prn) [[3 [3]] [3 3]]) [[3 [3]] [3 3]] [3 [3]] 3 [3] 3 [3 3] 3 3 [[3 [3]] [3 3]] Thus, it appears that an "element" of my nested vectors isn't just the values within the vectors, but also stands for the inner vectors as we

Re: clojure.walk

2010-03-19 Thread Kevin Downey
I'm not overly familiar with clojure.walk, but I think you'll find the output of (prewalk #(doto % prn) [[3 [3]] [3 3]]) very illuminating. On Fri, Mar 19, 2010 at 2:13 PM, cej38 wrote: > This post has two parts. > > Part 1. > > I know that the API is trying to hit the

clojure.walk

2010-03-19 Thread cej38
This post has two parts. Part 1. I know that the API is trying to hit the sweet spot on the brevity vs. information curve, but there are several areas where more information is needed; one of these is clojure.walk. Let's say that I have some nested set of vectors: (def nestV [ [0 [0] ]

Documentation for clojure.test, clojure.walk etc

2009-08-14 Thread Sean Devlin
Hello everyone, Recently the following lib were promoted from contrib to the standard library: * clojure.contrib.test-is becomes clojure.test * clojure.contrib.stacktrace becomes clojure.stacktrace * clojure.contrib.template becomes clojure.template * clojure.contrib.walk becomes clojure.walk