Re: Opposite function to cons, but in terms of construction, not destruction.

2011-12-10 Thread Andy Fingerhut
I forgot to mention, if you want a Clojure persistent data structure that is efficient (O(1) or O(log n)) for all of these operations: + adding to/removing from beginning + adding to/removing from end + concatenating + splitting into two sequences, at any specified item in the middle look at fing

Re: Opposite function to cons, but in terms of construction, not destruction.

2011-12-10 Thread Tamreen Khan
Conj (http://clojuredocs.org/clojure_core/clojure.core/conj) does what you need for vectors. It's behavior depends on the type of collection passed, so if you did: (conj '(1 2 3) 4) you would end up with '(4 1 2 3). For vectors it appends to the end of the list, for lists the beginning. On Sat,

Re: Bug in core.match?

2011-12-10 Thread David Nolen
Thanks. On Saturday, December 10, 2011, Benny Tsai wrote: > Done! > On Saturday, December 10, 2011 9:08:22 AM UTC-7, David Nolen wrote: >> >> Please open a ticket on JIRA with this case - http://dev.clojure.org/jira/browse/MATCH >> Thanks! >> David >> On Sat, Dec 10, 2011 at 5:33 AM, Benny Tsai

Re: Bug in core.match?

2011-12-10 Thread Benny Tsai
Done! On Saturday, December 10, 2011 9:08:22 AM UTC-7, David Nolen wrote: > > Please open a ticket on JIRA with this case - > http://dev.clojure.org/jira/browse/MATCH > > Thanks! > David > > On Sat, Dec 10, 2011 at 5:33 AM, Benny Tsai wrote: > >> Hi all, >> >> Ran into what appears to be a bug t

Re: Bug in core.match?

2011-12-10 Thread David Nolen
Please open a ticket on JIRA with this case - http://dev.clojure.org/jira/browse/MATCH Thanks! David On Sat, Dec 10, 2011 at 5:33 AM, Benny Tsai wrote: > Hi all, > > Ran into what appears to be a bug tonight. This is the simplest example I > could come up with: > > (defn f [xs] > (match xs >

Re: Opposite function to cons, but in terms of construction, not destruction.

2011-12-10 Thread Andy Fingerhut
conj adds an element to a data structure in a place most efficient for the particular type of data structure. For lists, this is at the beginning. For vectors, it is at the end: user=> (conj (conj (conj '(1 2 3) 4) 6) 7) (7 6 4 1 2 3) user=> (conj (conj (conj [1 2 3] 4) 6) 7) [1 2 3 4 6 7] If yo

Opposite function to cons, but in terms of construction, not destruction.

2011-12-10 Thread Michael Jaaka
Is there something like: (defn snoc[ col item ] (lazy-seq (if (seq col) (let[ [f & r] col ] (if (seq r) (cons f (snoc r item)) (cons f [i

Bug in core.match?

2011-12-10 Thread Benny Tsai
Hi all, Ran into what appears to be a bug tonight. This is the simplest example I could come up with: (defn f [xs] (match xs [:a] "a" [:b b] b [:c] "c" :else "problem!")) [:a] and [:b b] can be matched with no problems, but [:c] can't be matched for some

Re: Trying to use CDT on 1.3.0

2011-12-10 Thread Ulises
Alternatively you can just do: $ lein plugin install swank-clojure 1.3.3 and have swank across projects without having to add your :dev-dependencies for each one. U -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email t