That's perfect, thanks!
On Sep 30, 4:55 pm, Mark Engelberg wrote:
> clojure.contrib.cartesian-product does what your nested function does,
> but more efficiently, using iteration rather than recursion.
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
clojure.contrib.cartesian-product does what your nested function does,
but more efficiently, using iteration rather than recursion.
--
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
I was discussing this on the clojure channel, and it seems as though
avoiding explicit recursion is the idiomatic thing to do. Is there a
better way to define a function that loops over an arbitrary number of
sequences in a nested fashion, similar to the 'for' macro, without
relying on recursion?
Out of simple curiosity I wondered how hard it would be to implement flow
control using proxy. I know Rich isn't hot on non-structured programming,
but there may be times where this might be useful:
(ns flow.return-from
(:import (flow IReturnFrom)))
(defn create-return-from
[value]
(proxy [T
rious about the general case, but you guys may be right
that nested loops just aren't needed.
My experience in the general case:
If I found myself in need for a 'break' or 'continue', it would have
been better to put the undesired values not in the loop in the
first pl
My code works--it does function! :-) ).
It was kind of a first cut in a more imperative style because I
thought it might be more efficient destructively modifying a char
array rather than copying lots of substrings. I intended to attempt a
more functional version next.
I was more curious about the gen
I didn't take time to read your post in detail because I'm on my way
to bed and my brain has already checked out.
However, as I've gotten better at Clojure and functional programming,
I find I use loops less and less. I just got done putting the
finishing touches on a package to analyse stock ch
Hi David,
Quite a few times when I've felt the need for this sort of thing I've
found that laziness comes to the rescue. Would something like this
sort of approach work for you?
(defn possibilities [word pos]
"All variations of `word' with letters from 'a' to 'z' inserted at
`pos'"
(let [[b
I'm working on a spell checker that attempts to suggest corrections
from a given dictionary. One of the heuristics is to see if inserting
a character at each point in the given string results in a recognized
word. So I have an outer loop that moves across each position in the
string and an