Re: apply a function to every item in a sequence without realizing the sequence

2012-05-01 Thread László Török
Map IS lazy but it still returns the entire realized sequence, as expected. On May 2, 2012 8:31 AM, "Sean Neilan" wrote: > I don't think so. > > On Wed, May 2, 2012 at 1:22 AM, Stuart Campbell wrote: > >> On 2 May 2012 14:44, Baishampayan Ghose wrote: >> >>> You can't use `map` because `map` wi

Re: apply a function to every item in a sequence without realizing the sequence

2012-05-01 Thread Sean Neilan
I don't think so. On Wed, May 2, 2012 at 1:22 AM, Stuart Campbell wrote: > On 2 May 2012 14:44, Baishampayan Ghose wrote: > >> You can't use `map` because `map` will return a sequence of the same >> size and that can blow your heap. >> > > Isn't `map` lazy too? > > Regards, > Stuart > > -- > Yo

Re: apply a function to every item in a sequence without realizing the sequence

2012-05-01 Thread Stuart Campbell
On 2 May 2012 14:44, Baishampayan Ghose wrote: > You can't use `map` because `map` will return a sequence of the same > size and that can blow your heap. > Isn't `map` lazy too? Regards, Stuart -- You received this message because you are subscribed to the Google Groups "Clojure" group. To po

Re: apply a function to every item in a sequence without realizing the sequence

2012-05-01 Thread Sean Neilan
Wow!! Lots of responses! The problem was that I was running the code inside of a jark repl. The jark repl apparently causes head holding of some sort. All the examples you guys provided (@Allen, @Jonas, @Baishampayan) work in a regular project from lein run. They also work from the leiningen rep

Re: apply a function to every item in a sequence without realizing the sequence

2012-05-01 Thread Baishampayan Ghose
> The problems > > I can't use map as in (map println (file-seq (java.io.File. > "/DirectoryWithMillionsOfFiles"))). Map realizes the sequence. You can't use `map` because `map` will return a sequence of the same size and that can blow your heap. > I can't use for as in (for [x (files)] (println

Re: apply a function to every item in a sequence without realizing the sequence

2012-05-01 Thread László Török
Wow lot of active people in the early morning, all typing faster than me on my phone... :-) On May 2, 2012 6:36 AM, "László Török" wrote: > You can also use doseq afaik, altough every element must realized at least > once, you just have to make sure you don't hold onto the head of the > sequence

Re: apply a function to every item in a sequence without realizing the sequence

2012-05-01 Thread László Török
You can also use doseq afaik, altough every element must realized at least once, you just have to make sure you don't hold onto the head of the sequence as you proceed. It is not immediately apparent to me why that doesn't happen with your loop-recur solution On May 2, 2012 6:27 AM, "Sean Neilan"

Re: apply a function to every item in a sequence without realizing the sequence

2012-05-01 Thread Allen Johnson
Do you have example code that is failing? You should be able to use some of the items you listed as "problems". Try something like this: (->> (file-seq (io/file "/some/dir")) (map println) (dorun)) AJ On Wed, May 2, 2012 at 12:26 AM, Sean Neilan wrote: > I forgot to mention: > (nth

Re: apply a function to every item in a sequence without realizing the sequence

2012-05-01 Thread Baishampayan Ghose
Sean, > I'm sure this has been discussed to death but I can't figure it out. > > I've got a file-seq sequence from > (file-seq (java.io.File. "/DirectoryWithMillionsOfFiles/")) that will cause > an out of memory error if realized. > > I want to call a function such as println on every element in t

Re: apply a function to every item in a sequence without realizing the sequence

2012-05-01 Thread Jonas
On Wednesday, May 2, 2012 7:24:04 AM UTC+3, Sean Neilan wrote: > > Hi, > > I'm sure this has been discussed to death but I can't figure it out. > > I've got a file-seq sequence from > (file-seq (java.io.File. "/DirectoryWithMillionsOfFiles/")) that will > cause an out of memory error if realize

Re: apply a function to every item in a sequence without realizing the sequence

2012-05-01 Thread Sean Neilan
I forgot to mention: (nth (file-seq (java.io.File. "/DirectoryWithMillionsOfFiles/")) 20) works great because nth doesn't realize the sequence! For now, I'll look at nth's source code to see how it iterates. On Tue, May 1, 2012 at 11:24 PM, Sean Neilan wrote: > Hi, > > I'm sure this has bee

apply a function to every item in a sequence without realizing the sequence

2012-05-01 Thread Sean Neilan
Hi, I'm sure this has been discussed to death but I can't figure it out. I've got a file-seq sequence from (file-seq (java.io.File. "/DirectoryWithMillionsOfFiles/")) that will cause an out of memory error if realized. I want to call a function such as println on every element in the sequence.

Re: Arithmethic Evaluation

2012-05-01 Thread Asranz
thanks a lot for all your help i really apreciate it. so i need some others functions to parse it and then just doing the infix i guess? On 1 mayo, 19:54, "Jim - FooBar();" wrote: > On 02/05/12 01:04, Asranz wrote: > > > Hello so i got this problem agian i have been trying to resolve it > > with

Re: Arithmethic Evaluation

2012-05-01 Thread Asranz
oh please if u can teach me! On 1 mayo, 21:29, Armando Blancas wrote: > > i just need to evaluate in infix a string "(1 +2 (4 * 5)" > > Check out The Little Schemer. It'll teach you the techniques for doing this. -- You received this message because you are subscribed to the Google Groups "Clo

Re: Arithmethic Evaluation

2012-05-01 Thread Armando Blancas
> > i just need to evaluate in infix a string "(1 +2 (4 * 5)" > > Check out The Little Schemer. It'll teach you the techniques for doing this. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups

Re: Arithmethic Evaluation

2012-05-01 Thread Jim - FooBar();
On 02/05/12 01:04, Asranz wrote: Hello so i got this problem agian i have been trying to resolve it with macros but i dont get the idea. i just need to evaluate in infix a string "(1 +2 (4 * 5)" but dont get it to do it with macros the part of changing the string type. Thanks, I can help yo

Arithmethic Evaluation

2012-05-01 Thread Asranz
Hello so i got this problem agian i have been trying to resolve it with macros but i dont get the idea. i just need to evaluate in infix a string "(1 +2 (4 * 5)" but dont get it to do it with macros the part of changing the string type. Thanks, -- You received this message because you are subs

eventual values in clojurescript

2012-05-01 Thread Irakli Gozalishvili
Hi Folks, I'm really excited about clojurescript and trying to get into it. To get some experience with it I have decide to implement promise library that become increasingly popular this days in JavaScript mainly due to single threaded, non-blocking nature. As clojurescript runs in the same s

Re: Pulling constants out of interfaces

2012-05-01 Thread Chris Perkins
On Monday, April 30, 2012 12:19:00 PM UTC-4, Philip Potter wrote: > > Note that, even though this works, $ is not a valid character in a > clojure symbol. > > See > http://groups.google.com/group/clojure/browse_thread/thread/5af5d892f2e84212/0c5dc6b6a1578f07?#0c5dc6b6a1578f07 > > > and http://

Re: error in clojurescript dom.cljs?

2012-05-01 Thread David Nolen
Yes that should be PersistentVector. Fixed in master thanks! David On Tue, May 1, 2012 at 1:10 PM, Rob wrote: > Hi, > > I just tried running the sample in samples/dom. Got this error: > > No protocol method DOMBuilder.-element defined for type object: [:ul [:li > :li :li]] > > In src/cljs/cloj

error in clojurescript dom.cljs?

2012-05-01 Thread Rob
Hi, I just tried running the sample in samples/dom. Got this error: No protocol method DOMBuilder.-element defined for type object: [:ul [:li :li :li]] In src/cljs/clojure/browser/dom.cljs, it looks like it extends the protocol to 'Vector'... ~~ line: 65 ~~ Vector (-element [this]

Re: Leiningen-noobie question

2012-05-01 Thread Phil Hagelberg
On Mon, Apr 30, 2012 at 9:28 PM, Larry Travis wrote: > Phil, Neale, Sean: > You guys are all way ahead of me as to why I am getting the results I am > getting, but it is only Neale's advice that works.  That is > > [prjctOne/prjctOne "1.0.0-SNAPSHOT"]   works, but > > > [prjctOne "1.0.0-SNAPSHOT"]

Re: LinkedHashMap not well supported

2012-05-01 Thread Michał Marczyk
On 1 May 2012 07:22, Alan Malloy wrote: > On Apr 30, 7:53 pm, kurtharriger wrote: >> Sounds good. Ill submit a patch for walk. Im not real sure why apply >> hash-map didnt work, but if figure it out Ill add that too. > > For the same reason that (apply hash-map {1 2, 3 4}) doesn't work: the > ma

[ANN] clj-tagsoup 0.3.0

2012-05-01 Thread Daniel Janus
Dear Clojurians, I have released version 0.3.0 of clj-tagsoup [1], the HTML parser for Clojure. clj-tagsoup is a wrapper around TagSoup [2] and can parse arbitrary (potentially malformed) HTML (or XML) into Clojure data structures. New in this release is the ability to lazily parse XML using T

Re: Using dynamic variables in libraries [Re: ANN clojure.java.jdbc 0.2.0]

2012-05-01 Thread Wolodja Wentland
On Fri, Apr 27, 2012 at 22:21 -0700, Sean Corfield wrote: > On Fri, Apr 27, 2012 at 4:14 AM, Wolodja Wentland wrote: > > Could you elaborate on that please? I see that dynamic variables are used > > quite > > often to give the user the ability to configure/change the behaviour of a > > library. T

Re: Clojurescript long polling questions

2012-05-01 Thread Dusan Miloradovic
Unfortunaltely that does not work either, thank you for the help. It stops receiving after the first message, just like before. Here is the updated version: (defn long-poll-newest ([url callback error-callback] (long-poll-newest url callback error-callback (net/xhr-connection))) ([url cal

Re: Clojurescript long polling questions

2012-05-01 Thread Gijs S.
The order of arguments you pass to long-poll-newest doesn't look right. You defined long-poll-newest to optionally take a fourth parameter for the existing xhr connection. However, when calling long-poll-newest you pass the existing xhr connection as the first argument. Replace (long-poll-newest

Re: Pulling constants out of interfaces

2012-05-01 Thread Neale Swinnerton
> > I think the $ is like /. It's allowed, but has special meaning, that > is, you shouldn't have those characters in your own symbols. > > The documentation there needs to mention $ as special, that's all. > > This '$' convention is all baggage from how inner classes were shoe-horned into the java