Re: state monad transformer

2009-02-17 Thread Konrad Hinsen
On 16.02.2009, at 23:38, jim wrote: > Here's a shot at implementing a monad transformer for the state > monad. Any chance of getting it added to clojure.contrib.monads? If you are on the list of contributors (those who have signed a contributor agreement), yes, of course! Konrad. --~--~---

Re: How do I do this in clojure?

2009-02-17 Thread Laurent PETIT
Hello, I wanted to try it too, so I grabbed Timothy's version, and did some improvements (I hope they are, feedback welcome ! :-) over it. Something I corrected is the removal of null or blank items, as in the first python version. I also got rid of the assoc by using update-in. And I felt that t

Re: terminology question re: binding

2009-02-17 Thread Konrad Hinsen
On Feb 17, 2009, at 0:17, Stuart Sierra wrote: > As I understand it, every Var has a name, which is a symbol, but the > name is an inherent property of the Var and cannot be changed. You Unless you create a var using with-local-vars, right? Konrad. --~--~-~--~~~-

Re: Clojure on CLR/DLR

2009-02-17 Thread Lucio Fulci
I can see a minor problem with ClojureCLR, that is, "j" in clojure stands for JVM, right? So it's a bit messy. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to cloj

Re: Clojure on CLR/DLR

2009-02-17 Thread Laurent PETIT
"Clonure" (n for dot *n*et), as in : "Clonure, a dot net clone of Clojure" (ok, sorry ;-) 2009/2/17 Lucio Fulci > I can see a minor problem with ClojureCLR, that is, "j" in clojure stands > for JVM, right? So it's a bit messy. > > > > > --~--~-~--~~~---~--~~ You

Re: How do I do this in clojure?

2009-02-17 Thread Michael Wood
On Tue, Feb 17, 2009 at 11:05 AM, Laurent PETIT wrote: > Hello, > > I wanted to try it too, so I grabbed Timothy's version, and did some > improvements (I hope they are, feedback welcome ! :-) over it. > > Something I corrected is the removal of null or blank items, as in the first > python versi

Re: How do I do this in clojure?

2009-02-17 Thread Laurent PETIT
Thanks Michael 2009/2/17 Michael Wood > > On Tue, Feb 17, 2009 at 11:05 AM, Laurent PETIT > wrote: > > Hello, > > > > I wanted to try it too, so I grabbed Timothy's version, and did some > > improvements (I hope they are, feedback welcome ! :-) over it. > > > > Something I corrected is the remo

Re: Fully lazy sequences are coming - feedback wanted!

2009-02-17 Thread Konrad Hinsen
On Feb 16, 2009, at 20:23, Rich Hickey wrote: > It seems the Sequence/ISeq dichotomy was a sticking point for many. > After some tweaking, I've been able to get rid of Sequence entirely, > SVN 1284+ in lazy branch. This is source compatible with 1282 (first/ > rest/next), except that sequence? no

Re: Clojure on CLR/DLR

2009-02-17 Thread Rayne
Haha. I just noticed my typo in the previous post. Disregard that. :| On Feb 17, 3:22 am, Laurent PETIT wrote: > "Clonure" (n for dot *n*et), as in : "Clonure, a dot net clone of Clojure" > > (ok, sorry ;-) > > 2009/2/17 Lucio Fulci > > > I can see a minor problem with ClojureCLR, that is, "j"

Re: Clojure on CLR/DLR

2009-02-17 Thread AlamedaMike
Fantastic news, David. This should help the spread of Clojure. Although I like "Bonjure" as a name, and even though two syllable names are generally considered best by marketers, I think ClojureCLR is best for branding purposes. It helps spread the Clojure meme and it linguistically supports the

Re: Is this a bug ?!?

2009-02-17 Thread Christophe Grand
redhotmonk a écrit : > When you look at resulting hash, which you get by calling > "(initialize-domain 4 4 0.3)", > you see that the 4-component value vector of every key is "not so" > random. In fact it is the same vector every time. > But when I modify the "initialize-domain" function by deleti

Re: terminology question re: binding

2009-02-17 Thread David Sletten
On Feb 16, 2009, at 10:34 AM, Stuart Halloway wrote: > > David Sletten sent me this erratum: > > << > At the beginning of section 2.4 we have "The symbol user/foo refers to > a var which is bound to the value 10." Under the next subsection > "Bindings" we have "Vars are bound to names, but there

Re: Creating executable Jars?

2009-02-17 Thread Emeka
Kev, I didn't make it, however, I guess the issue was on namespace and not on the instruction given. I will try again and again until I get my head around namespace, or could you help me to jump start? Emeka --~--~-~--~~~---~--~~ You received this message because

Re: Clojure on CLR/DLR

2009-02-17 Thread Timothy Pratley
> "Clonure" (n for dot *n*et), as in : "Clonure, a dot net clone of Clojure" hahaha nice :) In the same vein: Clocure (c for clr) pronouced closer or cl oh cure (is that the cure for common lisp or CLR?) *chuckle* Ok ok I'm not being serious. --~--~-~--~~~---~--~~ Y

Re: Fully lazy sequences are coming - feedback wanted!

2009-02-17 Thread Rich Hickey
On Feb 17, 2009, at 4:40 AM, Konrad Hinsen wrote: > > On Feb 16, 2009, at 20:23, Rich Hickey wrote: > >> It seems the Sequence/ISeq dichotomy was a sticking point for many. >> After some tweaking, I've been able to get rid of Sequence entirely, >> SVN 1284+ in lazy branch. This is source compati

Re: How do I do this in clojure?

2009-02-17 Thread Timothy Pratley
Hi Laurent, Thanks for those improvements. I agree that it would be nice in this case to be able to 'update-in' an arbitrary tree. I played around using zippers to achieve this with some success, however it was very verbose. Next I tried implementing update-in-list which seemed a bit more obvious

Re: How do I do this in clojure?

2009-02-17 Thread Emeka
Jesse, Could I see your own version. Emeka > --~--~-~--~~~---~--~~ 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 To unsubscribe from this group, send email

Re: Embed A Struct Within A Struct

2009-02-17 Thread Onorio Catenacci
On Feb 16, 7:52 pm, samppi wrote: > You can nest structs in structs like this: > > (defstruct rect :height :width) > (defstruct colored-rect :color :shape) > > (def subject (struct colored-rect :red (struct rect 50 30))) > > (println subject) ; prints {:color :red, :shape {:height 50, :width > 30

Clojure Off-topic IRC channel

2009-02-17 Thread Rayne
A week or 2 ago, Lau_Of_DK asked me very nicely to stop talking so off- topic in #Clojure. I mentioned that we should have an Off-topic channel for people who would just like to talk, because just about every other language's channel on freenode has an off topic channel (#haskell-blah for instance

Re: How do I do this in clojure?

2009-02-17 Thread Jesse Aldridge
> Jesse, > Could I see your own version. Haha, I was afraid someone would say this. Here is my embarrassingly bad (but working) version: (defn build-table [] (def num-cols 3) (def selected-row 0) (def selected-col 0) (def all-strings ["apple" "cat" "dog" "" "frog" "elephant" "gorilla"])

Re: Clojure on CLR/DLR

2009-02-17 Thread Stefan Rusek
I've been working on Xronos which is also a c# version of clojure (I need to be careful to not use the work port, since it doesn't share any code with clojure). It compiles to the DLR as well. It is located here: http://www.bitbucket.org/stefanrusek/xronos/wiki/Home One big difference is that Xr

Re: Clojure on CLR/DLR

2009-02-17 Thread mikel
On Feb 16, 11:35 pm, dmiller wrote: > Porting Clojure to the CLR is hardly an original idea.  Rich started > with dual JVM/CLR implementations.  And inquiries have been made on > this group any number of times. Yah, I posted one of those queries. My interest is future-proofing Clojure, because

Libraries? model and generic-functions

2009-02-17 Thread mikel
Two of the subsystems in my app project might usefully be packaged and distributed as libraries, if people want them. I thought I'd describe them, so as to discover whether I should be planning for that. Why not post this to Rich's "Got a Clojure Library?" thread? Because that thread is presently

Re: Clojure on CLR/DLR

2009-02-17 Thread Craig Andera
> I'm up for suggestions on the name. The obvious ones: > > - Clojure.net > - ClojureCLR > - IronClojure (paralleling IronPython/IronRuby, unless MS has Iron > trademarked.) > - CLjR (too cute) > > Perhaps Rich will have a preference. He'll have to live with it > longer than anyone and has

Re: How do I do this in clojure?

2009-02-17 Thread Emeka
>Haha, I was afraid someone would say this. >Here is my embarrassingly bad (but working) version: I won't say that, you ported Python to Clojure while maintaining Python spirit. That's great! Emeka --~--~-~--~~~---~--~~ You received this message because you are s

Re: Clojure on CLR/DLR

2009-02-17 Thread mikel
On Feb 17, 9:03 am, Craig Andera wrote: > > I'm up for suggestions on the name.  The obvious ones: > > >  - Clojure.net > >  - ClojureCLR > >  - IronClojure (paralleling IronPython/IronRuby, unless MS has Iron > > trademarked.) > >  - CLjR  (too cute) > > > Perhaps Rich will have a preference.

Re: How do I do this in clojure?

2009-02-17 Thread Laurent PETIT
2009/2/17 Emeka > >Haha, I was afraid someone would say this. > >Here is my embarrassingly bad (but working) version: > > I won't say that, you ported Python to Clojure while maintaining Python > spirit. That's great! Are you serious, or is this a joke somewhat bashing the python language ? >

Re: terminology question re: binding

2009-02-17 Thread Chouser
On Tue, Feb 17, 2009 at 7:01 AM, David Sletten wrote: > > In a language such as Common Lisp where every variable is (effectively) a > reference variable, we have three concepts: names, variables (references), > and values (referents). These three things have two connections. In an > orthodox (per

Re: Libraries? model and generic-functions

2009-02-17 Thread Raffael Cavallaro
On Feb 17, 9:56 am, mikel wrote: > I'll let the level of interest > guide me in whether I package them for more general distribution. I am very interested in both of these subsystems and would love to see you package them as clojure.contrib libraries. Hopefully others feel the same and we'

Re: How do I do this in clojure?

2009-02-17 Thread Dan
> > I won't say that, you ported Python to Clojure while maintaining Python >> spirit. That's great! > > > Are you serious, or is this a joke somewhat bashing the python language ? > > I guess he meant maintaining the spirit of the original python code. The original code was overtly long and non-i

clojure and embedded derby

2009-02-17 Thread BrianS
Has anyone had experience creating clojure applications that use the embedded derby database driver? I am having an issue where I am unable to get the derby embedded database to shut down properly from within clojure. More specifically, whenever a java app accesses a derby embedded database, it c

Re: How do I do this in clojure?

2009-02-17 Thread Laurent PETIT
Yeah, I think you're right. That's "Python spirit" in place of "original code spirit" that surprised me. 2009/2/17 Dan > I won't say that, you ported Python to Clojure while maintaining Python >>> spirit. That's great! >> >> >> Are you serious, or is this a joke somewhat bashing the python lang

Re: Clojure on CLR/DLR

2009-02-17 Thread Dan
> > > > So, as a long-time .NET guy, IronClojure seems like the best name, in > > terms of making it obvious what it does: it's like IronRuby/Python, > > but it's Clojure. Failing that, it seems like NClojure fits the > > pattern of other JVM-ported efforts. I realize that there's already an > > En

Re: How do I do this in clojure?

2009-02-17 Thread Michael Wood
Hi On Tue, Feb 17, 2009 at 4:03 PM, Jesse Aldridge wrote: > >> Jesse, >> Could I see your own version. > > Haha, I was afraid someone would say this. > Here is my embarrassingly bad (but working) version: > > (defn build-table [] > (def num-cols 3) > (def selected-row 0) > (def selected-col 0

Re: terminology question re: binding

2009-02-17 Thread Jeffrey Straszheim
I'm still not *entirely* clear about the mappings from symbols and namespaces to Vars. I think I sort of understand how it works in practical terms, but this is a confusing area and getting the terminology nailed down would be a big help. On Tue, Feb 17, 2009 at 10:10 AM, Chouser wrote: > > On

Re: Fully lazy sequences are coming - feedback wanted!

2009-02-17 Thread Michael Reid
On Mon, Feb 16, 2009 at 12:05 PM, Perry Trolard wrote: > > I agree with the majority of posters that the breaking changes in the > service of optimal names is the right way to go. > > I found the explanation & recipe for porting at clojure.org/lazier > clear & easy to follow. I didn't do full por

Re: Clojure on CLR/DLR

2009-02-17 Thread Matt Revelle
On Feb 17, 2009, at 10:32 AM, Dan wrote: > > > So, as a long-time .NET guy, IronClojure seems like the best name, > in > > terms of making it obvious what it does: it's like IronRuby/Python, > > but it's Clojure. Failing that, it seems like NClojure fits the > > pattern of other JVM-ported eff

Re: Clojure Off-topic IRC channel

2009-02-17 Thread Rayne
I have now acquired 4 regulars who agree with me! We need more! Join people join! :p --~--~-~--~~~---~--~~ 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 To un

do-form swallows exception?

2009-02-17 Thread linh
Hi, How come the following code does not throw an exception? (defn foo [] (do (map (fn [_] (throw (RuntimeException. "fail"))) [1 2]) "no exception")) this however does throw exception: (defn foo [] (map (fn [_] (throw (RuntimeException. "fail"))) [1 2])) Is this a bug or am I miss

Re: do-form swallows exception?

2009-02-17 Thread Christian Vest Hansen
First, "map" returns a lazy seq. Second, "do" only returns the result of the last expression. So, the mapping you do in your "do" form is never executed because you never ask for the result. Try wrapping the mapping in "dorun" to explicitly realize the lazy seq from your mapping: (defn foo []

Re: Clojure Off-topic IRC channel

2009-02-17 Thread Chas Emerick
+1 I actually think that #clojure is very active. Of the channels I frequent/lurk in, only #git regularly surpasses #clojure in number of messages per (my) day. Maybe that says more about my irc interests, so take that as you will. #clojure-offtopic doesn't have much poetry to it, but I'l

Re: Clojure Off-topic IRC channel

2009-02-17 Thread Rayne
Names really weren't my priority here. I'll be happy to link -offtopic to another channel with a different name if someone thinks of a better name somewhere down the road ^_^. On Feb 17, 10:15 am, Chas Emerick wrote: > +1 > > I actually think that #clojure is very active.  Of the channels I   >

Re: do-form swallows exception?

2009-02-17 Thread Mike Benfield
Map is lazy. You are presumably executing (foo) at the REPL. In the first foo, since the value calculated by map is unused, no elements of the seq are calculated and your anonymous function never runs. In the second foo, since the function actually returns the value and the REPL wants to print it,

Re: do-form swallows exception?

2009-02-17 Thread linh
Thank you for the quick answers. I'm new to clojure and functional programming so this "lazy"-stuff is new to me, but it makes sense and is really cool. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group.

Re: Libraries? model and generic-functions

2009-02-17 Thread mikel
On Feb 17, 9:20 am, Raffael Cavallaro wrote: > On Feb 17, 9:56 am, mikel wrote: > > >  I'll let the level of interest > > guide me in whether I package them for more general distribution. > > I am very interested in both of these subsystems and would love to see > you package them as clojure.c

Re: clojure and embedded derby

2009-02-17 Thread Stuart Sierra
Is your Clojure app running in a REPL? I've run into situations where it seems like the Derby lock file doesn't go away until the Clojure process terminates. -Stuart Sierra On Feb 17, 10:28 am, BrianS wrote: > Has anyone had experience creating clojure applications that use the > embedded der

map literals, computed keys and side-effects

2009-02-17 Thread Christophe Grand
While kicking the tires, I encountered this "behavior": user=> (let [a (atom 0)] {(swap! a inc) 1 (swap! a inc) 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9}) {3 3, 4 4, 5 5, 6 6, 7 7, 8 8, 9 9, 1 2} user=> (let [a (atom 0)] {(swap! a inc) 1 (swap! a inc) 2 3 3 4 4 5 5 6 6 7 7 8 8}) {1 1, 2 2, 3 3, 4 4, 5 5,

Re: map literals, computed keys and side-effects

2009-02-17 Thread Christian Vest Hansen
That's odd. Might you have uncovered a bug regarding: user=> (class {1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9}) clojure.lang.PersistentHashMap user=> (class {1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8}) clojure.lang.PersistentArrayMap While with the atom code we have: user=> (class (let [a (atom 0)] {(swap! a

Web Services On Clojure

2009-02-17 Thread Fahed Alrafidi
Hello everybody! How do I create a web service on Clojure? Thank you. Fahed --~--~-~--~~~---~--~~ 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 To unsubsc

Fully lazy sequences are here!

2009-02-17 Thread Rich Hickey
I've merged the lazy branch into trunk, SVN rev 1287 Please do not rush to this version unless you are a library/tool developer. Let them do their ports and chime in on their progress. Move only when the libs/tools you depend upon have been ported. Thanks to all for your feedback and input! Ric

Re: map literals, computed keys and side-effects

2009-02-17 Thread Christian Vest Hansen
I think I got it :) The two (swap! a inc) forms are added to the map at read-time - which is before they are evaluated. However, since we are associating the (swap! a inc) key with a value twice, only the last one counts. So the atom is inc'ed to 1 once (because keys can only be in the map once),

Re: clojure and embedded derby

2009-02-17 Thread Jeff Valk
I've seen the same thing with embedded Derby while using SLIME. From within the REPL I was always able to reconnect to the same database, so it didn't really impact me. Outside the REPL I didn't notice a problem. If it holds you up, here's one observation you might investigate. Calling (.close

Re: map literals, computed keys and side-effects

2009-02-17 Thread Christian Vest Hansen
Just to clarify; I think PersistentArrayMap is too naïve: user=> {1 1 1 1 1 1 2 2} {1 1, 1 1, 1 1, 2 2} Also, this is rev 1286 (just prior to lazy-branch merge thingy). On Tue, Feb 17, 2009 at 8:50 PM, Christian Vest Hansen wrote: > I think I got it :) > > The two (swap! a inc) forms are added

Re: map literals, computed keys and side-effects

2009-02-17 Thread Christophe Grand
Christian Vest Hansen a écrit : > Just to clarify; I think PersistentArrayMap is too naïve: > > user=> {1 1 1 1 1 1 2 2} > {1 1, 1 1, 1 1, 2 2} > > Also, this is rev 1286 (just prior to lazy-branch merge thingy). > Fixing array-map would make the two tests consistent but I'm not sure that (le

Re: Clojure on CLR/DLR

2009-02-17 Thread Craig Andera
> As far as I understood, the rules are that it should be derived from Clojure > and sports either an N or a CLR. So I suggest Conjure > > It looks like clojure, sounds pleasing, and sounds lispish (conj). And Lisp > to me sounds like magic (in the Arthur C. Clarke meaning that it is a > techno

Re: How do I do this in clojure?

2009-02-17 Thread James Reeves
(ns html-table (:use clojure.contrib.prxml) (:use clojure.contrib.seq-utils)) (defn print-table [grid selected] (prxml [:table {:cellpadding 30, :bgcolor "#aa"} (for [[x row] (indexed grid)] [:tr (for [[y cell] (indexed row)] [:td {:bgcolor (if (=

Re: map literals, computed keys and side-effects

2009-02-17 Thread Christian Vest Hansen
On Tue, Feb 17, 2009 at 9:08 PM, Christophe Grand wrote: > > Fixing array-map would make the two tests consistent but I'm not sure > that (let [a (atom 0)] {(swap! a inc) 1 (swap! a inc) 2 }) should > evaluate to {1 2}. That would make it two distinct issues, as I see it. One for array-map, and

Re: Web Services On Clojure

2009-02-17 Thread James Reeves
Fahed Alrafidi wrote: > How do I create a web service on Clojure? Thank you. Depends what sort of web service. A simple RESTFUL web service is pretty easy to develop in Compojure: (ns web-service (:use compojure)) (defservlet math-servlet (POST "/add" (let [x (Integer/parseInt (params :

Re: Fully lazy sequences are here!

2009-02-17 Thread Chouser
On Tue, Feb 17, 2009 at 2:43 PM, Rich Hickey wrote: > > I've merged the lazy branch into trunk, SVN rev 1287 > > Please do not rush to this version unless you are a library/tool > developer. Let them do their ports and chime in on their progress. > Move only when the libs/tools you depend upon ha

Re: Clojure on CLR/DLR

2009-02-17 Thread Rich Hickey
On Feb 17, 3:19 pm, Craig Andera wrote: > > As far as I understood, the rules are that it should be derived from > > Clojure and sports either an N or a CLR. So I suggest Conjure > > > It looks like clojure, sounds pleasing, and sounds lispish (conj). And Lisp > > to me sounds like magic (in

Re: map literals, computed keys and side-effects

2009-02-17 Thread Rich Hickey
On Feb 17, 3:30 pm, Christian Vest Hansen wrote: > On Tue, Feb 17, 2009 at 9:08 PM, Christophe Grand > wrote: > > > Fixing array-map would make the two tests consistent but I'm not sure > > that (let [a (atom 0)] {(swap! a inc) 1 (swap! a inc) 2 }) should > > evaluate to {1 2}. > > That would

Re: Fully lazy sequences are here!

2009-02-17 Thread Frantisek Sodomka
That was fast! ;-) Rich, I am porting test_clojure and old 'cycle' worked as: (cycle []) => nil Currently: (cycle []) => java.lang.StackOverflowError Frantisek On Feb 17, 8:43 pm, Rich Hickey wrote: > I've merged the lazy branch into trunk, SVN rev 1287 > > Please do not rush to this version

Re: Clojure Off-topic IRC channel

2009-02-17 Thread Michel Salim
Since -social might imply the normal channel is .. err .. not (which would be most inaccurate!), how about #clojure-cafe? - Haskell has a "Cafe" forum / mailing list - Additional cute point: the first 16-bit of a Java class file is 0xCAFE Best regards, -- Michel S. On Feb 17, 11:27 am, Rayne

Re: map literals, computed keys and side-effects

2009-02-17 Thread Christian Vest Hansen
On Tue, Feb 17, 2009 at 10:07 PM, Rich Hickey wrote: > > > > On Feb 17, 3:30 pm, Christian Vest Hansen > Please don't create issues without getting a nod from me here first. Ok. I won't. I must have overlooked the "Similarly, please confirm a bug before making an entry." part. > > These are bu

clojure.contrib.repl-ln vs. new lazy

2009-02-17 Thread Stephen C. Gilardi
Using clojure 1287, compiling clojure.contrib.repl-ln gives an error: user=> (compile 'clojure.contrib.repl-ln) java.lang.ClassCastException: [Ljava.lang.Object; cannot be cast to [Ljava.lang.String; (repl_ln.clj:15) user=> (st) [...] Caused by: java.lang.ClassCastExc

Re: clojure.contrib.repl-ln vs. new lazy

2009-02-17 Thread Stephen C. Gilardi
On Feb 17, 2009, at 5:12 PM, Stephen C. Gilardi wrote: This line looks important: at clojure.core$generate_class__5435.invoke(genclass.clj:219) Turning on nil punning debugging with: cd clojure ant -Dclojure.assert-if-lazy-seq=true and testing with:

'nil 'false 'true - symbols or Clojure keywords?

2009-02-17 Thread Frantisek Sodomka
Usual symbol: 'abc => abc (symbol? 'abc) => true (symbol "abc") => abc (symbol? (symbol "abc")) => true Special "symbol": 'nil => nil (symbol? 'nil) => false (symbol "nil") => nil (symbol? (symbol "nil")) => true (= 'nil (symbol "nil")) => false (= 'nil nil) => true We can see that (symbol "nil

Re: 'nil 'false 'true - symbols or Clojure keywords?

2009-02-17 Thread Stephen C. Gilardi
On Feb 17, 2009, at 5:48 PM, Frantisek Sodomka wrote: Is this consistent and correct behavior? If it is correct, page http://clojure.org/Reader could tell more about 'nil, 'false and 'true. It is correct. nil, true, and false are literals--they evaluate to themselves. They are a bit special

Re: map literals, computed keys and side-effects

2009-02-17 Thread Timothy Pratley
I don't understand your example: > user=> (class {1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8 9 9}) > clojure.lang.PersistentHashMap > user=> (class {1 1 2 2 3 3 4 4 5 5 6 6 7 7 8 8}) > clojure.lang.PersistentArrayMap What governs which class {} will return? The number of arguments? --~--~-~--~

Re: map literals, computed keys and side-effects

2009-02-17 Thread Stephen C. Gilardi
On Feb 17, 2009, at 6:24 PM, Timothy Pratley wrote: What governs which class {} will return? The number of arguments? Yes. The current implementation of Clojure's literal map reader returns a PersistentArrayMap if there are 8 entries or fewer and a PersistentHashMap otherwise. --Steve

Re: map literals, computed keys and side-effects

2009-02-17 Thread Timothy Pratley
Thanks Steve, > returns a PersistentArrayMap if there are 8 entries or fewer and a   > PersistentHashMap otherwise. Ah that makes sense. Thanks for the explination. "The two (swap! a inc) forms are added to the map at read-time - which is before they are evaluated." What's the reason for this?

Re: Clojure Off-topic IRC channel

2009-02-17 Thread BerlinBrown
On Feb 17, 8:23 am, Rayne wrote: > A week or 2 ago, Lau_Of_DK asked me very nicely to stop talking so off- > topic in #Clojure. I mentioned that we should have an Off-topic > channel for people who would just like to talk, because just about > every other language's channel on freenode has an o

Bug: LazySeq.equiv()

2009-02-17 Thread Chouser
Empty lazy seqs do not always compare as equal: user=> (= (map inc nil) ()) false The problem is in IPersistentCollection equiv: user=> (.equiv (map inc nil) ()) false --Chouser --~--~-~--~~~---~--~~ You received this message because you are subscribed to the G

Re: Bug: LazySeq.equiv()

2009-02-17 Thread Chouser
On Tue, Feb 17, 2009 at 8:37 PM, Chouser wrote: > Empty lazy seqs do not always compare as equal: > > user=> (= (map inc nil) ()) > false The problem appears to be when the first seq being compared is empty but not identical to the second collection. The attached patch fixes this and is I think

Re: clojure.contrib.repl-ln vs. new lazy

2009-02-17 Thread Chouser
On Tue, Feb 17, 2009 at 5:33 PM, Stephen C. Gilardi wrote: > > Turning on nil punning debugging with: > >cd clojure >ant -Dclojure.assert-if-lazy-seq=true > > and testing with: > >user=> (compile 'clojure.contrib.repl-ln) > > suggests that genclass.clj could use some lazy l

what is the new version of clj about?

2009-02-17 Thread wubbie
Hi, I read a few messages on the new version. Could someone summarize the changes and the motivation behind? Thanks, sun --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send

Re: what is the new version of clj about?

2009-02-17 Thread Jeffrey Straszheim
http://clojure.org/lazy On Tue, Feb 17, 2009 at 8:54 PM, wubbie wrote: > > Hi, > > I read a few messages on the new version. > Could someone summarize the changes and the motivation > behind? > > Thanks, > sun > > > > --~--~-~--~~~---~--~~ You received this mess

Re: what is the new version of clj about?

2009-02-17 Thread Chouser
On Tue, Feb 17, 2009 at 8:56 PM, Jeffrey Straszheim wrote: > http://clojure.org/lazy Also: http://blog.n01se.net/?p=39 I know, I'm shameless. --Chouser --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" gr

Re: what is the new version of clj about?

2009-02-17 Thread Jeffrey Straszheim
Not shameless ... you took the time to write it. It is on-topic. It should be shared. :) On Tue, Feb 17, 2009 at 9:04 PM, Chouser wrote: > > On Tue, Feb 17, 2009 at 8:56 PM, Jeffrey Straszheim > wrote: > > http://clojure.org/lazy > > Also: http://blog.n01se.net/?p=39 > > I know, I'm shameless.

Re: How do I do this in clojure?

2009-02-17 Thread Jesse Aldridge
Oh wow, this is perfect. Thanks. On Feb 17, 2:21 pm, James Reeves wrote: > (ns html-table >   (:use clojure.contrib.prxml) >   (:use clojure.contrib.seq-utils)) > > (defn print-table [grid selected] >   (prxml >     [:table {:cellpadding 30, :bgcolor "#aa"} >       (for [[x row] (indexed gr

Re: Bug: LazySeq.equiv()

2009-02-17 Thread Rich Hickey
On Feb 17, 8:48 pm, Chouser wrote: > On Tue, Feb 17, 2009 at 8:37 PM, Chouser wrote: > > Empty lazy seqs do not always compare as equal: > > > user=> (= (map inc nil) ()) > > false > > The problem appears to be when the first seq being compared is empty > but not identical to the second collec

Re: Clojure on CLR/DLR

2009-02-17 Thread Michel Salim
On Tue, Feb 17, 2009 at 10:03 AM, Craig Andera wrote: > >> I'm up for suggestions on the name. The obvious ones: >> >> - Clojure.net >> - ClojureCLR >> - IronClojure (paralleling IronPython/IronRuby, unless MS has Iron >> trademarked.) >> - CLjR (too cute) >> >> Perhaps Rich will have a pre

Re: clojure.contrib.repl-ln vs. new lazy

2009-02-17 Thread Rich Hickey
On Feb 17, 8:52 pm, Chouser wrote: > On Tue, Feb 17, 2009 at 5:33 PM, Stephen C. Gilardi wrote: > > > > > Turning on nil punning debugging with: > > >cd clojure > >ant -Dclojure.assert-if-lazy-seq=true > > > and testing with: > > >user=> (compile 'clojure.contrib.repl-l

Re: Fully lazy sequences are here!

2009-02-17 Thread Rich Hickey
On Feb 17, 4:16 pm, Frantisek Sodomka wrote: > That was fast! ;-) > > Rich, I am porting test_clojure and old 'cycle' worked as: > (cycle []) => nil > > Currently: > (cycle []) => java.lang.StackOverflowError > Fixed in svn 1290 - thanks for the report. Rich --~--~-~--~~-

Re: Fully lazy sequences are here!

2009-02-17 Thread Chouser
On Tue, Feb 17, 2009 at 3:47 PM, Chouser wrote: > On Tue, Feb 17, 2009 at 2:43 PM, Rich Hickey wrote: >> >> Please do not rush to this version unless you are a library/tool >> developer. Let them do their ports and chime in on their progress. >> Move only when the libs/tools you depend upon have

Re: Fully lazy sequences are coming - feedback wanted!

2009-02-17 Thread Mark Engelberg
Since there is no canonical empty sequence, this makes me wonder whether one particular empty sequence might have some kind of performance benefit over another. For example, if I were going to give a name to one empty sequence to reuse within my code, would one of these be preferable?: (def empty

Re: Clojure on CLR/DLR

2009-02-17 Thread dmiller
My thanks to Rich for the suggestion to go public and for agreeing to include this as part of the Clojure community. Thanks to all for the encouragement. -- David On Feb 17, 2:55 pm, Rich Hickey wrote: > > The whole point of including David's work in contrib is to give people > confidence tha

Re: terminology question re: binding

2009-02-17 Thread David Sletten
On Feb 17, 2009, at 5:10 AM, Chouser wrote: > >> I think that the strict usage is consistent with Clojure's >> "binding" macro, >> which binds a name to a new variable. > > Are you sure? It seems to me the most natural mapping from the CL > concepts to Clojure is: > CL name -> Clojure symbo

Re: terminology question re: binding

2009-02-17 Thread Chouser
On Tue, Feb 17, 2009 at 11:48 PM, David Sletten wrote: > > ; Clojure. We can access the reference itself via "var". > (def pung 8) > (def foo pung) ; i.e., (deref (var pung)) or @#'pung > (def bar (var pung)) > > ; "binding" changes value of "pung"--apparently not the variable > itself, thus > ;

Re: Does this debugger feature exist?

2009-02-17 Thread CuppoJava
Okay, thanks for the reply Jason. I'll just have to make do with JSwat for now it seems. On Feb 17, 12:50 am, Jason Wolfe wrote: > I'm sure SLIME has similar features (I've used them with SBCL) but I > haven't managed to get them to work with Clojure yet -- my suspicion > is that they're not imp

Idiomatic Way to Write the Following:

2009-02-17 Thread CuppoJava
Hi, I'm wondering if there's a terser more idiomatic way to write the following. I want to get a new vector with the specified indexes removed. I found myself doing this often enough to warrant writing my own function for this but I would be much happier if there's some terse way of expressing thi

Re: Idiomatic Way to Write the Following:

2009-02-17 Thread David Nolen
Is using subvec for something like this a bad idea? On Wed, Feb 18, 2009 at 12:38 AM, CuppoJava wrote: > > Hi, > I'm wondering if there's a terser more idiomatic way to write the > following. I want to get a new vector with the specified indexes > removed. I found myself doing this often enough t

Re: Idiomatic Way to Write the Following:

2009-02-17 Thread CuppoJava
Mmm, subvec doesn't quite seem to do the same thing. I want a function that removes certain indexes of a vector: eg. (remove_at [1 2 3 4 5 6] 0 3) => [2 3 5 6] --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure

Performance of (fn [] ...)?

2009-02-17 Thread CuppoJava
Hi, I've noticed that I'm creating a lot of maps of functions, and I'm wondering if there's a performance penalty for this. ie. (defn create_fn [] (fn [] (println "hi"))) ((create_fn)) <--- Does this "create" a new function every-time it's called? Or is the function code cached somewhere? Ho

Re: Performance of (fn [] ...)?

2009-02-17 Thread David Nolen
new MBP 2.53ghz (defn create-fn [] (fn [] (println "hi"))) (time (dotimes [x 4000] (create-fn))) > "Elapsed time: 1034.409 msecs" Hopefully you don't need 40,000,000 functions in less than a second ;) On Wed, Feb 18, 2009 at 1:16 AM, CuppoJava wrote: > (defn create_fn [] > (fn [] (

Re: Idiomatic Way to Write the Following:

2009-02-17 Thread David Nolen
My point was that you could use subvec to do vector splicing and build your remove function off of that. I'm sure the more experienced Clojurians can chime in on what is the most idiomatic form. On Wed, Feb 18, 2009 at 1:10 AM, CuppoJava wrote: > > Mmm, subvec doesn't quite seem to do the same t