Re: unconditional append to end

2014-02-10 Thread Sean Corfield
I find clojureatlas.com very helpful for exploring the API, especially since it is concept-based (so "Maps" is a concept that shows all the related functions and concepts). It's only up to 1.4.0 - hopefully Chas will update it to 1.5 / 1.6 at some point - but it's better than a site stuck at 1.

Re: unconditional append to end

2014-02-10 Thread Mars0i
On Sunday, February 9, 2014 11:38:39 PM UTC-6, mynomoto wrote: > > +1 to the Cheat Sheet although I prefer this version: > http://jafingerhut.github.io/cheatsheet-clj-1.3/cheatsheet-tiptip-cdocs-summary.html > Several variations on the cheatsheet are available via links from the main cheatshee

Re: unconditional append to end

2014-02-10 Thread Mars0i
On Monday, February 10, 2014 11:56:18 AM UTC-6, t x wrote: > > Someone needs to make a flappy bird version of > > http://jafingerhut.github.io/cheatsheet-clj-1.3/cheatsheet-tiptip-cdocs-summary.html > > > It provides a description of the function, you type in the function name. > :-) > Like

Re: unconditional append to end

2014-02-10 Thread Stuart Sierra
On Friday, February 7, 2014 7:20:09 PM UTC-5, t x wrote: > Thus, my question: is there a builtin to _unconditinoally_ > append to the end of a list/sequence/vector? Not built in. If you want things to grow at the end, you probably want vectors anyway. So try this: (defn conjv [coll item]

Re: unconditional append to end

2014-02-10 Thread mynomoto
You can see the project of the new clojuredocs.org on https://github.com/clojuredocs/web There is discussion about clojuredocs.org here https://groups.google.com/d/msg/clojure/jWMaop_eVaQ/I-H4Fn1brVcJ But I don't know about the current status. Marcelo On Monday, February 10, 2014 2:22:04 PM U

Re: unconditional append to end

2014-02-10 Thread t x
Someone needs to make a flappy bird version of http://jafingerhut.github.io/cheatsheet-clj-1.3/cheatsheet-tiptip-cdocs-summary.html It provides a description of the function, you type in the function name. :-) On Mon, Feb 10, 2014 at 8:22 AM, Alan Thompson wrote: > Thank you for the cheat sheet

Re: unconditional append to end

2014-02-10 Thread Alan Thompson
Thank you for the cheat sheet refs. Definitely helpful. Anybody have any insight into the current state of clojuredocs.org? Alan On Sun, Feb 9, 2014 at 9:38 PM, mynomoto wrote: > +1 to the Cheat Sheet although I prefer this version: > http://jafingerhut.github.io/cheatsheet-clj-1.3/cheatsheet

Re: unconditional append to end

2014-02-09 Thread mynomoto
+1 to the Cheat Sheet although I prefer this version: http://jafingerhut.github.io/cheatsheet-clj-1.3/cheatsheet-tiptip-cdocs-summary.html After you go though the cheat sheet you can try http://clojure.github.io/clojure It's more complete but way less nice. On Monday, February 10, 2014 3:21:16

Re: unconditional append to end

2014-02-09 Thread Mars0i
On Sunday, February 9, 2014 10:45:04 PM UTC-6, Alan Thompson wrote: > > ... > I saw an email a while back that claimed ClojureDocs.org is working on a > re-write of the site, and an upgrade from Clojure 1.2 to 1.5. In the > meantime, is there a better way of exploring the API? > Not a full answ

Re: unconditional append to end

2014-02-09 Thread Alan Thompson
Holy cow! Where have these been hiding! They don't show up on ClojureDocs.org at all!!! I was about to write my own macro vmap to implement (vec (map(...)) for just the use cases outlined above. I just looked on clojure.org, and searching on "map" doesn't return any (useful) results. I eventua

Re: unconditional append to end

2014-02-08 Thread Gary Verhaegen
Or use vec to turn a sequence into a vector. As a general comment, using a dynamically typed language should not be seen as an opportunity not to think about types. You should still design your functions, think about the types they should receive, etc. Not having the compiler to check it for you a

Re: unconditional append to end

2014-02-08 Thread mynomoto
Maybe you could use mapv and filterv? This way you will always get a vector and conj apends in the end. On Friday, February 7, 2014 10:20:09 PM UTC-2, t x wrote: > > Consider the following: > > (cons 1 '(2 3 4)) ==> (1 2 3 4) > (cons 1 [2 3 4]) ==> (1 2 3 4) > > (conj '(a b c) 1) ==> (1 a b c

Re: unconditional append to end

2014-02-07 Thread Travis Moy
Ah! That makes more sense. Yeah, after I forced it to realize the sequence, it turned out that concat was a lot slower than sticking it into an array: #'user/r > user=> (def coll (range 1)) > #'user/coll > user=> (def coll-v (into [] coll)) > #'user/coll-v > user=> (time (dotimes [_ r] (count

Re: unconditional append to end

2014-02-07 Thread Mark Engelberg
On Fri, Feb 7, 2014 at 9:08 PM, Travis Moy wrote: > Surprisingly it looks like (concat coll '(:a)) is faster than (conj coll-v > :a). That's not really what I would expect; does anybody have a good > explanation for this? Did I just bork the test somehow, or - I mean, > obviously concat's pretty

Re: unconditional append to end

2014-02-07 Thread Travis Moy
You should use a vector, but it's also possible to use concat. For example, (concat '(1 2 3) [4]) will give you (1 2 3 4). This made me curious as to the best way to get a collection into vector, so I played around with it some: user=> (def r 10) > #'user/r > user=> (def coll (range 1))

Re: unconditional append to end

2014-02-07 Thread Armando Blancas
For efficient appends at the end you need a vector. Using the sequence library can be tricky while you're putting together your data structures because it's likely that you'll not done yet with type-specific functions. You'll need to re-create your vector after using map/filter/etc to be able t

unconditional append to end

2014-02-07 Thread t x
Consider the following: (cons 1 '(2 3 4)) ==> (1 2 3 4) (cons 1 [2 3 4]) ==> (1 2 3 4) (conj '(a b c) 1) ==> (1 a b c) (conj '[a b c] 1) ==> [a b c 1] Now, I would like something that _always_ * appends to the end cons is almost what I want, except it alway