On Wed, Aug 19, 2009 at 01:08, tmountain wrote:
[snip]
>
> Also, this is
> a side question, but does anybody know if there's a faster (or better)
> way to compare two lazy sequences than the following?
>
> (defn seq-identical? [seq1 seq2]
> (zero? (compare (vec seq1) (vec seq2
>
A note on th
Thanks for all the helpful suggestions guys. I put together a little
article on determining coin flipping probability with Clojure. I'm
still a newb, but this Google Group is helping me progress with the
language.
http://travis-whitton.blogspot.com/2009/08/flipping-coins-with-clojure.html
Travis
> And = should work I think:
> (= [1 2 3] [1 2 3]) returns true.
Oh man... now I feel stupid. Thanks for the help!
Travis
On Aug 18, 7:17 pm, CuppoJava wrote:
> "repeatedly" is the function that you're looking for in the first
> question.
>
> And = should work I think:
> (= [1 2 3] [1 2 3])
On Aug 19, 1:08 am, tmountain wrote:
> Hi, I was wondering if there's a more idiomatic way to do the
> following:
>
> (defn flip-coin []
> (int (rand 2)))
To add to CuppoJava's advice, (rand-int 2) is a synonym of (int (rand
2)).
All the best,
Tayssir
--~--~-~--~~~--
Hi, I was wondering if there's a more idiomatic way to do the
following:
(defn flip-coin []
(int (rand 2)))
(let [coin-flips (for [x (repeat true)] (flip-coin))]
Basically I want to generate an infinite lazy sequence based on the
output of a given function with zero or more arguments.
"repeatedly" is the function that you're looking for in the first
question.
And = should work I think:
(= [1 2 3] [1 2 3]) returns true.
Hope that helps
-Patrick
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups "Cl