Re: Simlpe style question

2010-05-19 Thread carlitos
Hello, On May 19, 4:47 pm, Jay Fields wrote: > I'm not sure what the output should look like, The fact that it is not obvious what the original code was supposed to do indicates that it was not very readable... Something like this would be much easier to understand (not very compact, though):

Re: Question about how to write efficient code in functional style

2010-02-28 Thread carlitos
On Feb 28, 2:54 am, logan wrote: > Let's say I want to write a function that takes as an argument a list > of n numbers, and returns 4 lists, a list of odd numbers that are > multiples of 5, a list of even numbers that are multiples of 5, a list > of odd numbers that are not multiples of 5, and a

Re: longest contiguous increasing subsequence

2010-02-03 Thread carlitos
On Feb 3, 8:55 pm, braver wrote: > Meikel -- cool lazy solution, but doesn't generalize to replace <= > with a predicate.  Here's my non-lazy, reduce-based one generic with > instantiations: > > (defn clis-pred >   [pred s] >   (let [[x & xs] s [r zs _] >     (reduce (fn [[r zs z] e] >       (if (

Re: longest contiguous increasing subsequence

2010-01-28 Thread carlitos
;; Ok, I'll try again using less columns... (defn clis [coll]     (if (empty? coll) []         (loop [[head & tail] (rest coll) streak [(first coll)] output []]             (cond                 (nil? head)               (conj output streak)      

Re: longest contiguous increasing subsequence

2010-01-28 Thread carlitos
On Jan 28, 7:26 am, braver wrote: > I'd like to partition a positive numeric sequence into subsequences so > that each increasing subsequence is the longest possible among its > neighbors.  Here's the closest I got so far: > > (use 'clojure.contrib.seq-utils) > (defn clis [s] (->> s (into [-1]) (p

bugs in cl-format.clj

2009-10-28 Thread carlitos
Hello, I've encountered a couple of issues with the cl-format function included in contrib.pprint (cl-format nil "~1,1$" -12.0) ;; => "12.0" the sign is lost I think the problem is the following assignment in the dollar-float function add-sign (and (:at params) (not (neg? arg))) ;;

Re: parsing program for nested parens and square brackets

2009-07-03 Thread carlitos
Probably the following is much less efficient than the other solutions proposed, but I find it easier to understand (and if I didn't misunderstand the problem it gives the right answer). (defn simplify-1 "remove adjacent pairs of opening/closing brackets" ([string] (simplify-1 "" string))

Re: Incanter classpath difficulties

2009-06-21 Thread carlitos
In my previou message I wrote > I can reproduce the issues you report where I meant to say > I _can't_ reproduce the issues you report Sorry for the noise. Carlos --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "C

Re: Incanter classpath difficulties

2009-06-21 Thread carlitos
On Jun 21, 5:01 pm, Anand Patil wrote: > Hi David and all, > > Just trying to get up and running with Incanter, on a Mac with the github > head. The clj script doesn't find part of parallel colt: > > (head-mac bin) ./clj > Clojure 1.1.0-alpha-SNAPSHOT Hello, I think the script is intended to be

Re: lancet: Clojure controlling Ant

2008-11-06 Thread carlitos
On Nov 6, 7:48 pm, Stuart Halloway <[EMAIL PROTECTED]> wrote: > I am playing around with using Clojure to control Ant, something along   > the lines of Groovy's Gant. [] I know next to nothing about ant, and what kind of control will lancet provide, but the proposed syntax reminds me of what

Re: (source name)

2008-11-03 Thread carlitos
On Nov 3, 7:03 pm, Chouser <[EMAIL PROTECTED]> wrote: > [...] It's not pretty, and it only works on functions defined in the clojure > namespace.  [...] The variation below works in a more general setting: it will look for the source file anywhere in the classpath (including jar files) or in user