On Feb 20, 8:38 am, Johnny Kwan wrote:
> The specific problem I'm trying to solve is to see if two sequences of
> strings "=" each other. If one sequence is shorter, the "=" comparison stops
> at the end of the shorter sequence. So I've been trying to do a simple
> (reduce and (map = seq1 seq
On Feb 20, 8:38 am, Johnny Kwan wrote:
> Hi,
>
> This is a very basic question, but I can't find the answer anywhere. How do
> you take the "and" or "or" of sequence?
Try using every? and some, respectively.
--
You received this message because you are subscribed to the Google
Groups "Clo
And while we are at it:
(defn f-or
[s]
(loop [s (seq s)]
(when s
(if-let [f (first s)]
f
(recur (next s))
On Sat, Feb 20, 2010 at 06:24:53PM +0100, Meikel Brandmeyer wrote:
> (defn fand
> [s]
> (loop [s (seq s)
> l nil]
> (if s
> (when-let
Hi,
here a "short-circuiting" (in sense of realising only needed values from
the passed seq) version of a "function and".
(defn fand
[s]
(let [s (seq s)
l nil]
(if s
(when-let [f (first s)]
(recur (next s) f))
l)))
clojureql.sql=> (fand (map = [:a :b :c] [:a :
OK, I should have just tried passing in 'and at the REPL before posting. Of
course, it works. Is this the idiomatic way? I'm still curious about
short-circuiting.
On Feb 20, 2010, at 11:38 AM, Johnny Kwan wrote:
> Hi,
>
> This is a very basic question, but I can't find the answer anywhere.