Re: clojurescript and regular expr.

2012-08-12 Thread Vincent
code is below function args is entry - a map entry to-match - a string to match to one of val of key in entry (defn matchName [ entry to-match] (let [match-str (.toLowerCase to-match) str-pattern (re-pattern (str "(" match-str ")")) m (re-matcher str-pattern (.toL

Re: Pattern of Succinctness

2012-08-12 Thread Alan Malloy
This doesn't work. On Sunday, August 12, 2012 12:44:11 PM UTC-7, Pierre-Henry Perret wrote: > > I prefer (filter (partial not nil?) coll) as a HOF > > Le dimanche 12 août 2012 20:46:59 UTC+2, rmarianski a écrit : >> >> On Sun, Aug 12, 2012 at 11:22:55AM -0700, Takahiro Hozumi wrote: >> > > (fil

Feature request: multi arity into

2012-08-12 Thread yongqli
Hi, Any reason why into isn't multi arity? (into to & froms) => (reduce into to froms) (into #{} [3 3 4] [2 1] ["a"]) looks better than (reduce into #{} [[3 3 4] [2 1] ["a"]]) -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group,

Re: Attractive examples of function-generating functions

2012-08-12 Thread Malcolm Sparks
> On Wednesday, August 8, 2012 7:48:23 PM UTC+3, Brian Marick wrote: >>> >>> I'm looking for medium-scale examples of using function-generating >>> functions. >>> >>> >>> Brian, when I saw this I was reminded of ring middleware - eg. http://jgre.org/2010/10/04/ring-middleware/ -- You received

Re: Ideas for interactive tasks

2012-08-12 Thread Igor Kupczyński
Hi, For a java course at my university students had to write a railway simulator - the idea was more or less to write randomly generate a map with railways and regular roads. Some of the tracks where double (i.e. trains can go both directions at the same time) and the other just a single track

Re: Pattern of Succinctness

2012-08-12 Thread Pierre-Henry Perret
I prefer (filter (partial not nil?) coll) as a HOF Le dimanche 12 août 2012 20:46:59 UTC+2, rmarianski a écrit : > > On Sun, Aug 12, 2012 at 11:22:55AM -0700, Takahiro Hozumi wrote: > > > (filter (partial not nil?) coll) > > You mean (filter (comp not nil?) coll). > > I'm not sure which is mo

Re: Pattern of Succinctness

2012-08-12 Thread Robert Marianski
On Sun, Aug 12, 2012 at 11:22:55AM -0700, Takahiro Hozumi wrote: > > (filter (partial not nil?) coll) > You mean (filter (comp not nil?) coll). > I'm not sure which is more readable, but thanks for Meikel and Alex, I now > prefer (remove nil? coll). remove is better in this case, but for posterit

Re: Pattern of Succinctness

2012-08-12 Thread Takahiro Hozumi
> (filter (partial not nil?) coll) You mean (filter (comp not nil?) coll). I'm not sure which is more readable, but thanks for Meikel and Alex, I now prefer (remove nil? coll). Thanks. On Monday, August 13, 2012 2:38:23 AM UTC+9, Tamreen Khan (Scriptor) wrote: > > Is the last one considered gene

AW: Pattern of Succinctness

2012-08-12 Thread Meikel Brandmeyer
Hi, pay attention: (or (:a {:a false}) 0) (:a {:a false} 0) Same holds in case false is nil. Using these "transformations" can easily introduce bugs, depending on the context. Kind regards Meikel -Ursprüngliche Nachricht- Von: Takahiro Hozumi An: clojure@googlegroups.com Gesendet: So

Re: Pattern of Succinctness

2012-08-12 Thread Alex Baranosky
(filter identity foos) and (filter #(not (nil? %)) foos) aren't equivalent. I prefer (remove nil? foos) Succint and direct. On Sun, Aug 12, 2012 at 11:13 PM, Bill Caputo wrote: > > On Aug 12, 2012, at 12:38 PM, Tamreen Khan wrote: > > (filter #(not (nil? %)) coll) >> (filter identity coll) ;;

AW: Re: Pattern of Succinctness

2012-08-12 Thread Meikel Brandmeyer
Hi, in case you really want only nils filtered out: (filter (complement nil?) coll) or (remove nil? coll) Kind regards Meikel -Ursprüngliche Nachricht- Von: Bill Caputo An: Tamreen Khan Cc: clojure@googlegroups.com Gesendet: So, 12 Aug 2012, 19:43:58 MESZ Betreff: Re: Pattern of Succi

Re: Pattern of Succinctness

2012-08-12 Thread Bill Caputo
On Aug 12, 2012, at 12:38 PM, Tamreen Khan wrote: > (filter #(not (nil? %)) coll) > (filter identity coll) ;; nearly equal > Is the last one considered generally more readable? I think the following is > clearer while still not having as much noise as the first filter example: > > (filter (part

Re: Pattern of Succinctness

2012-08-12 Thread Tamreen Khan
Is the last one considered generally more readable? I think the following is clearer while still not having as much noise as the first filter example: (filter (partial not nil?) coll) On Sun, Aug 12, 2012 at 1:35 PM, Takahiro Hozumi wrote: > Hi, > I would like to know common technics that make c

Pattern of Succinctness

2012-08-12 Thread Takahiro Hozumi
Hi, I would like to know common technics that make code succinct. For example: (or (:b {:a 1}) 0) (:b {:a 1} 0) (if-not x 1 2) (if x 2 1) (filter #(not (nil? %)) coll) (filter identity coll) ;; nearly equal Please let me know any tips you found. Cheers, Takahiro. -- You received this message

Re: Strange coercions

2012-08-12 Thread Pierre-Henry Perret
Project is here : bOOtOne Le dimanche 5 août 2012 03:45:59 UTC+2, Pierre-Henry Perret a écrit : > > Running a lein2 check gives -> > ___ > Exception in thread "main" java.lang.IllegalArgumentException: No > implementation of me

Re: A clojurescript newbie q.

2012-08-12 Thread Moritz Ulrich
Take a look at the javascript console. Most likely the `prinln' generates an error because *print-fn* isn't bound. It's not usual to use println on the client side. Logging to console is done via (.log js/console obj1 obj2 ...) On Sun, Aug 12, 2012 at 10:01 AM, mmwaikar wrote: > Hi, > > I am expe

A clojurescript newbie q.

2012-08-12 Thread mmwaikar
Hi, I am experimenting with clojurescript, and have the following page - (ns maze.views.mm (:use [noir.core :only [defpartial]] [hiccup.page :only [html5 include-js]] [hiccup.element :only [javascript-tag]] [maze.views.cssgenerator] [maze.constants])) (defn gene