Re: Datatypes and Protocols - early experience program

2009-11-14 Thread Mark Engelberg
On Fri, Nov 13, 2009 at 12:58 AM, Konrad Hinsen konrad.hin...@fastmail.net wrote: Coming from a Python background, I don't think access restrictions are necessary. However, flagging fields as not meant for use by outsiders could be of interest for documentation tools, to make it clear what

Re: Datatypes and Protocols - early experience program

2009-11-14 Thread John Harrop
On Sat, Nov 14, 2009 at 3:45 AM, Mark Engelberg mark.engelb...@gmail.comwrote: On Fri, Nov 13, 2009 at 12:58 AM, Konrad Hinsen konrad.hin...@fastmail.net wrote: Coming from a Python background, I don't think access restrictions are necessary. However, flagging fields as not meant for use by

Re: local constants in functions or static locals/Hilbert curve in clojure (no images:)

2009-11-14 Thread ajuc
I would like to somehow hide the global hilbert-map into my function, but I can't see how to do that. Just put the literal directly into the function. Is this possible? I know that I can just inert literal into my let, but that degrades performance, when function is called many times.

Re: Datatypes and Protocols - early experience program

2009-11-14 Thread Konrad Hinsen
On 13 Nov 2009, at 23:03, Stuart Sierra wrote: This example has maybe a problem : doesn't the symmetry of these Arithmetic operators seems to be crying for type multiple dispatch in this particular case ? :-) Yes, in the general case, arithmetic requires multimethods. But multimethods --

Re: Datatypes and Protocols - early experience program

2009-11-14 Thread Konrad Hinsen
On 14 Nov 2009, at 02:50, Mark Engelberg wrote: together. So would it make sense for multimethods to be included as part of protocols, or should there be some similar grouping system for multimethods? The old ideas/scratchpad section of

why a defn- but not a def- ?

2009-11-14 Thread Mike Hogye
Why is there an easy way to def a private function (defn-), but no similarly easy way to def an arbitrary var as private? -- 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

Re: Datatypes and Protocols - early experience program

2009-11-14 Thread Jonas Enlund
Hi there! I have built a simple Matrix datatype with defprotocol and deftype. You can take a look at it at http://gist.github.com/234535 (constructive criticism welcome!). Some simple examples are provided at the end of the file. I have a few questions. - Why must i write (matrix/Matrix ...)

Re: Datatypes and Protocols - early experience program

2009-11-14 Thread Konrad Hinsen
On 14 Nov 2009, at 09:45, Mark Engelberg wrote: In general, I really hate it when it's difficult to tell what parts of an API are the things that the end-user is really supposed to call, and what part of the data you're supposed to access directly versus an accessor method. It bugs me when I

Re: why a defn- but not a def- ?

2009-11-14 Thread Albert Cardona
On Fri, Nov 13, 2009 at 11:26 PM, Mike Hogye stacktra...@gmail.com wrote: Why is there an easy way to def a private function (defn-), but no similarly easy way to def an arbitrary var as private? The way I see it, def- would encourage gratuitous variable declaration imperative style. By

Re: Datatypes and Protocols - early experience program

2009-11-14 Thread Rich Hickey
On Nov 14, 8:28 am, Jonas Enlund jonas.enl...@gmail.com wrote: Hi there! I have built a simple Matrix datatype with defprotocol and deftype. You can take a look at it athttp://gist.github.com/234535 (constructive criticism welcome!). Some simple examples are provided at the end of the

Re: Datatypes and Protocols - early experience program

2009-11-14 Thread Rich Hickey
On Nov 14, 1:32 am, cody koeninger c...@koeninger.org wrote: On Nov 13, 9:42 am, Sean Devlin francoisdev...@gmail.com wrote: In this case, you provide the docs for each method after parameters. Would the following be possible: (defprotocol AProtocol :on AnInterface   A doc string for

Idiomatic way to remove in binding?

2009-11-14 Thread Sean Devlin
Hi, I recently was writing a macro that creates requires creating a worker fn, and the wrapping a worker fn with an adapter fn. The adapter fn is what I intend to have called. To give you an idea what's going on: user=(doc my-fn) This calls my-fn* to do some work, after my-fn calls a

Multiarray design study

2009-11-14 Thread Konrad Hinsen
Following recent discussions on this list about how to work with multiarrays (n-dimensional arrays, data cubes) in Clojure, I have started a project on Google Code that is at the moment more of a design study than an implementation meant for use. It contains - a protocol definition for

Re: local constants in functions or static locals/Hilbert curve in clojure (no images:)

2009-11-14 Thread Wilson MacGyver
The server VM is part of the standard JDK. To use it you can either do java -server or set environment variable JAVA_OPS like this on linux/OSX export JAVA_OPTS=-server On Sat, Nov 14, 2009 at 6:19 AM, ajuc aju...@gmail.com wrote: I would like to somehow hide the global hilbert-map into my

Deep deref

2009-11-14 Thread André Thieme
I watched http://www.infoq.com/presentations/Are-We-There-Yet-Rich-Hickey and it is a very nice video. Rich mentioned around minute 9 to 10:05 a big problem: when some code gets handed data, can it be sure this thing is immutable? Clojure wants to help, because it encapsulates state in refs,

Map a list of agents to a list of their values

2009-11-14 Thread Kevin Q
I have a list of agents, each of which has a hasmap state. I want to get a list of values from the list of agents, naturally I used the map function and print the result of the map: (println (map #(@%) agents)) However, when I run this, I got error Wrong number of args passed to:

Re: Map a list of agents to a list of their values

2009-11-14 Thread Sean Devlin
Try (map deref agents) On Nov 14, 12:49 pm, Kevin Q kevin.jing@gmail.com wrote: I have a list of agents, each of which has a hasmap state. I want to get a list of values from the list of agents, naturally I used the map function and print the result of the map: (println   (map #(@%)

ExceptionInInitializerError in eval with user defined functions

2009-11-14 Thread gun43
Using r1366 under Win XP. A user defined function: 1:27 user= (defn plus2 [x] (+ x 2)) #'user/plus2 1:28 user= (plus2 5) 7 can only be eval'd 1:29 user= (list plus2 5) (#user$plus2__217 user$plus2__...@4d76b4 5) 1:30 user= (eval (list plus2 5)) java.lang.ExceptionInInitializerError (repl-1:30)

Re: Datatypes and Protocols - early experience program

2009-11-14 Thread Richard Newman
I don't really care how strictly the language *enforces* that separation, but I think the ability to specify that separation is a good thing. I'd go so far as to request that it does not enforce separation. I'm sure anyone who's spent enough time using Other People's Libraries has hit

Re: why a defn- but not a def- ?

2009-11-14 Thread John Harrop
On Sat, Nov 14, 2009 at 8:55 AM, Albert Cardona sapri...@gmail.com wrote: On Fri, Nov 13, 2009 at 11:26 PM, Mike Hogye stacktra...@gmail.com wrote: Why is there an easy way to def a private function (defn-), but no similarly easy way to def an arbitrary var as private? The way I see it,

Re: local constants in functions or static locals/Hilbert curve in clojure (no images:)

2009-11-14 Thread John Harrop
On Sat, Nov 14, 2009 at 6:19 AM, ajuc aju...@gmail.com wrote: I would like to somehow hide the global hilbert-map into my function, but I can't see how to do that. Just put the literal directly into the function. Is this possible? I know that I can just inert literal into my let,

Re: Deep deref

2009-11-14 Thread John Harrop
On Sat, Nov 14, 2009 at 11:42 AM, André Thieme splendidl...@googlemail.comwrote: Dereferencing *persons* will result in: {Tina #r...@7ae6d: {:name Tina, :age 19, :friends []}, Jeff #r...@125d92c: {:name Jeff, :age 22, :friends []}, Karl #r...@14fa0ef: {:name Karl, :age 20, :friends []}}

Re: ExceptionInInitializerError in eval with user defined functions

2009-11-14 Thread Jarkko Oranen
On Nov 14, 8:08 pm, gun43 bg-561...@versanet.de wrote: Using r1366 under Win XP. r1366? From Subversion? That's ancient. Clojure moved to git ages ago; see http://github.com/richhickey/clojure A user defined function: 1:27 user= (defn plus2 [x] (+ x 2)) #'user/plus2 1:28 user= (plus2 5)

Re: Multiarray design study

2009-11-14 Thread Rock
Great news Konrad! I'll be having a look as soon as possible, and I hope I can help out. Thank you! Rock On Nov 14, 3:54 pm, Konrad Hinsen konrad.hin...@fastmail.net wrote: Following recent discussions on this list about how to work with   multiarrays (n-dimensional arrays, data cubes) in

Re: Deep deref

2009-11-14 Thread John Harrop
On Sat, Nov 14, 2009 at 2:11 PM, John Harrop jharrop...@gmail.com wrote: On Sat, Nov 14, 2009 at 11:42 AM, André Thieme splendidl...@googlemail.com wrote: Dereferencing *persons* will result in: {Tina #r...@7ae6d: {:name Tina, :age 19, :friends []}, Jeff #r...@125d92c: {:name Jeff, :age

Re: Map a list of agents to a list of their values

2009-11-14 Thread John Harrop
On Sat, Nov 14, 2009 at 12:49 PM, Kevin Q kevin.jing@gmail.com wrote: I have a list of agents, each of which has a hasmap state. I want to get a list of values from the list of agents, naturally I used the map function and print the result of the map: (println (map #(@%) agents))

Re: Deep deref

2009-11-14 Thread Danny Woods
André Thieme wrote: How can we handle this situation? Is it possible to implement a function “deep-deref” which works as blindingly fast as deref does? I find this very important, and this is of great practical relevance for me. Please share your ideas Hi André, I had a similar issue with

Re: local constants in functions or static locals/Hilbert curve in clojure (no images:)

2009-11-14 Thread ajuc
Eeeuw. Was this with a Clojure literal in the let, or with a non-trivial calculation using constants? The only difference is literal map of maps in let form. Full code here: http://clojure.pastebin.com/m17b8d69 I have to install java one more time, when I try to start java - server, I get:

Re: Map a list of agents to a list of their values

2009-11-14 Thread Kevin Q
Thanks! That works. However, why wouldn't (map #(@%) agents) work? On Nov 14, 1:01 pm, Sean Devlin francoisdev...@gmail.com wrote: Try (map deref agents) On Nov 14, 12:49 pm, Kevin Q kevin.jing@gmail.com wrote: I have a list of agents, each of which has a hasmap state. I want to get

Re: Map a list of agents to a list of their values

2009-11-14 Thread Kevin Q
Hi, Thanks for the hint. I tried (map deref agents) and it did work. I don't know if this is a bug? On Nov 14, 2:31 pm, John Harrop jharrop...@gmail.com wrote: On Sat, Nov 14, 2009 at 12:49 PM, Kevin Q kevin.jing@gmail.com wrote: I have a list of agents, each of which has a hasmap state. I

Re: Datatypes and Protocols - early experience program

2009-11-14 Thread John Harrop
On Sat, Nov 14, 2009 at 1:42 PM, Richard Newman holyg...@gmail.com wrote: I like CL's package support for this kind of situation, where unexported symbols can still be reached via foo::bar, at the cost of an obvious code smell. This suggests an alternate fix for the private functions in

Re: local constants in functions or static locals/Hilbert curve in clojure (no images:)

2009-11-14 Thread John Harrop
On Sat, Nov 14, 2009 at 3:03 PM, ajuc aju...@gmail.com wrote: I have to install java one more time, when I try to start java - server, I get: Error: no `server' JVM at `F:\Program Files\Java\jre6\bin\server \jvm.dll You need to use the one in F:\Program Files\Java\jdk6 instead. I'm

Re: Map a list of agents to a list of their values

2009-11-14 Thread John Harrop
On Sat, Nov 14, 2009 at 2:51 PM, Kevin Q kevin.jing@gmail.com wrote: Hi, Thanks for the hint. I tried (map deref agents) and it did work. I don't know if this is a bug? Nah, it's just being really sneaky. (fn* [p1__6536] ((clojure.core/deref p1__6536))) Even I didn't notice it

Re: Map a list of agents to a list of their values

2009-11-14 Thread John Harrop
On Sat, Nov 14, 2009 at 3:24 PM, John Harrop jharrop...@gmail.com wrote: On Sat, Nov 14, 2009 at 2:51 PM, Kevin Q kevin.jing@gmail.com wrote: Hi, Thanks for the hint. I tried (map deref agents) and it did work. I don't know if this is a bug? Nah, it's just being really sneaky.

Re: with-command-line and empty/nil args list

2009-11-14 Thread Mike Hogye
Thanks! -- 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

Re: Deep deref

2009-11-14 Thread André Thieme
On 14 Nov., 20:22, John Harrop jharrop...@gmail.com wrote: On Sat, Nov 14, 2009 at 2:11 PM, John Harrop jharrop...@gmail.com wrote: On Sat, Nov 14, 2009 at 11:42 AM, André Thieme splendidl...@googlemail.com wrote: Dereferencing *persons* will result in: {Tina #r...@7ae6d: {:name Tina,

Re: Deep deref

2009-11-14 Thread André Thieme
On 14 Nov., 20:32, Danny Woods dannywo...@gmail.com wrote: André Thieme wrote: How can we handle this situation? Is it possible to implement a function “deep-deref” which works as blindingly fast as deref does? I find this very important, and this is of great practical relevance for

ANN: Clojure API for AllegroGraph

2009-11-14 Thread Mike Hinchey
Franz Inc and I just put the AllegroGraph 3.2 Java API on github with my new Clojure API. The clojure is a wrapper of the java client, which is an implementation of openrdf/sesame. The wrapper is mostly to make it more idiomatic clojure so you don't have to deal with so many java classes,

YAClojureBlog

2009-11-14 Thread Seth
As I spelunk through Clojure my experiences are being posted to http://blogs.foognostic.net/topics/code/clojure/. Recently, I have been implementing some basics of poker with the goal of playing it at the REPL. Any and all comments -- including scathing code reviews! -- would be very welcome.

Re: Clojure Web Libraries

2009-11-14 Thread ngocdaothanh
Hi Stuart, Can you elaborate on Restlet? After some short investigation I think it uses annotation but Clojure does not support it, so Clojure is not Restlet-ready. Thanks On Jan 23, 1:44 am, Stuart Sierra the.stuart.sie...@gmail.com wrote: Hi Frank, I'd also recommend looking

Re: Clojure Web Libraries

2009-11-14 Thread Stuart Sierra
The latest restlet versions use annotations. I stil use 1.1, which uses ordinary classes. I'm bothered by restlet's move to annotations, but hoefully the old API is still available. sent from my phone On Nov 14, 2009 10:58 PM, ngocdaothanh ngocdaoth...@gmail.com wrote: Hi Stuart, Can you

Re: Clojure Web Libraries

2009-11-14 Thread David Brown
On Jan 21, 4:39 pm, Frank ffai...@gmail.com wrote: I am interested in trying to use Clojure to develop web-based applications.  Can someone point me to any Clojure libraries that have been written that I can use.  Thanks. I spent a couple of days this week using Compojure both in anger,