Re: Buggy behavior of recur with primitives

2009-06-27 Thread Meikel Brandmeyer
Hi, Am 28.06.2009 um 07:53 schrieb Handkea fumosa: The recur arg in question is (+ (* G__12815 G__12815) (* G__12817 G__12816 G__12816) G__12819) all of whose operands are doubles. This seems buggy. Yes, that seems ominous. I'm not doing much number crunching (read: I don't need tight loops

Re: ClassCastException - maybe a bug

2009-06-27 Thread Meikel Brandmeyer
Hi, Am 27.06.2009 um 22:30 schrieb Handkea fumosa: I'd agree that a ClassCastException is not inappropriate if you try to put heterogeneous objects into a sorted-set. But contains? should probably just return true or false, never throw. Michael's set doesn't contain 5; asking whether it does d

Re: Bug: (list? (cons 4 '(1 2 3))) returns false!

2009-06-27 Thread Meikel Brandmeyer
Hi, Am 28.06.2009 um 07:45 schrieb Handkea fumosa: It's list? that isn't. No. list? is not broken. Every list is a seq, but not every seq is a list. Consider: (cons 0 (iterate inc 1)) This is no list! It's a sequence. Why should list? return true? In Clojure there is no such thing as a con

Buggy behavior of recur with primitives

2009-06-27 Thread Handkea fumosa
(defn foo [z-r z-i c-r c-i bailout max-iters] (let [G__12819 (double c-r) G__12820 (double c-i) G__12817 (double -1) G__12818 (double 2) mi (int max-iters) b (double (* bailout bailout))] (loop [G__12815 (double z-r) G__12816 (double z-i)

Re: Bug: (list? (cons 4 '(1 2 3))) returns false!

2009-06-27 Thread Richard Newman
>> cons is acting according to its documentation. > > It's list? that isn't. That's not strictly true: user=> (doc list?) - clojure.core/list? ([x]) Returns true if x implements IPersistentList nil user=> (cons 5 '(1 2 3)) (5 1 2 3) user=> (ancestors (type *1)) #{cloju

Re: Bug: (list? (cons 4 '(1 2 3))) returns false!

2009-06-27 Thread Handkea fumosa
On Jun 28, 12:41 am, "Stephen C. Gilardi" wrote: > On Jun 28, 2009, at 12:07 AM, Handkea fumosa wrote: > > > user=> (list? '(1 2 3)) > > true > > user=> (list? (cons 4 '(1 2 3))) > > false > >    user=> (doc cons) >    - >    clojure.core/cons >    ([x seq]) >      Returns

Re: Bug: (list? (cons 4 '(1 2 3))) returns false!

2009-06-27 Thread Stephen C. Gilardi
On Jun 28, 2009, at 12:07 AM, Handkea fumosa wrote: user=> (list? '(1 2 3)) true user=> (list? (cons 4 '(1 2 3))) false user=> (doc cons) - clojure.core/cons ([x seq]) Returns a new seq where x is the first element and seq is the rest. nil user=>

Re: java.ext.dirs problem

2009-06-27 Thread Alex Combas
Hello, Undoubtedly it is not the best solution, but all I do is export a variable called CLASSPATH pointing to whichever directories I want to require or load. # append to your .bashrc script # Start CLASSPATH=/home/user/aaa:/home/user/bbb:$CLASSPATH export CLASSPATH # End The only gotcha so far

(for [binds] body) violates convention for non-conditional binding forms

2009-06-27 Thread Handkea fumosa
user=> (doall (for [x (range 2) y (range 2)] (println x "@" y) (* x y))) Expected: 0 @ 0 0 @ 1 1 @ 0 1 @ 1 (0 0 0 1) Got: # Wrapping the body in an explicit "do" fixes it, but the need for an explicit "do" violates the convention for non-conditional binding forms -- ones like (let [

Bug: (list? (cons 4 '(1 2 3))) returns false!

2009-06-27 Thread Handkea fumosa
user=> (list? '(1 2 3)) true user=> (list? (cons 4 '(1 2 3))) false --~--~-~--~~~---~--~~ 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 n

Re: The API docs are gone!

2009-06-27 Thread Rich Hickey
On Sat, Jun 27, 2009 at 7:55 PM, Four of Seventeen wrote: > > On Jun 27, 6:32 pm, "J. McConnell" wrote: >> On Jun 27, 2009, at 12:28 PM, Four of Seventeen >> wrote: >> > Regardless, it's a security problem that someone other than Rich was >> > able to bring clojure.org down for tens of minutes l

Re: ClassCastException - maybe a bug

2009-06-27 Thread Handkea fumosa
On Jun 27, 11:32 am, Meikel Brandmeyer wrote: > Am 26.06.2009 um 23:44 schrieb Michael Spiegel: > > =>(def foo (sorted-set "bob" "alice" "michael")) > > => (contains? foo 5) > > java.lang.ClassCastException: java.lang.String cannot be cast to   > > java.lang.Number (NO_SOURCE_FILE:0) > > IIRC, th

Re: Trying to use lazy-seq for the first time, failing.

2009-06-27 Thread Wrexsoul
On Jun 26, 8:23 pm, _hrrld wrote: > Hi, > > I'm trying to use lazy-seq to implement a cool piece of functionality > I saw in the Factor programming language. Here is the documentation > for that > functionality:http://docs.factorcode.org/content/word-produce,sequences.html > > I think a lazy ver

Re: The API docs are gone!

2009-06-27 Thread hank williams
If Rich wants to keep his stuff there because it meets his needs and he is fully aware of what they do and how they do it then all of this is irrelevant. In any case "security risk" is really a overblown term for even the worst case scenario of what could happen to documentation pages. If you are

Re: The API docs are gone!

2009-06-27 Thread Four of Seventeen
On Jun 27, 6:32 pm, "J. McConnell" wrote: > On Jun 27, 2009, at 12:28 PM, Four of Seventeen   > wrote: > > Regardless, it's a security problem that someone other than Rich was > > able to bring clojure.org down for tens of minutes last night at the > > push of a button. > > No, it's not, whatsoe

Re: java.ext.dirs problem

2009-06-27 Thread Laurent PETIT
Hi, 2009/6/28 Chouser : > > On Sat, Jun 27, 2009 at 2:34 AM, Laurent PETIT wrote: >> >> While I'm far from a java classpath-related issues problem, I think I >> know enough to say that placing your libs in the java.ext.dirs >> classpath is a trick that could lead to problems. > > I've been using

Re: The API docs are gone!

2009-06-27 Thread J. McConnell
On Jun 27, 2009, at 12:28 PM, Four of Seventeen wrote: > > On Jun 27, 1:53 am, CuppoJava wrote: >> It was a server maintenance for wikispaces.org which is the hosting >> site for the Clojure website. > > But the Clojure website is clojure.org. NOT clojure.wikispaces.org or > something. DNS i

Re: java.ext.dirs problem

2009-06-27 Thread Chouser
On Sat, Jun 27, 2009 at 2:34 AM, Laurent PETIT wrote: > > While I'm far from a java classpath-related issues problem, I think I > know enough to say that placing your libs in the java.ext.dirs > classpath is a trick that could lead to problems. I've been using it mainly because Rich has recommend

Re: Trying to use lazy-seq for the first time, failing.

2009-06-27 Thread _hrrld
On Jun 27, 9:48 am, Meikel Brandmeyer wrote: > Hi, > > Am 27.06.2009 um 02:23 schrieb _hrrld: > > > Am I doing something silly? Or perhaps I've misunderstood lazy-seq's > > operation. > > I think, it's the latter. Here my try on an explanation: > (snip...) I found your explanation cogent and hel

Re: Trying to use lazy-seq for the first time, failing.

2009-06-27 Thread Jarkko Oranen
On Jun 27, 3:23 am, _hrrld wrote: > Hi, > > I'm trying to use lazy-seq to implement a cool piece of functionality > I saw in the Factor programming language. Here is the documentation > for that > functionality:http://docs.factorcode.org/content/word-produce,sequences.html > > I think a lazy ve

Re: Trying to use lazy-seq for the first time, failing.

2009-06-27 Thread arasoft
I think you just forgot to return the value itself. This seems to work: (defn produce [value predicate generator] (when (predicate value) (let [result (generator value)] (cons result (lazy-seq (produce result predicate generator) ) And I would use "quot" instead of "u

Re: Bug: ClassNotFoundException with macro using private helper function.

2009-06-27 Thread Four of Seventeen
On Jun 27, 5:53 am, Meikel Brandmeyer wrote: > Hi, > > Am 26.06.2009 um 20:41 schrieb Four of Seventeen: > > > (defn- foo [args] body) > > > (defmacro bar [args] body) > >  `(foo ~some-args (fn [~more-args] ~...@body))) > > > and it complained that foo was not public when I invoked bar from > > o

Re: ClassCastException - maybe a bug

2009-06-27 Thread Meikel Brandmeyer
Hi, Am 26.06.2009 um 23:44 schrieb Michael Spiegel: Running the following test code generates an exception: =>(def foo (sorted-set "bob" "alice" "michael")) => (contains? foo 5) java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Number (NO_SOURCE_FILE:0) I've tracke

Re: The API docs are gone!

2009-06-27 Thread Four of Seventeen
On Jun 27, 1:53 am, CuppoJava wrote: > It was a server maintenance for wikispaces.org which is the hosting > site for the Clojure website. But the Clojure website is clojure.org. NOT clojure.wikispaces.org or something. It's clearly standing alone, or at least it's supposed to be. Server mainten

Re: Trying to use lazy-seq for the first time, failing.

2009-06-27 Thread Jarkko Oranen
On Jun 27, 3:23 am, _hrrld wrote: > Hi, > > I'm trying to use lazy-seq to implement a cool piece of functionality > I saw in the Factor programming language. Here is the documentation > for that > functionality:http://docs.factorcode.org/content/word-produce,sequences.html > > I think a lazy ver

Re: Trying to use lazy-seq for the first time, failing.

2009-06-27 Thread Meikel Brandmeyer
Hi, Am 27.06.2009 um 02:23 schrieb _hrrld: Am I doing something silly? Or perhaps I've misunderstood lazy-seq's operation. I think, it's the latter. Here my try on an explanation: lazy-seq returns a value, which implements ISeq, ie. the seq interface. The code inside the lazy-seq is used to

Trying to use lazy-seq for the first time, failing.

2009-06-27 Thread _hrrld
Hi, I'm trying to use lazy-seq to implement a cool piece of functionality I saw in the Factor programming language. Here is the documentation for that functionality: http://docs.factorcode.org/content/word-produce,sequences.html I think a lazy version of Factor's "produce" word would be super- p

ClassCastException - maybe a bug

2009-06-27 Thread Michael Spiegel
Hi, Running the following test code generates an exception: =>(def foo (sorted-set "bob" "alice" "michael")) => (contains? foo 5) java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Number (NO_SOURCE_FILE:0) I've tracked down the source of the exception to the method clojur

Re: The API docs are gone!

2009-06-27 Thread Justin
This if off-topic but I'm wondering- is there any reason (doc ...) returns a URL instead of documentation for special forms? On Jun 27, 12:29 am, ataggart wrote: > On Jun 26, 9:12 pm, Four of Seventeen wrote: > > > Not that it really matters why it is/was down. The API docs going down > > for

Re: java.ext.dirs problem

2009-06-27 Thread mccraigmccraig
to help with the temptation i wrote a little ruby script which configures java classpaths and invokes clojure [only tried on macos... probably fine on linux, and should be portable to windows] http://github.com/mccraigmccraig/clojure-load.rb if you put all your clojure project repos, includi

Re: Small question: inserting something at the beginning of a vector

2009-06-27 Thread Meikel Brandmeyer
Hi again, Am 27.06.2009 um 11:59 schrieb Meikel Brandmeyer: There is now constructor, like [] or {}. Just use c.l.PersistentQueue/EMPTY. I meant: there is _no_ constructor Sincerely Meikel smime.p7s Description: S/MIME cryptographic signature

Re: Small question: inserting something at the beginning of a vector

2009-06-27 Thread Meikel Brandmeyer
Hi, Am 27.06.2009 um 02:27 schrieb samppi: Mr. Brandmeyer You can call me Meikel, I guess. ;) What might also be interesting if you want to insert at one end and take out at the other is clojure.lang.PersistentQueue. conj will insert at the front and pop/peek will work at the end. There is

Re: Bug: ClassNotFoundException with macro using private helper function.

2009-06-27 Thread Meikel Brandmeyer
Hi, Am 26.06.2009 um 20:41 schrieb Four of Seventeen: (defn- foo [args] body) (defmacro bar [args] body) `(foo ~some-args (fn [~more-args] ~...@body))) and it complained that foo was not public when I invoked bar from outside its home namespace. Yes. foo must be public in macros used by ot

Re: Enlive questions

2009-06-27 Thread Christophe Grand
Hi Cody! On Sat, Jun 27, 2009 at 8:47 AM, cody wrote: > > Maybe unrelated, but > > =>(html-resource (java.io.StringReader. " >th")) > > ({:type :comment, :data " o noes a comment "}) > > Not the result I would expect. Indeed. Fixed. user=> (html-resource (java.io.StringReader. "th")) ({:type

Re: General Lisp Comment: side effects with Lisp oriented languages

2009-06-27 Thread Daniel Lyons
BerlinBrown, I apologize in advance; I must be chairman of Haskell hate or something. On Jun 26, 2009, at 3:51 PM, BerlinBrown wrote: > One small issue I see with Lisp languages over something like Haskell > where side effects are greatly minimized. I tend to write code in > this style: This