Re: Clojure newbie code review

2013-09-10 Thread Igor Demura
Thank you Philipp, this is really helpful! Marshall's guess where *read-eval* from is right. I didn't googled what does it mean, just left as-is from the Leiningen template. Talking on replacement to join. For this function I'll link additional library. My question how this works: in C++ world,

Re: Clojure newbie code review

2013-09-10 Thread Andy Fingerhut
Regarding your question about join: The clojure.string namespace contains the join function recommended to you. All functions in the clojure.string namespace, and several other namespaces (see below for a complete list) are part of the Clojure JAR file, and in that sense come at "no additional cha

Re: Clojure newbie code review

2013-09-10 Thread Marshall Bockrath-Vandegrift
Philipp Meier writes: > (alter-var-root #'*read-eval* (constantly false)) > => why do you think this is necessary? Some versions of the Leiningen `app` template put this in the skeleton initial source file. I assume that’s where this came from. -Marshall -- -- You received this message beca

Re: Clojure newbie code review

2013-09-10 Thread Philipp Meier
Am Dienstag, 10. September 2013 01:24:10 UTC+2 schrieb Igor Demura: > > Hi Clojure community, > > (I tried codereview.stackaxchange.com before, but no responses where) I'm > Clojure newbie, and feel very excited about it and functional programming > in general. I wrote tiny app (59 lines of code

Clojure newbie code review

2013-09-09 Thread Igor Demura
Hi Clojure community, (I tried codereview.stackaxchange.com before, but no responses where) I'm Clojure newbie, and feel very excited about it and functional programming in general. I wrote tiny app (59 lines of code) which renders a directory tree to the terminal, filtering with a regex. I'm s

Re: Newbie code review

2009-08-11 Thread Chad Harrington
The intent of the mapping can be made clearer with destructuring I > think. Also, flatten is not needed: a core function called "into" will > transform a sequence of key/value pairs into a map. > > (def age-index > (into (sorted-map) >(map (fn [[k [name age]]] [age k]) data))) > Jarkko, Than

Re: Newbie code review

2009-08-09 Thread Achim Passen
Hi! If you'd like to use relational structures, take a look at clojure.set. There's a couple of functions which let you do relational algebra (project, select, rename, plus some other things like index). Clojure represents relations as sets of maps: (def data #{{:id 0 :name "Fred":age 3

Re: Newbie code review

2009-08-09 Thread Jarkko Oranen
On Aug 9, 9:27 am, Chad Harrington wrote: > Hi all, > I am learning Clojure and would like to see if there is a better/more > concise/faster/more idiomatic/etc. way to create the age-index below.  My > version seems awfully roundabout. The basic concept is a toy database table > stored as a hashm

Newbie code review

2009-08-09 Thread Chad Harrington
Hi all, I am learning Clojure and would like to see if there is a better/more concise/faster/more idiomatic/etc. way to create the age-index below. My version seems awfully roundabout. The basic concept is a toy database table stored as a hashmap. Each row has a row-id and and a vector of data [n