> Next, instead of filter, you probably want doseq. The filter function
> filters a collection according to a predicate. The doseq function
> applies a function with side effects (such as println) to each item in
> a collection.
>
> (with-open [rdr (reader "executors.clj")]
> (doseq [[line inde
Hi,
For the purposes of testing another function (not discussed here), I
wrote a function to generate random strings. This is what I ended up
with after some trial and error.
(defn generate-data [size maxlength]
; Returns a collection of 'size random strings, each at most
'maxlength chars
> (defn seq-of-rand-strings [maxlength]
> (repeatedly (fn []
> (apply str (take (rand-int maxlength)
> (repeatedly #(char (+ (int \a) (rand-int 26)
>
> user=> (take 3 (seq-of-rand-strings 10))
> ("kae" "xwuwyp" "xa")
Thanks Chouser. I learned some useful and i
On Jan 13, 2:59 pm, Chouser wrote:
>
> It raises a question, though -- how much functionality should a
> function provide to be worth making everyone who reads the code learn
> the new vocabulary? I've written each of these inline when I've
> needed them. Are they better as idioms or functions?
Hi,
I searched the archives and saw that this has been raised once before,
although it wasn't really a suggestion, didn't raise any real
discussion and didn't reach any conclusion.
I just think it's worth proposing that a function set that includes
every? and not-every? but does not include any?
On Jan 14, 9:13 am, Jason Wolfe wrote:
>
> One thing worth pointing out is that, if a utility is really useful
> many people will independently recreate it with slightly different
> names and functionality, and use it in their code. It seems that this
> results in code that's much more difficult
On Jan 14, 9:07 am, Luc Prefontaine
wrote:
> > As this is a commercial project, I imagine you are quite limited in
> > what you can tell us, but I'd love to hear about the issues you faced
> > during development.
>
> Mostly integration problems with the work flow in the radiology system.
> [..
On Jan 14, 1:12 am, Timothy Pratley wrote:
> I've written small wiki article which dives right into the look and
> meaning of common Clojure constructs with examples. Personally I find
> I learn best by examples and when starting out they were hard to find,
> whereas formal descriptions were ther
On Jan 14, 2:27 pm, "Mark Engelberg" wrote:
> I also find the choice of some/not-any? as opposites to be hard to
> remember. I'd rather it be some/not-some? or any/not-any?
I think some and any? both have their place.
(let [foo (some prime? numseq)]
(do something with foo))
(if (any? com
> > > (defn chunk "Lazily break s into chunks of length n (or less, for the
> > > final chunk)."
> > > [n s]
> > > (when (seq s)
> > > (lazy-cons (take n s)
> > > (chunk n (drop n s)
>
> > Should that "seq" be "seq?". If not, why not?
On Jan 13, 7:17 pm, "Nick Vogel" wrot
> > So, either:
>
> > 1. My experiment was wrong, and seq? is not a valid stand-in
> > for seq in the above code.
>
> Right on the first try! :-)
Well, that's something :)
> user=> (seq-chunk 2 [1 2 3 4 5])
> ((1 2) (3 4) (5))
> user=> (seq?-chunk 2 [1 2 3 4 5])
> nil
>
> This is because a
Hi,
There are three "homes" for clojure-contrib that I've seen referred to
on the web (each in more than one place):
Google Code
Sourceforge
git://github.com/kevinoneill/clojure-contrib.git
Now I think I've got a pretty good idea which one is the correct one,
but how did this situation co
On Feb 4, 12:01 am, Mark Volkmann wrote:
> Are the following statements true? They aren't discussed
> athttp://clojure.org/macros, but I think they are true.
>
> Macros cannot call other macros during their evaluation, but they can
> expand to code that calls macros.
I don't know, but I'll br
On Feb 14, 12:21 pm, Chouser wrote:
> > (defn count-instances [obj lsts]
> > (let [instances-in (fn [lst]
> > (if (cons? lst)
> > (+ (if (= (first lst) obj) 1 0)
> > (instances-in (rest lst)))
> >
On Feb 16, 1:44 pm, Rich Hickey wrote:
> > My thoughts so far:
>
> > 4. The new model is definitely more complicated to understand than
> > the previous model. There was already a certain degree of mental
> > overlap between collections and the seq interface. Now, there is also
> > the subtle
On Feb 17, 1:18 pm, Jesse Aldridge wrote:
> I'm trying to port some Python code to Clojure. I'm new to functional
> programming and I hit a function that is causing my brain to melt.
> The python function looks something like this:
> [..]
>
> If someone could please demonstrate how to
On Feb 25, 10:19 pm, glow wrote:
> Hi everyone!
> I am currently learning Lisp and Clojure. A few days ago i read how
> "if" in Arc works and I wonder why it is not the same in Clojure:
> (if a b ; if a then b
> c d ; elseif c then d
> e) ; else e.
(cond
pred1 form1
Timothy Pratley wrote:
> Jump on in! Just like with swimming the cold soon goes away. [...]
Bad analogy. In swimming, the cold returns about half an hour later :)
Gavin
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Grou
18 matches
Mail list logo