On Oct 7, 5:02 pm, Alan Malloy wrote:
> Can't you write that function yourself?
>
> (defn realized-length [xs]
> (loop [n 0 xs xs]
> (if (realized? xs)
> (recur (inc n) (rest xs))
> n)))
Thanks, Alan!
>
> drop returns a new lazy sequence, with no realized elements,
I didn't
ached. Maybe something like "realized-
length", just for lazy-seq's, which would report how far along
the sequence has realization occurred.
Thanks,
George Kangas
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To
Thanks, Baishampayan and Sam!
Since so little effort is required to get the BigInt behavior, you'll
all be relieved to hear that I Approve of This Change. Should I ever
need high performance from Clojure, I'll actually be happy about it.
Notwithstanding the snarking tone of my original post.
Geo
I'm quite happy using emacs's Scheme support. But then, I've never
experienced the luxury of swank and slime.
The Scheme modes work a bit better (for Clojure) than the Lisp modes,
because: 1) it highlights matching square and curly brackets, not just
parentheses; and 2) after you do "C-u M-x run-
Greetings, Clojure community. I've been playing around with
clojure,
and just downloaded 1.3.0. Here's a REPL session, wherein I define
a power-of-two function, and apply it a couple of times.
lecturer-01:clojure-1.3.0 kangas$ java -cp clojure-1.3.0.jar
clojure.main
Clojure 1.3.0
user
I believe the bug can be blamed on "nth".
Using "nth", I make a function which should be identity on natural
numbers:
Clojure 1.2.1
user=> (defn ident [n] (nth (iterate inc 0) n))
#'user/ident
And it works, for reasonable size numbers:
user=> (ident 12345)
12345
user=> (ident 7654321)
7654321
Hi, Stu,
Loving your book!
I posted a reply earlier, through a different interface, which went
to "moderators". Sorry for the clumsiness, but I'm not familiar with
the mechanics of newsgroups.
On Sep 11, 7:28 am, Stuart Halloway wrote:
> The consing version of ev-stream is self-referentia
user=> (time (mod3 9876543210))
"Elapsed time: 37759.615 msecs"
1
user=> (mod 987654321 3)
0
Whoa! The computation finished in reasonable time, but with the WRONG
answer! How did that happen?
Did I find a bug?
Thanks for reading this far, and best regards,
George K