Re: Clojure Box (was Working combination of .emacs, Aquamacs, swank-clojure, clojure-mode?)

2008-11-20 Thread Boris Schmid
Nice!. As a newbie, I found lispbox one of the easiest ways to set up a lisp + emacs on windows, so I think a clojurebox will be a good thing for people. (although currently I'm just using ssh to get to my work and emacs -nw from there.) On 21 nov, 01:49, "Shawn Hoover" <[EMAIL PROTECTED]> wrote

Re: No matching method found: getString

2008-11-20 Thread Michael Wood
On Thu, Nov 20, 2008 at 6:59 PM, Rich Hickey <[EMAIL PROTECTED]> wrote: > SVN rev 1119 has my latest attempt to reconcile these bridge methods, > trying to make all of these work: > > http://groups.google.com/group/clojure/browse_frm/thread/a4e1b58061962479/23a1efe8d9f45eb3 > http://groups.google.

Re: Newbie: Creating a MapEntry

2008-11-20 Thread wlr
On Nov 21, 12:03 am, samppi <[EMAIL PROTECTED]> wrote: > I want to mess with sequences of two-sized vectors, Maybe destructuring will do: user> (dorun (map (fn [[k v]] (println "Key " k "Value " v)) [ [:a 3] [:b 2] [:a 1] [:c 0]])) => Key :a Value 3 Key :b Value 2 Key :a Value 1 Key :c Val

Re: mutability

2008-11-20 Thread Timothy Pratley
> Step right up folks and place your bet. Depends on the implementer, Chouser can do it in 95 LOC --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@google

Re: Newbie: Creating a MapEntry

2008-11-20 Thread samppi
Thank you very much. On Nov 20, 10:07 pm, "Stephen C. Gilardi" <[EMAIL PROTECTED]> wrote: > On Nov 21, 2008, at 12:03 AM, samppi wrote: > > > Is it possible to create a MapEntry from scratch? > > user=> (def a (clojure.lang.MapEntry. 3 4)) > #'user/a > user=> (key a) > 3 > user=> (val a) > 4 > us

Re: Newbie: Creating a MapEntry

2008-11-20 Thread Stephen C. Gilardi
On Nov 21, 2008, at 12:03 AM, samppi wrote: > Is it possible to create a MapEntry from scratch? user=> (def a (clojure.lang.MapEntry. 3 4)) #'user/a user=> (key a) 3 user=> (val a) 4 user=> You can also make it a little shorter by importing clojure.lang.MapEntry . --Steve --~--~-~-

Newbie: Creating a MapEntry

2008-11-20 Thread samppi
Is it possible to create a MapEntry from scratch? The reason why I'm asking is because I want to mess with sequences of two-sized vectors, and it would be really cool if I could use the key and val functions on them rather than (get % 0) and (get % 1): (map #(str "Key:" (key %) "Value:" (val %)

Re: mutability

2008-11-20 Thread Daniel Renfer
It would be interesting to see how many lines a 1000 LOC Scala projects translates into idiomatic clojure clode. Step right up folks and place your bet. Without knowing anything about Scala or the project in particular, I'm guessing ~750. Any other takers? On Thu, Nov 20, 2008 at 11:31 PM, Paul

Re: mutability

2008-11-20 Thread Paul Barry
Sure, I'd be interested in porting it, would give me a reason to learn Scala :). Just post the code to github or something and let us know where it's at. On Nov 20, 10:42 pm, islon <[EMAIL PROTECTED]> wrote: > I gave up, the resulting code would be a lot more complex than the > scala version. >

Re: mutability

2008-11-20 Thread Craig Andera
I must be missing something. Even if you have to make every modification inside a dosync using the syntax that you originally provided, why not write a function that captures that and be done with it? Or, if you have to, a macro? That is, it seems like the complaint is "too much repeated code", bu

Re: mutability

2008-11-20 Thread islon
I gave up, the resulting code would be a lot more complex than the scala version. But thanks for your advices. If anyone wants to port it I can send the source code, it's ~1000 lines total. Islon On Nov 20, 11:38 pm, harrison clarke <[EMAIL PROTECTED]> wrote: > i was thinking that each stat wou

Re: mutability

2008-11-20 Thread harrison clarke
i was thinking that each stat would be an agent. whatever boats your float, i guess. i'm probably not the person to go to about idiomatic code. :V user> (let [player {:str (agent 5) :dex (agent 5)} str (:str player) dex (:dex player)] (println @str @dex) (send str +

Re: mutability

2008-11-20 Thread Chouser
On Thu, Nov 20, 2008 at 8:51 PM, islon <[EMAIL PROTECTED]> wrote: > > Thanks for the ideas =) > I'll use agents to represent state (I don't know how I forgot it, > thanks Harrison), they are a lot more concise than refs and make a lot > more sense in my context. > Only one problem: > > user=> (def

Re: mutability

2008-11-20 Thread islon
Thanks for the ideas =) I'll use agents to represent state (I don't know how I forgot it, thanks Harrison), they are a lot more concise than refs and make a lot more sense in my context. Only one problem: user=> (def player (agent {:str 2 :dex 3})) #=(var user/player) user=> @player {:str 2, :dex

Re: Bureaucracy has reached Wikibooks

2008-11-20 Thread Timothy Pratley
I'd be inclined to persist with wikibooks... I see some possible solutions: 1) Have the "Flagged Rev" removed -- pages that haven't been reviewed behave as normal still [I've requested this on the admin contact section, but being new to wikibooks have no idea if this will work] 2) Move content

Clojure Box (was Working combination of .emacs, Aquamacs, swank-clojure, clojure-mode?)

2008-11-20 Thread Shawn Hoover
On Thu, Nov 20, 2008 at 8:27 AM, Daniel Renfer <[EMAIL PROTECTED]> wrote: > perhaps what we need is a clojure-in-a-box solution. We could create a > package containing a version of clojure, emacs, slime, swank-clojure, > clojure-mode, and clojure-contrib. This could be as simple as a zip > file, b

Re: mutability

2008-11-20 Thread Timothy Pratley
Given that is the correct way to mutate state, why do we need so much explicit syntax? user=> (defn += [a b c] (dosync (commute a update-in [b] #(+ c %1 user=> (+= player :str 1) {:str 56} ; are you a giant? Ok so if I did something like this: (+= player :int 5) (+= player :hpmax 10) in one

Re: mutability

2008-11-20 Thread harrison clarke
> (send (:str player) #(+ % 1)) on second thought, this should be the same: (send (:str player) + 1) or: (send (player :str) + 1) if you use agents, just make sure you use await before dereferencing them. could cause some issuses if you don't. --~--~-~--~~~---~--~---

Re: mutability

2008-11-20 Thread Harrison Clarke
i think agents would be a better fit than refs. as you said, you don't need transactions, since everything is sequential anyway. so whenever you need to change something, just send the change to the agent. (send (:str player) #(+ % 1)) --~--~-~--~~~---~--~~ You r

Re: writing binary values (bytes) to a file

2008-11-20 Thread prhlava
Hello Graham, > Bonus question for the bored reader: write a function, > (byte-array-maker N), that takes a width N, and returns a function > that takes an Integer as input and returns an N-width byte array > containing the Integer in big-endian order. E.g. > > ((byte-array-maker 4) 652187261) >

Re: mutability

2008-11-20 Thread Chouser
On Thu, Nov 20, 2008 at 4:16 PM, islon <[EMAIL PROTECTED]> wrote: > > if you are a 100% sure that > your program is singlethreaded and will never > be multithread it's annoying all the ceremony to set a variable. There are ways out of the box, if you want to get dirty. You can just call (def foo

Re: What's in *your* user.clj?

2008-11-20 Thread bc
On Nov 20, 12:31 pm, "Bill Clementson" <[EMAIL PROTECTED]> wrote: > On Thu, Nov 20, 2008 at 12:27 PM, Chouser <[EMAIL PROTECTED]> wrote: > > > On Thu, Nov 20, 2008 at 2:46 PM, bc <[EMAIL PROTECTED]> wrote: > > >> Very nice! However, shouldn't the modification to *print-length* be > >> inside a b

Re: Suggest allowing java property to specify *compile-path*

2008-11-20 Thread Stephen C. Gilardi
On Nov 20, 2008, at 4:33 PM, Stuart Sierra wrote: > Yes! All we need is a file compiler that works. :) There's something > missing, in both my attempts, which causes the root class file for the > namespace not to be generated. Rich, any idea what's missing? It looks to me like compiling libs

Re: loss of gen-and-load-class functionality

2008-11-20 Thread Stuart Sierra
On Nov 20, 2:14 pm, Stephen Wrobleski <[EMAIL PROTECTED]> wrote: > Furthermore, requiring the use of (ns ..) to create a class makes defining a > class with a macro somewhat tedious (seems like you'd have to bind *ns*, so > that (ns ..) could mutate it), if even possible. This is probably tempora

Re: offtopic - where are you come from? (poll)

2008-11-20 Thread Tchavdar Roussanov
Minnesota, USA --~--~-~--~~~---~--~~ 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 to [EMAIL PROTECTED] For more o

Re: with-gensyms

2008-11-20 Thread Stuart Sierra
On Nov 20, 4:18 pm, Rock <[EMAIL PROTECTED]> wrote: > Another question: I was wondering why there seem to be no macrolet or > symbol-macrolet macros in the language. Is it part of the language > design or will they be added in future releases? It's been discussed, but not implemented: http://grou

Re: with-gensyms

2008-11-20 Thread Stephen C. Gilardi
On Nov 20, 2008, at 4:18 PM, Rock wrote: > Another question: I was wondering why there seem to be no macrolet or > symbol-macrolet macros in the language. Is it part of the language > design or will they be added in future releases? Rich misses symbol-macrolet too: http://clojure-log.n

Re: Suggest allowing java property to specify *compile-path*

2008-11-20 Thread Stuart Sierra
On Nov 20, 2:04 pm, Rich Hickey <[EMAIL PROTECTED]> wrote: > I'm in favor. I'd like to get a single story together incorporating > Stuart's build.xml, his file compiler: > > http://groups.google.com/group/clojure/msg/4f0aa3be9a2dc79d > > and this path suggestion. Yes! All we need is a file compi

Re: with-gensyms

2008-11-20 Thread Rock
Well, I'm no Clojure macro expert yet, that's for sure, but from what I gather the auto-gensym mechanism has limitations to some extent, so that using regular gensyms in certain cases appears to be mandatory. So, I figured, something like good old WITH-GENSYMS could come in handy. I'm not certain

Re: with-gensyms

2008-11-20 Thread Rock
Wow, I'm impressed. Thanks for the explanation Meikel. Clojure is indeed very expressive. Another question: I was wondering why there seem to be no macrolet or symbol-macrolet macros in the language. Is it part of the language design or will they be added in future releases? On Nov 20, 10:08 pm,

Re: mutability

2008-11-20 Thread islon
Thanks Chouser. Just to clarify some points: I'm not saying scala ir better than clojure or clojure is bad or immutability is a bad thing, and I know that a true game is multithread (I'm a game programmer). Clojure forces you to program in a thread safe way and it's a good thing when you are doin

Re: with-gensyms

2008-11-20 Thread Meikel Brandmeyer
Hi Rock, Am 20.11.2008 um 20:58 schrieb Rock: Peter Seibel's Practical Common Lisp: You might want to look at Stuart Halloway's "PCL->Clojure" series: http://blog.thinkrelevance.com/2008/09/16/pcl-clojure (defmacro with-gensyms [[& names] form] `(let ~(apply vector (loop [n names result []]

Re: with-gensyms

2008-11-20 Thread Allen Rohner
On Nov 20, 1:58 pm, Rock <[EMAIL PROTECTED]> wrote: > I've done my best to get a good enough grasp of how macros and syntax- > quotes work in Clojure. While waiting for some more detailed > documentation (thanks Meikel), I thought I'd work on something > practical. Here's my attempt at writing a

Re: mutability

2008-11-20 Thread Chouser
On Thu, Nov 20, 2008 at 3:23 PM, islon <[EMAIL PROTECTED]> wrote: > > in clojure I have to do (player is a struct and its attributes are > refs): > > (def player (Player ...)) > > (dosync (ref-set player (assoc player :str (inc (:str player) Assuming you meant: (def player (ref {:str 55})) (d

Re: Clojure at the JVM Languages Summit

2008-11-20 Thread Rich Hickey
On Sep 30, 1:17 pm, Allen Rohner <[EMAIL PROTECTED]> wrote: > > Thanks. The summit was really fantastic - so many interesting and > > smart people and lots of great presentations and conversations. Left > > me exhausted and a bit MIA here, which I'm afraid will continue > > through my talk Monda

Re: What's in *your* user.clj?

2008-11-20 Thread Bill Clementson
On Thu, Nov 20, 2008 at 12:27 PM, Chouser <[EMAIL PROTECTED]> wrote: > > On Thu, Nov 20, 2008 at 2:46 PM, bc <[EMAIL PROTECTED]> wrote: >> >> Very nice! However, shouldn't the modification to *print-length* be >> inside a binding - e.g.: > > Oh, no, those are two independent settings. 'show' is n

Re: What's in *your* user.clj?

2008-11-20 Thread Chouser
On Thu, Nov 20, 2008 at 2:46 PM, bc <[EMAIL PROTECTED]> wrote: > > Very nice! However, shouldn't the modification to *print-length* be > inside a binding - e.g.: Oh, no, those are two independent settings. 'show' is not helped much the the constrained *print-length* since it does its own looping

mutability

2008-11-20 Thread islon
I'm porting my single thread simple mud-like rpg game from scala to clojure and one thing that is annoying me is the code needed to change some var. In scala I do things like that: val player = new Player(...) player.str += 1 in clojure I have to do (player is a struct and its attributes are re

with-gensyms

2008-11-20 Thread Rock
I've done my best to get a good enough grasp of how macros and syntax- quotes work in Clojure. While waiting for some more detailed documentation (thanks Meikel), I thought I'd work on something practical. Here's my attempt at writing a version of WITH-GENSYMS for Clojure, taken directly from Pete

Re: What's in *your* user.clj?

2008-11-20 Thread bc
Hi Chouser, On Nov 20, 7:34 am, Chouser <[EMAIL PROTECTED]> wrote: > On Thu, Nov 20, 2008 at 10:03 AM, wlr <[EMAIL PROTECTED]> wrote: > > > As stated inhttp://clojure.org/getting_startedif user.clj is found > > on the classpath it will be autoloaded at clojure startup. Answers to > > the subject

loss of gen-and-load-class functionality

2008-11-20 Thread Stephen Wrobleski
Am I right that now the only way to define a class is to use the AOT compiler? The :gen-class subform in (ns ...) doesn't work when running/loading files, only when compiling. Furthermore, requiring the use of (ns ..) to create a class makes defining a class with a macro somewhat tedious (seems l

Re: Bureaucracy has reached Wikibooks

2008-11-20 Thread vdm
I am not a fan of Wikibooks, and was amazed to discover that this is where the community of a such a visionary language go to write. A more free form Wiki, in the original sense of the word, seems far more agreeable to me. If I want to access a URL using HTTP, why can't I just visit pages at cloj

Re: Bureaucracy has reached Wikibooks

2008-11-20 Thread Dave Newton
--- On Thu, 11/20/08, vdm <[EMAIL PROTECTED]> wrote: > I vote for getting a better wiki. Does anybody know of > examples of open source projects using a Wiki well? > Surely Clojure wouldn't be the first. Some Apache projects (Struts 2, for example) use Confluence, and they have an open source l

Re: Suggest allowing java property to specify *compile-path*

2008-11-20 Thread Rich Hickey
On Nov 20, 11:28 am, "Stephen C. Gilardi" <[EMAIL PROTECTED]> wrote: > Currently the compiler writes classes to the hierarchy under the value > of *compile-path* whose root binding is "classes". > > As we see in Stuart's build.xml patch, it can convenient to be able to > specify such a path as p

Re: Possible bug? StringIndexOutOfBoundException

2008-11-20 Thread Rich Hickey
On Nov 20, 12:37 pm, Feng <[EMAIL PROTECTED]> wrote: > I start getting StringIndexOutOfBoundException since svn rev 1113 (use > source name in smap). Fixed - rev 1120 - thanks for the report. Rich --~--~-~--~~~---~--~~ You received this message because you are s

Request for documentation

2008-11-20 Thread falcon
Could we get an overview/tutorial type documentation, perhaps similar to (but smaller than) "Scala By Example" (http://www.scala-lang.org/ docu/files/ScalaByExample.pdf)? I recently purchased the PDF beta version of the new Clojure book. It looks fantastic, unfortunately I just don't have time r

Bureaucracy has reached Wikibooks

2008-11-20 Thread Meikel Brandmeyer
Dear Clojurians, I found out, what the problem with the wiki is. On 15th of November there was a new "feature" installed on Wikibooks: "Flagged Revs"[1]. Its sublime aims are to improve the quality of the presented material by freezing known good revisions. In between, changes can be made, but a

Re: printing *command-line-args*

2008-11-20 Thread Parth Malwankar
On Nov 20, 10:49 pm, "Tom Emerson" <[EMAIL PROTECTED]> wrote: > On Thu, Nov 20, 2008 at 12:37 PM, Parth Malwankar > > <[EMAIL PROTECTED]> wrote: > > I have a single line file (tmp.clj) where I am trying to > > print *command-line-args*. > > And I get an exception if I run it. I am not sure what

Re: printing *command-line-args*

2008-11-20 Thread Tom Emerson
On Thu, Nov 20, 2008 at 12:37 PM, Parth Malwankar <[EMAIL PROTECTED]> wrote: > I have a single line file (tmp.clj) where I am trying to > print *command-line-args*. > And I get an exception if I run it. I am not sure what I > am doing wrong here. I suspect the issue is in your 'clj' script: the c

Re: printing *command-line-args*

2008-11-20 Thread Chouser
On Thu, Nov 20, 2008 at 12:37 PM, Parth Malwankar <[EMAIL PROTECTED]> wrote: > > I have a single line file (tmp.clj) where I am trying to > print *command-line-args*. > And I get an exception if I run it. I am not sure what I > am doing wrong here. > > [parth:~]% cat tmp.clj > (prn *command-line-a

printing *command-line-args*

2008-11-20 Thread Parth Malwankar
Hello, I have a single line file (tmp.clj) where I am trying to print *command-line-args*. And I get an exception if I run it. I am not sure what I am doing wrong here. [parth:~]% cat tmp.clj (prn *command-line-args*) [parth:~]% clj tmp.clj hello world nil Exception in thread "main" java.io.Fil

Possible bug? StringIndexOutOfBoundException

2008-11-20 Thread Feng
I start getting StringIndexOutOfBoundException since svn rev 1113 (use source name in smap). Though I'm not sure if this a bug in clojure or in user code, it appears that SOURCE var always have a root bound "NO_SOURCE_FILE". Shouldn't below code check against that, instead of just null? Index: sr

Re: No matching method found: getString

2008-11-20 Thread Rich Hickey
On Nov 20, 10:47 am, "Michael Wood" <[EMAIL PROTECTED]> wrote: > Hi > > > > On Thu, Nov 20, 2008 at 12:10 AM, Chouser <[EMAIL PROTECTED]> wrote: > > > On Wed, Nov 19, 2008 at 4:00 AM, Michael Wood <[EMAIL PROTECTED]> wrote: > > >> Exception in thread "main" java.lang.IllegalArgumentException: No

Suggest allowing java property to specify *compile-path*

2008-11-20 Thread Stephen C. Gilardi
Currently the compiler writes classes to the hierarchy under the value of *compile-path* whose root binding is "classes". As we see in Stuart's build.xml patch, it can convenient to be able to specify such a path as part of the JVM's environment. To support that, I suggest the following:

Re: [BUG?] No matching method found: getString

2008-11-20 Thread Michael Wood
Hi On Thu, Nov 20, 2008 at 12:10 AM, Chouser <[EMAIL PROTECTED]> wrote: > > On Wed, Nov 19, 2008 at 4:00 AM, Michael Wood <[EMAIL PROTECTED]> wrote: >> >> Exception in thread "main" java.lang.IllegalArgumentException: No >> matching method found: getString for class >> org.dcm4che2.data.BasicDico

Re: Macros and namespaces

2008-11-20 Thread Rich Hickey
On Nov 20, 10:33 am, Meikel Brandmeyer <[EMAIL PROTECTED]> wrote: > Hi, > > On 20 Nov., 16:00, Simon Brooke <[EMAIL PROTECTED]> wrote: > > > And this in turn is because, in core.clj > > > (defmacro cond > > "Takes a set of test/expr pairs. It evaluates each test one at a > > time. If a test

Re: Macros and syntax-quote

2008-11-20 Thread Rock
Thanks for your efforts Meikel. Greatly appreciated. Rock On Nov 20, 4:07 pm, Meikel Brandmeyer <[EMAIL PROTECTED]> wrote: > Hi, > > On 20 Nov., 14:28, Rich Hickey <[EMAIL PROTECTED]> wrote: > > > I didn't see any issues with wiki editing, ar eyou still having a > > problem? > > When I go to the

Re: Dividing by zero and floating-point infinity

2008-11-20 Thread Raffael Cavallaro
On Nov 20, 10:23 am, "Mark H." <[EMAIL PROTECTED]> wrote: > I can't speak from Rich but I've noticed this behavior in other Lisp > implementations (like SBCL) that are built on C.  The Lisp > implementation changes the semantics of floating-point divide-by- > zero.  (The ANSI Common Lisp standa

Re: What's in *your* user.clj?

2008-11-20 Thread Chouser
On Thu, Nov 20, 2008 at 10:03 AM, wlr <[EMAIL PROTECTED]> wrote: > > As stated in http://clojure.org/getting_started if user.clj is found > on the classpath it will be autoloaded at clojure startup. Answers to > the subject question will perhaps change as users and clojure mature > together, but f

Re: Macros and namespaces

2008-11-20 Thread Meikel Brandmeyer
Hi, On 20 Nov., 16:00, Simon Brooke <[EMAIL PROTECTED]> wrote: > And this in turn is because, in core.clj > > (defmacro cond >   "Takes a set of test/expr pairs. It evaluates each test one at a >   time.  If a test returns logical true, cond evaluates and returns >   the value of the correspondin

Re: i'm having a lot of trouble dealing with events.

2008-11-20 Thread wlr
err, bad paste. :-( Go with Cosmin Stejerean's reply. --~--~-~--~~~---~--~~ 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, se

Re: i'm having a lot of trouble dealing with events.

2008-11-20 Thread Cosmin Stejerean
On Thu, Nov 20, 2008 at 9:21 AM, Mark Volkmann <[EMAIL PROTECTED]>wrote: > > On Thu, Nov 20, 2008 at 12:00 AM, notallama <[EMAIL PROTECTED]> wrote: > > > >(keyTyped [#^KeyEvent e] nil) > > I'm not familiar with the syntax above. What does the "#^" part do? > See http://clo

Re: i'm having a lot of trouble dealing with events.

2008-11-20 Thread wlr
On Nov 20, 10:21 am, "Mark Volkmann" <[EMAIL PROTECTED]> wrote: > On Thu, Nov 20, 2008 at 12:00 AM, notallama <[EMAIL PROTECTED]> wrote: > > >                        (keyTyped [#^KeyEvent e] nil) > > I'm not familiar with the syntax above. What does the "#^" part do? > > -- > R. Mark Volkmann > Ob

Re: i'm having a lot of trouble dealing with events.

2008-11-20 Thread Cosmin Stejerean
On Thu, Nov 20, 2008 at 9:21 AM, Mark Volkmann <[EMAIL PROTECTED]>wrote: > > On Thu, Nov 20, 2008 at 12:00 AM, notallama <[EMAIL PROTECTED]> wrote: > > > >(keyTyped [#^KeyEvent e] nil) > > I'm not familiar with the syntax above. What does the "#^" part do? > See http://clo

Re: Dividing by zero and floating-point infinity

2008-11-20 Thread Mark H.
On Nov 19, 1:10 pm, samppi <[EMAIL PROTECTED]> wrote: > I am not familiar with how Java's arithmetic works, but it seems > fromhttp://hanuska.blogspot.com/2007/08/arithmeticexception-vs-nan.html > andhttp://www.concentric.net/~Ttwang/tech/javafloat.htmthat dividing > a double or float by 0 should

Re: i'm having a lot of trouble dealing with events.

2008-11-20 Thread Mark Volkmann
On Thu, Nov 20, 2008 at 12:00 AM, notallama <[EMAIL PROTECTED]> wrote: > >(keyTyped [#^KeyEvent e] nil) I'm not familiar with the syntax above. What does the "#^" part do? -- R. Mark Volkmann Object Computing, Inc. --~--~-~--~~~---~--~~ Y

Macros and namespaces

2008-11-20 Thread Simon Brooke
I sense already that I'm going to annoy people with this post, but hear me out - I do have something significant to say. I've been trying as a learning exercise to implement a subset of Portable Standard Lisp in Clojure, enough to get some non-trivial programs to run. I'm not talking about REDUCE

Re: What's in *your* user.clj?

2008-11-20 Thread Meikel Brandmeyer
Hi, On 20 Nov., 16:03, wlr <[EMAIL PROTECTED]> wrote: > An old tradition for emacs users is to publicize the contents of > their .emacs file. (For non-emacs folks, code in .emacs is run as > emacs itself starts up allowing emacs to run tailored to the > preferences of the user.) > > As stated inh

Re: Macros and syntax-quote

2008-11-20 Thread Meikel Brandmeyer
Hi, On 20 Nov., 14:28, Rich Hickey <[EMAIL PROTECTED]> wrote: > I didn't see any issues with wiki editing, ar eyou still having a > problem? When I go to the wiki, I get the notice, that there is one draft waiting for approval. : This is the latest sighted revision, approved on 18 November 2008

What's in *your* user.clj?

2008-11-20 Thread wlr
An old tradition for emacs users is to publicize the contents of their .emacs file. (For non-emacs folks, code in .emacs is run as emacs itself starts up allowing emacs to run tailored to the preferences of the user.) As stated in http://clojure.org/getting_started if user.clj is found on the cla

Re: Exact definition of _

2008-11-20 Thread Ralf Bensmann
It is used as an "anonymous variable", when you don't care of a value: user=> (let [myfn (fn [a b] (#(+ a b)))] (reduce myfn '(1 2 3 4 5))) 15 user=> (let [myfn (fn [a _] (#(+ a a)))] (reduce myfn '(1 2 3 4 5))) 16 On Thu, Nov 20, 2008 at 11:32 AM, Timothy Pratley <[EMAIL PROTECTED]>wrote: > >> >

Re: Macros and syntax-quote

2008-11-20 Thread Rock
Maybe there should be a little more info regarding the syntax-quote expansion algorithm for more involved situations, especially nested backquotes. There seems to be just the bare minimum in the Reference section. The rest is gathered in bits and pieces here and there. Contrast this with the detai

Re: ants.clj: question about sleep in dosync

2008-11-20 Thread Rich Hickey
On Nov 19, 5:05 pm, Stephan Mühlstrasser <[EMAIL PROTECTED]> wrote: > Hi, > > first of all hello to everybody as I'm new to this group. > > I'm starting to learn Clojure, and therefore I studied the ants.clj > program. It's more or less clear to me how it works, but I stumbled > across a small d

Re: Macros and syntax-quote

2008-11-20 Thread Michael Wood
On Thu, Nov 20, 2008 at 3:32 PM, Simon Brooke <[EMAIL PROTECTED]> wrote: > On Nov 20, 12:19 pm, Jarkko Oranen <[EMAIL PROTECTED]> wrote: [...] >> I'm not a macro expert myself, but I hope this will help you and >> others as well. >> It's good to spend some time simply writing macros and using >> '

Re: Macros and syntax-quote

2008-11-20 Thread Simon Brooke
On Nov 20, 12:19 pm, Jarkko Oranen <[EMAIL PROTECTED]> wrote: > On Nov 20, 12:29 pm, Rock <[EMAIL PROTECTED]> wrote: > > > Is there any chance of getting a more thourough explanation within > > Clojure? I'm convinced this is an important issue, especially for > > those coming from the likes of Jav

Re: Macros and syntax-quote

2008-11-20 Thread Rich Hickey
On Nov 20, 7:38 am, Meikel Brandmeyer <[EMAIL PROTECTED]> wrote: > Hi, > > On 20 Nov., 13:30, Rich Hickey <[EMAIL PROTECTED]> wrote: > > > Yes. Please use auto-gensyms (name#): > > > `(let [frame# ~frame] > >(.setTitle frame# ~title) > >(.setVisible frame#) > >frame#) > > With this s

Re: Working combination of .emacs, Aquamacs, swank-clojure, clojure-mode?

2008-11-20 Thread Daniel Renfer
perhaps what we need is a clojure-in-a-box solution. We could create a package containing a version of clojure, emacs, slime, swank-clojure, clojure-mode, and clojure-contrib. This could be as simple as a zip file, but even better would be to have a simple installer exe. All a new user would have

Re: Bug + Patch: compile fails for namespaces with dashes in their names.

2008-11-20 Thread Rich Hickey
On Nov 20, 12:18 am, Chouser <[EMAIL PROTECTED]> wrote: > Since SVN rev 1110: > > user=> (compile 'clojure.contrib.str-utils) > java.lang.Exception: Namespace name must match file, had: > clojure.contrib.str-utils and clojure/contrib/str_utils.clj > (NO_SOURCE_FILE:0) > > I think the only proble

Re: Macros and syntax-quote

2008-11-20 Thread Meikel Brandmeyer
Hi, On 20 Nov., 13:30, Rich Hickey <[EMAIL PROTECTED]> wrote: > Yes. Please use auto-gensyms (name#): > > `(let [frame# ~frame] >    (.setTitle frame# ~title) >    (.setVisible frame#) >    frame#) With this specific example, my intention was to show, how using a macro where a function would do

Re: Macros and syntax-quote

2008-11-20 Thread Rich Hickey
On Nov 20, 6:39 am, Meikel Brandmeyer <[EMAIL PROTECTED]> wrote: > Hi, > > On 20 Nov., 11:29, Rock <[EMAIL PROTECTED]> wrote: > > > I was what the difference might be with respect to this: > > > `(let [frame ~frame] > >(.setTitle frame ~title) > >(.setVisible frame) > >frame) > > Th

Re: Macros and syntax-quote

2008-11-20 Thread Jarkko Oranen
On Nov 20, 12:29 pm, Rock <[EMAIL PROTECTED]> wrote: > I was just reading the Macro section in the WikiBook. Regarding the > following piece of code, > > `(let [~'frame ~frame] >    (.setTitle ~'frame ~title) >    (.setVisible ~'frame) >    ~'frame) > > I was what the difference might be with re

Re: Macros and syntax-quote

2008-11-20 Thread Meikel Brandmeyer
Hi, On 20 Nov., 12:49, Rock <[EMAIL PROTECTED]> wrote: > Just out of curiosity, do you know where I can find the code for > syntax-quote in the Clojure source? I would like to see how it's > implemented to possibly get a better understaning of it. You may have a look in Clojure's source in the s

Re: Macros and syntax-quote

2008-11-20 Thread Rock
Yeah. Thanks. Very clear. Just out of curiosity, do you know where I can find the code for syntax-quote in the Clojure source? I would like to see how it's implemented to possibly get a better understaning of it. Thanks again. On Nov 20, 12:39 pm, Meikel Brandmeyer <[EMAIL PROTECTED]> wrote: >

Re: Macros and syntax-quote

2008-11-20 Thread Meikel Brandmeyer
Hi, On 20 Nov., 11:29, Rock <[EMAIL PROTECTED]> wrote: > I was what the difference might be with respect to this: > >  `(let [frame ~frame] >    (.setTitle frame ~title) >    (.setVisible frame) >    frame) This won't work, since - assuming you are in namespace user - the backquote will expand t

Macros and syntax-quote

2008-11-20 Thread Rock
I was just reading the Macro section in the WikiBook. Regarding the following piece of code, `(let [~'frame ~frame] (.setTitle ~'frame ~title) (.setVisible ~'frame) ~'frame) I was what the difference might be with respect to this: `(let [frame ~frame] (.setTitle frame ~title) (.

Re: offtopic - where are you come from? (poll)

2008-11-20 Thread Kevin O'Neill
Melbourne, Australia -k. On Thu, Nov 20, 2008 at 6:29 AM, tak <[EMAIL PROTECTED]> wrote: > > Scottsdale, Arizona (USA) > > On Oct 17, 2:27 am, "Rastislav Kassak" <[EMAIL PROTECTED]> wrote: > > Hello Clojurians, > > > > I think after 1st year of Clojure life it's good to check how far has > > Clo

Re: Exact definition of _

2008-11-20 Thread Timothy Pratley
> I didn't find any description of the symbol _ in the Clojure docs. > What is its exact status? Is it an ordinary symbol that is used by > convention for unused arguments? Or is it interpreted in a special > way by the reader or the compiler? Looks like it is just an ordinary symbol used by conv

Re: i'm having a lot of trouble dealing with events.

2008-11-20 Thread Timothy Pratley
> It would seem that stdout is not available from within the proxy when > running from the command line, but it *is* when executing from the > REPL. I'm sure there is a good reason for that, but I find it very > confusing! Anyone care to enlighten me? Actually if I add (read ) to the end of my fi

Exact definition of _

2008-11-20 Thread Konrad Hinsen
I didn't find any description of the symbol _ in the Clojure docs. What is its exact status? Is it an ordinary symbol that is used by convention for unused arguments? Or is it interpreted in a special way by the reader or the compiler? Konrad. --~--~-~--~~~---~

Re: i'm having a lot of trouble dealing with events.

2008-11-20 Thread Timothy Pratley
Thanks for that. It turns out that if I run your code from a REPL everything works great. I was trying to run it from a file... which for some reason throws an exception. clj event.clj Exception in thread "AWT-EventQueue-0" java.io.IOException: Stream closed It would seem that stdout is not ava