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

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 mmwai...@gmail.com wrote:

Re: Strange coercions

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

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

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 fat...@googlemail.comwrote: Hi, I would like to know common

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 (partial

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 logos...@gmail.com An: Tamreen Khan histor...@gmail.com Cc: clojure@googlegroups.com Gesendet: So, 12 Aug 2012,

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 logos...@gmail.com wrote: On Aug 12, 2012, at 12:38 PM, Tamreen Khan wrote: (filter #(not (nil? %)) coll) (filter

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 fat...@googlemail.com An:

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

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 posterity

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 more

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: 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 this message

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, send

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: (filter

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