On Wednesday, June 13, 2012 5:47:55 PM UTC+2, Andy C wrote:
>
> On Wed, Jun 13, 2012 at 4:05 AM, JuanManuel Gimeno Illa wrote: 
> > My solution: 
> > 
> > (defn lis [s] 
> >   (->> s 
> >        (partition 2 1) 
> >        (partition-by (partial apply <=)) 
> >        (filter (fn [[[a b]]] (< a b))) 
> >        (reduce (fn [m s] (if (> (count s) (count m)) s m)) []) 
> >        (#(cons (ffirst %) (map second %))))) 
>
> nice trick with "(partition 2 1)" , The [n step coll] version of 
> partition is quite powerful. 
>

Initially I had done (map vector s (rest s)) but with partition I think is 
more elegant.

Juan Manuel 

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to