Re: bit-or arity appears limited to 2 items

2011-10-25 Thread rugby_road
Thanks!  That was it!
Blake

On Oct 23, 10:24 pm, Sean Corfield seancorfi...@gmail.com wrote:
 On Fri, Oct 21, 2011 at 4:12 PM, rugby_road cabjh...@embarqmail.com wrote:
  The bit-or arity seems to be limited to 2, rather than more, which
  seems to disagree with the documentation.  I get Wrong number of args
  (3) passed to: core$bit-or for (bit-or 1 1 1).  Have I misunderstood
  this operation; shouldn't it take any number of values?

 Clojure 1.3.0:

 user= (doc bit-or)
 -
 clojure.core/bit-or
 ([x y] [x y  more])
   Bitwise or
 nil
 user= (bit-or 1 1 1)
 1
 user= *clojure-version*
 {:major 1, :minor 3, :incremental 0, :qualifier nil}

 Clojure 1.2.1:

 user= (doc bit-or)
 -
 clojure.core/bit-or
 ([x y])
   Bitwise or
 nil
 user= (bit-or 1 1 1)
 java.lang.IllegalArgumentException: Wrong number of args (3) passed
 to: core$bit-or (NO_SOURCE_FILE:2)
 user= *clojure-version*
 {:major 1, :minor 2, :incremental 1, :qualifier }

 So it looks like the ability to take more than two arguments was added
 in 1.3.0 (and the doc-string agrees).
 --
 Sean A Corfield -- (904) 302-SEAN
 An Architect's View --http://corfield.org/
 World Singles, LLC. --http://worldsingles.com/
 Railo Technologies, Inc. --http://www.getrailo.com/

 Perfection is the enemy of the good.
 -- Gustave Flaubert, French realist novelist (1821-1880)

-- 
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 posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


creating a finite sequence of uncertain length

2011-10-25 Thread rugby_road
I have a function without arguments which returns a big,complex object
repeatedly until it returns nil.  That is to say that the function
will produce a sequence of objects, but I don't know how many.  I want
to call the generator as a lazy sequence but how do I make such a
thing?

Currently I am doing something like this:

(loop [i (myfunc)]
(if (nil? i) nil ;; we are done here
(let
  ...do a bunch of stuff to i
(recur (myfunc)))

This works okay, but leaves that  recur statement dangling at the end
of the routine. What I would like to do is  the cleaner:

(doseq [ i (myseq)]
 ...do a bunch of stuff to i)

I have tried using (def myseq (repeatedly (myfunc))), but the
repeatedly  doesn't seem to ever end.  I have tried having myfunc
return a nil, or a [] but  it just keeps repeating the final end value
of nil or [].

How would you make such a terminating sequence?
Is there a special final value myfunc must return so that the sequence
ends gracefully?
 Or is this just an abuse of the concept of a sequence and I should
just stick to the loop?

thanks
Blake

-- 
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 posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


bit-or arity appears limited to 2 items

2011-10-23 Thread rugby_road
The bit-or arity seems to be limited to 2, rather than more, which
seems to disagree with the documentation.  I get Wrong number of args
(3) passed to: core$bit-or for (bit-or 1 1 1).  Have I misunderstood
this operation; shouldn't it take any number of values?

thanks
Blake

-- 
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 posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en