probable bug in transients ..

2011-01-06 Thread Sunil S Nandihalli
Hello everybody, the following code is not producing what was expected of it in clojure 1.2 .. has this been fixed the clojure 1.3? (let [x (transient {})] (dotimes [i 10] (assoc! x i (* i i))) (persistent! x))

Re: probable bug in transients ..

2011-01-06 Thread Baishampayan Ghose
> Hello everybody, >  the following code is not producing what was expected of it in clojure 1.2 > .. has this been fixed the clojure 1.3? > (let [x (transient {})] > > >                         (dotimes [i 10] > > >                                  (assoc! x i (* i i))) > > >                     

Re: probable bug in transients ..

2011-01-06 Thread Sunil S Nandihalli
Yea you are right it does not work for anything greater than 8 .. It took me a while to figure out that the bug was infact the transients.. but did you try it in clojure 1.3 alpha versions? Sunil. On Thu, Jan 6, 2011 at 3:35 PM, Baishampayan Ghose wrote: > > Hello everybody, > > the following co

Re: ANN: ClojureQL 1.0.0 now released

2011-01-06 Thread LauJensen
Hi Sean, Yes the two statements are equivalent. ClojureQL compiles everything to prepared statements, with every argument automatically paramterized. You shouldn't have to call the compiler function directly, ever. For quick inspection, simply type the statement in the repl and it will emit the SQ

Re: probable bug in transients ..

2011-01-06 Thread Joost
That is not a bug. You should NEVER use transient and its related functions to emulate variables - you're supposed to use assoc! and friends as if they're pure functions. That is, always use the return value of assoc! and don't rely on its argument being modified. something like: (loop [x (transi

Re: probable bug in transients ..

2011-01-06 Thread Alex Osborne
Sunil S Nandihalli writes: > Hello everybody, > the following code is not producing what was expected of it in clojure > 1.2 .. has this been fixed the clojure 1.3? > > (let [x (transient {})] > (dotimes [i 10] > (assoc! x i (* i i))) > (persistent! x)) This is not a bug, it's a misuse o

Re: probable bug in transients ..

2011-01-06 Thread Joost
Joost wrote: > you're supposed to use assoc! and > friends as if they're pure functions. Just correcting myself for clarity: assoc! etc MAY modify their transient arguments, but not always, and not always in the way you might think. The correct result of these operations is their return value, bu

Re: probable bug in transients ..

2011-01-06 Thread Sunil S Nandihalli
thanks for the clarification .. I did know about the fact that I have to capture the return value .. but some how slipped my mind and assumed it was a bug .. I guess that will never happen again after burning my fingers this time Sunil. On Thu, Jan 6, 2011 at 4:30 PM, Joost wrote: > Joost

Re: probable bug in transients ..

2011-01-06 Thread Baishampayan Ghose
> thanks for the clarification .. I did know about the fact that I have to > capture the return value .. but some how slipped my mind and assumed it was > a bug .. I guess that will never happen again after burning my fingers this > time Haha! Same here. I have used transients many times too,

Re: feedback on first compojure app: Sportello

2011-01-06 Thread James Reeves
I note that the stringtemplate-clj library defaults to using directory paths only, but StringTemplate itself can pull templates from the classpath as well. If you placed your templates in "resources/templates" and used StringTemplate directly, you wouldn't have to worry about where the template dir

Re: Clojure Quizzes?

2011-01-06 Thread benjamin.s.r
http://coderloop.com/ like Project Euler but more modern -- 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

Re: ANN: Gloss, a byte-format DSL

2011-01-06 Thread Geoff
Hey Eric I did something similar for handling unsigned types. I think it's simpler and probably faster, not that I've checked. Here's a gist of it https://gist.github.com/767887 That code is part of a little library I wrote a while ago https://github.com/geoffsalmon/bytebuffer It's closer to your

Re: ANN: ClojureQL 1.0.0 now released

2011-01-06 Thread faenvie
On Jan 5, 3:14 pm, LauJensen wrote: > ... Works out of the box with PostgreSQL and MySQL ... nice work ! your testcode references sqlite3 too. so what about sqlite3-support ? -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group,

Re: ANN: ClojureQL 1.0.0 now released

2011-01-06 Thread LauJensen
Thanks! sqlite has certain oddities. For instance when you do a union the first query must not be in parens. In order to support this various quirks, somebody would have to copy/paste the sql92compiler and adjust it slightly for sqlite. I haven't done it yet, but if somebody does I'd be happy to i

Re: probable bug in transients ..

2011-01-06 Thread Andrew Boekhoff
http://clojure.org/transients mentions that transients are not designed to be bashed in place like mutable datastructures. The following produces the correct result. (loop [x (transient {}) i 0] (if (< i 10) (recur (assoc! x i (* i i)) (inc i)) (persistent! x))) -- You receive

Re: vsClojure Release

2011-01-06 Thread eyeris
Thank you for working on this! I wanted to create an extension with just syntax highlighting and AOT compilation but I gave up while reading through the VS extension API. Your patience must be never- ending to use that API :) I will download and test this later today. On Dec 30 2010, 10:30 pm, j

Re: Knuth's literate programming "tangle" function in Clojure

2011-01-06 Thread Eric Schulte
Tim Daly writes: > On 1/6/2011 12:03 AM, Eric Schulte wrote: >>> Can you post examples of these? I'd love to see some other examples. >> Sure thing, check out this old version of a file which tangles out into >> the directory layout expected by lein. >> http://gitweb.adaptive.cs.unm.edu/?p=asm.gi

Re: ANN: Gloss, a byte-format DSL

2011-01-06 Thread Eric Schulte
Hey Geoff, This sort of feedback and code recommendations is exactly what I was hoping for. Geoff writes: > Hey Eric > I did something similar for handling unsigned types. I think it's > simpler and probably faster, not that I've checked. Here's a gist of > it https://gist.github.com/767887 >

Re: problem with stream

2011-01-06 Thread Aaron Cohen
On Wed, Jan 5, 2011 at 5:13 PM, Ken Wesson wrote: > On Wed, Jan 5, 2011 at 4:40 PM, rainerh wrote: >> Hello everybody, >> >> I'm trying to use clojure to parse web sites. Unfortunately there is >> some problem with following code (used library is Apache Commons HTTP >> Client): >> >> (defn reques

Re: #clojure in 2010

2011-01-06 Thread Miki
If someone is interested in some other statistics, please let me know and I'll try to make it happen. > > >> > The most talkative person per session would be interesting :) though > perhaps session time is a PITA to establish particularly across days > boundaries. > Define "session" (a day? a su

Re: Knuth's literate programming "tangle" function in Clojure

2011-01-06 Thread Michael Wood
Hi On 6 January 2011 07:33, Tim Daly wrote: [...] > Take a look at http://daly.axiom-developer.org/clojure.pdf I like it :) Some simple corrections: You have a typo on the front page: "Based on Version 1.3.0-alphs4" (alphs4 instead of alpha4). In the foreword, "This is a literate fork of Clo

Re: clojure.java.shell hanging issues

2011-01-06 Thread Miki
> Looking at the source code I'm not sure if the patches were applied. > Maybe there was a "regression". The symptoms seem consistent with what > was supposed to have been fixed. > > Following the clojure.org api docs, I clicked through on the source code > link on > > http://richhickey.github.c

Re: probable bug in transients ..

2011-01-06 Thread Raoul Duke
On Thu, Jan 6, 2011 at 3:32 AM, Baishampayan Ghose wrote: > Haha! Same here. I have used transients many times too, but I fell > into the trap this time :) now if only there were some kind of programming language technology that could help us figure out when we're mis-applying operations to thing

Boston Clojure Meetup Thursday Jan 13

2011-01-06 Thread Straszheim, Jeff
1st Boston Clojure Meetup Date: Thursday, January 13th, 2011 Location: Akamai Technologies 8 Cambridge Center Conference Room 200D Cambridge, MA 02142 (Corner of Broadway and Galileo Galilei) Akamai Technologies will be hosting the first Boston Clojure Meetup on Thursday, January 13th. Th

Re: #clojure in 2010

2011-01-06 Thread Michael Ossareh
On Thu, Jan 6, 2011 at 08:50, Miki wrote: > If someone is interested in some other statistics, please let me know and > I'll try to make it happen. >> >> >>> >> The most talkative person per session would be interesting :) though >> perhaps session time is a PITA to establish particularly across

Re: probable bug in transients ..

2011-01-06 Thread Ken Wesson
On Thu, Jan 6, 2011 at 1:08 PM, Raoul Duke wrote: > On Thu, Jan 6, 2011 at 3:32 AM, Baishampayan Ghose wrote: >> Haha! Same here. I have used transients many times too, but I fell >> into the trap this time :) > > now if only there were some kind of programming language technology > that could he

Re: Boston meetup Jan 11?

2011-01-06 Thread rob levy
I'm also going to Boston Coding Dojo tonight. The Clojure Meetup is going to be at Akamai, a week from tonight's dojo, which I'm looking forward to: http://groups.google.com/group/clojure/browse_thread/thread/821248c3dd0b69b8 On Thu, Dec 30, 2010 at 9:34 PM, Alyssa Kwan wrote: > Hi! > > You woul

Re: Knuth's literate programming "tangle" function in Clojure

2011-01-06 Thread Tim Daly
On 1/6/2011 11:16 AM, Eric Schulte wrote: Tim Daly writes: On 1/6/2011 12:03 AM, Eric Schulte wrote: Can you post examples of these? I'd love to see some other examples. Sure thing, check out this old version of a file which tangles out into the directory layout expected by lein. http://gi

What am I not getting here?

2011-01-06 Thread new2clojure
Hi, I am trying to store into a map the frequency of each [a-z]+ word in a file. When I run this code in the repl the resulting dictionary is empty. How should I adapt my code to get this functionality right?. Thank you in advance (import (java.io BufferedReader FileReader)) (def dictionary {}

The human brain works the Lisp way!

2011-01-06 Thread Arie van Wingerden
Hi, on this page http://singularityhub.com/2010/12/21/ray-kurzweil-the-mind-and-how-to-build-one-video/ you can find a video in which Ray Kurzweil speaks about the "reverse engineering" of the human brain. At 39:25 Ray states that "... the cerebral cortex is a Lisp processor." and explains that l

Re: problem with stream

2011-01-06 Thread Hubert Iwaniuk
Shameless plug: or use http.async.client http://neotyk.github.com/http.async.client/docs.html#sec-1_2_4_1 (let [resp (c/stream-seq :get url)] (doseq [s (string resp)] (println s))) Cheers, Hubert. On Thu, Jan 6, 2011 at 5:34 PM, Aaron Cohen wrote: > On Wed, Jan 5, 2011 at 5:13 PM, Ken We

Re: probable bug in transients ..

2011-01-06 Thread Chas Emerick
On Jan 6, 2011, at 1:48 PM, Ken Wesson wrote: > On Thu, Jan 6, 2011 at 1:08 PM, Raoul Duke wrote: >> On Thu, Jan 6, 2011 at 3:32 AM, Baishampayan Ghose wrote: >>> Haha! Same here. I have used transients many times too, but I fell >>> into the trap this time :) >> >> now if only there were some

Re: What am I not getting here?

2011-01-06 Thread Jason Wolfe
You're not capturing the output of the reduce anywhere; doseq is for side-effects only. If you wrapped the doseq in a "(def dictionary ...)" it would work, but this is not recommended. Instead, you should either use nested reductions, or produce a simple list of tokens first (simpler): (defn proc

Re: What am I not getting here?

2011-01-06 Thread Benny Tsai
I was typing up an answer, but Jason answered faster and better :) The only thing I have to add is that 'frequencies' is also in clojure core as of 1.2. On Jan 6, 1:13 pm, Jason Wolfe wrote: > You're not capturing the output of the reduce anywhere; doseq is for > side-effects only. > > If you wr

Re: Knuth's literate programming "tangle" function in Clojure

2011-01-06 Thread Tim Daly
On 1/6/2011 12:07 PM, Michael Wood wrote: Hi On 6 January 2011 07:33, Tim Daly wrote: [...] Take a look at http://daly.axiom-developer.org/clojure.pdf I like it :) Some simple corrections: You have a typo on the front page: "Based on Version 1.3.0-alphs4" (alphs4 instead of alpha4). In

Re: What am I not getting here?

2011-01-06 Thread Ken Wesson
On Thu, Jan 6, 2011 at 1:49 PM, new2clojure wrote: > > Hi, > > I am trying to store into a map the frequency of each [a-z]+ word in a > file. When I run this code in the repl the resulting dictionary is > empty. How should I adapt my code to get this functionality right?. > > Thank you in advance

Re: What am I not getting here?

2011-01-06 Thread Sean Corfield
On Thu, Jan 6, 2011 at 10:49 AM, new2clojure wrote: > I am trying to store into a map the frequency of each [a-z]+ word in a > file. When I run this code in the repl the resulting dictionary is > empty. How should I adapt my code to get this functionality right?. Other people have offered up alte

Errors w/ dynamic symbols in macro-utils or monads?

2011-01-06 Thread Chris Riddoch
Hi, everyone. With the changes to dynamic symbols in 1.3.0-snapshot, a number of modules of contrib/ seem unable to function. I'm trying to see if I can get fnparse to run under the master branch, and it wants contrib/monads, which in turn wants contrib/macro-utils. The following error happens a

Re: ANN: ClojureQL 1.0.0 now released

2011-01-06 Thread Sean Corfield
On Thu, Jan 6, 2011 at 2:33 AM, LauJensen wrote: > Yes the two statements are equivalent. ClojureQL compiles everything > to prepared > statements, with every argument automatically paramterized. Cool, that's what I'd hoped. But just to clarify... If I have code that repeatedly calls this: @(->

Re: The human brain works the Lisp way!

2011-01-06 Thread Michael Aldred
G'day Arie, You have to be very careful about listening to things Ray Kurzweil says when he's talking about the brain, etc. I would think it would be better to listen to someone actually conducting brain/AI research, for example, Jeff Hawkins. His company Numenta seems to be making great progres

Re: Loading JNI

2011-01-06 Thread ax2groin
Sorry for the late response, but I haven't had time to play with things in a couple days. First discovery is that I probably cannot use the library path variable, because some of the DLLs have to be loaded in a specific order. Specifically, there is a "clientswig.dll" that has to be loaded last. G

Re: ANN: Tom Faulhaber: "Lisp, Functional Programming, and the State of Flow" video available

2011-01-06 Thread Alan Dipert
Hi Chris, we were happy to provide them. I'll see what we can do synchronization-wise with the remaining videos. Improving our technique around recording, editing, and releasing videos is on the list of things we hope to do for the next Conj. Alan On Wed, Jan 5, 2011 at 1:48 PM, Chris Riddoch

Re: The human brain works the Lisp way!

2011-01-06 Thread Lee Spector
I just watched about 10 minutes leading up to the comment Arie flagged and it seems to me that Kurzweil is actually describing something very much like Hawkins's HTM model *at* a certain level of abstraction. He makes some other interesting comments about Lisp that might strike some here as biz

Re: ANN: ClojureQL 1.0.0 now released

2011-01-06 Thread Ken Wesson
On Thu, Jan 6, 2011 at 7:33 PM, Sean Corfield wrote: > On Thu, Jan 6, 2011 at 2:33 AM, LauJensen wrote: >> Yes the two statements are equivalent. ClojureQL compiles everything >> to prepared >> statements, with every argument automatically paramterized. > > Cool, that's what I'd hoped. But just t

Re: Knuth's literate programming "tangle" function in Clojure

2011-01-06 Thread Ken Wesson
I've now had a quick look at this too. Aside from the grammatical and spelling nitty-gritty, there are some larger scale concerns, ones that unfortunately go to the heart of the entire "literate programming" concept. Namely, at the start it jumps very quickly into a red-black tree implementation

Re: map destructuring with defaults

2011-01-06 Thread Seth
Ah. But a new map is being created with the default :or operation. I guess the ability to get this entire map with defaults is not available directly from clojure destructuring binding. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this g

Re: Knuth's literate programming "tangle" function in Clojure

2011-01-06 Thread Tim Daly
On 1/6/2011 9:15 PM, Ken Wesson wrote: I've now had a quick look at this too. Aside from the grammatical and spelling nitty-gritty, there are some larger scale concerns, ones that unfortunately go to the heart of the entire "literate programming" concept. Namely, at the start it jumps very qu

Re: Knuth's literate programming "tangle" function in Clojure

2011-01-06 Thread Ken Wesson
On Thu, Jan 6, 2011 at 11:05 PM, Tim Daly wrote: > On 1/6/2011 9:15 PM, Ken Wesson wrote: >> And then of course the overarching purpose of Clojure itself isn't >> even given, let alone why it has sorted-map, and why it's an immutable >> sorted-map ... > > There is very little that needs to be said

Re: Knuth's literate programming "tangle" function in Clojure

2011-01-06 Thread Tim Daly
On 1/6/2011 11:42 PM, Ken Wesson wrote: On Thu, Jan 6, 2011 at 11:05 PM, Tim Daly wrote: On 1/6/2011 9:15 PM, Ken Wesson wrote: And then of course the overarching purpose of Clojure itself isn't even given, let alone why it has sorted-map, and why it's an immutable sorted-map ... There is v

Re: The human brain works the Lisp way!

2011-01-06 Thread Tim Daly
Rich has suggested the book "Spikes" ISBN 0-262-68108-0 which is about exploring the neural code. This was mentioned in his Whitehead video. On 1/6/2011 7:40 PM, Michael Aldred wrote: G'day Arie, You have to be very careful about listening to things Ray Kurzweil says when he's talking about th

Re: ANN: ClojureQL 1.0.0 now released

2011-01-06 Thread Shantanu Kumar
On Jan 7, 6:49 am, Ken Wesson wrote: > On Thu, Jan 6, 2011 at 7:33 PM, Sean Corfield wrote: > > On Thu, Jan 6, 2011 at 2:33 AM, LauJensen wrote: > >> Yes the two statements are equivalent. ClojureQL compiles everything > >> to prepared > >> statements, with every argument automatically paramte

Re: Knuth's literate programming "tangle" function in Clojure

2011-01-06 Thread Ken Wesson
On Fri, Jan 7, 2011 at 12:07 AM, Tim Daly wrote: > Hmmm. I may have misunderstood your point. I thought you were suggesting > writing code that is not part of the distribution in order to get a > minimal running system and then working from that. If that is not what > you're suggesting then I'm co

Re: ANN: ClojureQL 1.0.0 now released

2011-01-06 Thread Ken Wesson
On Fri, Jan 7, 2011 at 12:22 AM, Shantanu Kumar wrote: > On Jan 7, 6:49 am, Ken Wesson wrote: >> I'd hope it has some kind of caching or memoization behind the scenes, >> but if not, that'd be a great thing to add for version 1.1. I think a >> typical database client app uses a finite variety of

Re: map destructuring with defaults

2011-01-06 Thread Alan
No, no new map is created. The :or clause simply creates the local binding for you if none existed in the map; there's no need for it to create a second map to do this. On Jan 6, 6:27 pm, Seth wrote: > Ah. But a new map is being created with the default :or operation. I > guess the ability to get

Re: ANN: ClojureQL 1.0.0 now released

2011-01-06 Thread Shantanu Kumar
On Jan 7, 10:32 am, Ken Wesson wrote: > On Fri, Jan 7, 2011 at 12:22 AM, Shantanu Kumar > > wrote: > > On Jan 7, 6:49 am, Ken Wesson wrote: > >> I'd hope it has some kind of caching or memoization behind the scenes, > >> but if not, that'd be a great thing to add for version 1.1. I think a > >

possible bug in `case'

2011-01-06 Thread Eric Schulte
Hi, The following case statement #+begin_src clojure (defn buggy-case [n] (case (int n) 0 :null 1 :load 0x7000 :loproc)) #+end_src throws the following error No distinct mapping found [Thrown class java.lang.IllegalAr

Re: possible bug in `case'

2011-01-06 Thread Alan
It looks like a problem in clojure.core/min-hash to me. case depends on min-hash to generate ahead-of-time hashes of all the test clauses, and while I can't easily follow what's going on, it seems to be trying to find a shift/mask combination that is...somehow related to the hashes of the test clau