Re: using libraries

2008-10-15 Thread Paul Drummond
Hmmm. Now I am getting this: (require 'clojure.contrib.zip-filter :as 'zf) java.lang.ClassCastException: java.lang.Boolean cannot be cast to clojure.lang.Symbol (NO_SOURCE_FILE:0) Any ideas? --~--~-~--~~~---~--~~ You received this message because you are subscrib

Re: using libraries

2008-10-15 Thread mb
Hi, On 15 Okt., 09:22, Paul Drummond <[EMAIL PROTECTED]> wrote: > Hmmm.  Now I am getting this: > > (require 'clojure.contrib.zip-filter :as 'zf) > java.lang.ClassCastException: java.lang.Boolean cannot be cast to > clojure.lang.Symbol (NO_SOURCE_FILE:0) > > Any ideas? You might want to try (req

Re: using libraries

2008-10-15 Thread Stephen C. Gilardi
On Oct 15, 2008, at 5:03 AM, Paul Drummond wrote: > > On Oct 15, 9:34 am, mb <[EMAIL PROTECTED]> wrote: >> You might want to try (require ['clojure.contrib.zip-filter :as >> 'zf]). >> AFAIR, you have to use [] when you want to specify :as. > > Ah, that's it! This isn't clear (or mentioned unl

Re: using libraries

2008-10-15 Thread Stephen C. Gilardi
On Oct 15, 2008, at 3:22 AM, Paul Drummond wrote: > Hmmm. Now I am getting this: > > (require 'clojure.contrib.zip-filter :as 'zf) > java.lang.ClassCastException: java.lang.Boolean cannot be cast to > clojure.lang.Symbol (NO_SOURCE_FILE:0) > > Any ideas? I've enclosed a patch to boot.clj that

Re: packaging App (cross-platform) without scripts, only jar

2008-10-15 Thread Asbjørn Bjørnstad
On Oct 15, 4:57 am, "R. P. Dillon" <[EMAIL PROTECTED]> wrote: > On Oct 14, 10:04 am, Asbjørn  Bjørnstad <[EMAIL PROTECTED]> wrote: > > > > So it is not possible to put the clj files into the jar so that no > > unzipping > > is neccessary? I tried, but my java/jar knowledge is basically zero. > >

Re: using libraries

2008-10-15 Thread Paul Drummond
On Oct 15, 2:21 pm, "Stephen C. Gilardi" <[EMAIL PROTECTED]> wrote: > Here's the portion of (doc require) where it's mentioned: > > [...] >    Libspecs > >    A libspec is a lib name or a vector containing a lib name followed by >    options expressed as sequential keywords and arguments. > >    R

Re: primitive meta data

2008-10-15 Thread Chouser
On Wed, Oct 15, 2008 at 7:08 AM, Parth Malwankar <[EMAIL PROTECTED]> wrote: > > On Oct 15, 8:34 am, Islon <[EMAIL PROTECTED]> wrote: >> >> (defn dumb-test [] >> (let [#^Float f2 567.09723] >> (loop [#^Float f 1.8, i 1000] >> (if (zero? i) >> f >> (recur (/ f f2) (de

Re: What Windows IDE are you using?

2008-10-15 Thread Fredrik Appelberg
On Mon, Oct 13, 2008 at 8:33 AM, Hans Huebner <[EMAIL PROTECTED]>wrote: > > On Sat, Oct 11, 2008 at 20:34, CuppoJava <[EMAIL PROTECTED]> > wrote: > > If anyone is using Windows, please share what environment you're using > > to program in. > > I am using Emacs and Slime, and that works rather well

Re: emacs-cvs and swank-clojure under os-x 10.4

2008-10-15 Thread Matthew D. Swank
On Oct 15, 6:47 am, "Fredrik Appelberg" <[EMAIL PROTECTED]> wrote: > On Tue, Oct 14, 2008 at 9:49 PM, Matthew D. Swank < > > > > [EMAIL PROTECTED]> wrote: > > > swank-clojure seems to work fine; it just seems that java is ignoring > > 'swank-clojure-extra-classpaths. > > > in slime: > > > user> (r

Re: (map f coll) using memfn

2008-10-15 Thread Jim Menard
On Wed, Oct 15, 2008 at 8:21 AM, I wrote: > map can take more than one argument. If it has N arguments, it calls f > with N arguments, each taken from the Nth value of each collection. Too many "N"s. Restated, map takes a function f and N collections, each of which should have the same number of

Re: primitive meta data

2008-10-15 Thread Rich Hickey
On Oct 15, 11:04 am, Chouser <[EMAIL PROTECTED]> wrote: > On Wed, Oct 15, 2008 at 7:08 AM, Parth Malwankar > > <[EMAIL PROTECTED]> wrote: > > > On Oct 15, 8:34 am, Islon <[EMAIL PROTECTED]> wrote: > > >> (defn dumb-test [] > >> (let [#^Float f2 567.09723] > >> (loop [#^Float f 1.8, i 1

Can't find swank/core/DebugQuitException under rev. 1068

2008-10-15 Thread Matthew D. Swank
Picking the abort restart in the slime debugging window causes an exception: java.lang.NoClassDefFoundError: swank/core/DebugQuitException (NO_SOURCE_FILE:0) [Thrown class clojure.lang.Compiler$CompilerException] Restarts: 0: [ABORT] Return to SLIME's top level. 1: [CAUSE] Throw cause of this

Help writing this Lazy Sequence Macro

2008-10-15 Thread CuppoJava
Hi guys, I'm just wondering if it's possible for the following macro to be written. What's supposed to do is take an arbitrary-form, and create a lazy sequence out of calls to "yield". Here's an example: (lazy-seq (doseq i (range 3) (yield i)) (if true (yield "hello world") (yiel

Re: What Windows IDE are you using?

2008-10-15 Thread Mike Hinchey
I use emacs and slime, also. Has anyone used http://jdee.sourceforge.net/ with Clojure, or even just with Java? -Mike --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send ema

read NPE

2008-10-15 Thread MikeM
In SVN 1067, the following throws an NPE: (let [frdr (new java.io.StringReader "{:a 1}") prdr (new java.io.PushbackReader frdr) eof (new Object)] (read prdr nil eof) ) Using false instead of nil works: (let [frdr (new java.io.StringReader "{:a 1}") prdr (new java.io.Pushb

Re: Help writing this Lazy Sequence Macro

2008-10-15 Thread mb
Hello, On 15 Okt., 17:53, CuppoJava <[EMAIL PROTECTED]> wrote: > What's supposed to do is take an arbitrary-form, and create a lazy > sequence out of calls to "yield". You can construct the inputs in a lazy sequence and then map yield over that: (map yield (lazy-cat (for [i (range 3)]

Re: Refs and ensure

2008-10-15 Thread Rich Hickey
On Oct 14, 10:33 pm, Tom Davies <[EMAIL PROTECTED]> wrote: > In relational database terms, Clojure's STM has 'read-committed' > isolation when you don't use 'ensure', then? No, it's snapshot isolation, which is distinct from all of the traditional isolation levels: http://en.wikipedia.org/wiki/S

Re: packaging App (cross-platform) without scripts, only jar

2008-10-15 Thread R. P. Dillon
> Cool, thanks. That worked (http://jalat.com/static-files/ > Is it possible to have a subdirectory in the classpath > as well, or does everything have to be from the root? (Ie. Could > clojure have been in a subdirectory lib and classpath have been set to > ". lib/"?) > I tried that but it seems

Re: Help writing this Lazy Sequence Macro

2008-10-15 Thread CuppoJava
Hi Meikel, That solution will work for this simple case, but my goal is to make it possible to create lazy-sequences in a more straight-forward manner. So that we can use the usual sequence functions (doseq, dorun, loop) instead of the lazy-equivalents (for). Is what I'm asking for impossible? --~

Re: Refs and ensure

2008-10-15 Thread Tom Davies
In relational database terms, Clojure's STM has 'read-committed' isolation when you don't use 'ensure', then? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to cloj

Re: Help writing this Lazy Sequence Macro

2008-10-15 Thread Rich Hickey
On Oct 15, 12:33 pm, CuppoJava <[EMAIL PROTECTED]> wrote: > Hi Meikel, > That solution will work for this simple case, but my goal is to make > it possible to create lazy-sequences in a more straight-forward > manner. So that we can use the usual sequence functions (doseq, dorun, > loop) instead

Re: emacs-cvs and swank-clojure under os-x 10.4

2008-10-15 Thread Fredrik Appelberg
On Tue, Oct 14, 2008 at 9:49 PM, Matthew D. Swank < [EMAIL PROTECTED]> wrote: > > swank-clojure seems to work fine; it just seems that java is ignoring > 'swank-clojure-extra-classpaths. > > in slime: > > user> (require 'clojure.contrib.zip-filter) > java.io.FileNotFoundException: Could not locate

Re: Help writing this Lazy Sequence Macro

2008-10-15 Thread mb
Hi, On 15 Okt., 18:33, CuppoJava <[EMAIL PROTECTED]> wrote: > That solution will work for this simple case, but my goal is to make > it possible to create lazy-sequences in a more straight-forward > manner. So that we can use the usual sequence functions (doseq, > dorun, loop) instead of the lazy

Re: is clojure known to work on any phones with javame?

2008-10-15 Thread Michel Salim
A related question would be: does it work on Android? Thanks, -- Michel Salim On Oct 15, 12:46 am, "Kevin Downey" <[EMAIL PROTECTED]> wrote: > I am in the market for a phone and it would be so cool to have clojure > on it. Has anyone tried this yet? > > -- > The Mafia way is that we pursue larg

primitive meta data

2008-10-15 Thread Islon
Hi. I've made a dumb (very dumb) performance comparison function just to play with the language. I wanted to mark some symbols with a float primitive type but the compiler complained so I had to annotate it with the Float class. Here is the function: (defn dumb-test [] (let [#^Float f2 567.0972

Re: emacs-cvs and swank-clojure under os-x 10.4

2008-10-15 Thread Fredrik Appelberg
On Wed, Oct 15, 2008 at 5:26 PM, Matthew D. Swank < [EMAIL PROTECTED]> wrote: > > > Yeah, I had som problems with this as well. As far as I can tell, my > problem > > was that swank-clojure-extra-classpaths defaulted to '~/.clojure/*', but > the > > ability to specify wildcards in the classpath wa

Re: primitive meta data

2008-10-15 Thread Islon
Thanks for the advices. The unchecked version run as fast as java. Before I go solve some interesting problem I have to learn the language ;) Thanks anyway. On Wed, Oct 15, 2008 at 12:04 PM, Chouser <[EMAIL PROTECTED]> wrote: > > On Wed, Oct 15, 2008 at 7:08 AM, Parth Malwankar > <[EMAIL PROTECTE

Re: Suggest changing update-in to accept additional args for "f"

2008-10-15 Thread Rich Hickey
On Mon, Oct 13, 2008 at 11:02 AM, Stephen C. Gilardi <[EMAIL PROTECTED]> wrote: > > I've enclosed a modified definition of update-in that allows the > update function "f" to take arguments in addition to "old" value being > updated. The new definition does everything the old definition does > (whe

Re: (map f coll) using memfn

2008-10-15 Thread Graham Fawcett
On Wed, Oct 15, 2008 at 8:21 AM, Jim Menard <[EMAIL PROTECTED]> wrote: > > On Wed, Oct 15, 2008 at 7:46 AM, Timothy Pratley > <[EMAIL PROTECTED]> wrote: >> >> Can I get some help with (map f coll)... >> >> What I want to do is map a java function that takes 2 arguments over a >> list >> where the

Re: read NPE

2008-10-15 Thread Rich Hickey
On Oct 15, 12:14 pm, MikeM <[EMAIL PROTECTED]> wrote: > In SVN 1067, the following throws an NPE: > > (let [frdr (new java.io.StringReader "{:a 1}") > prdr (new java.io.PushbackReader frdr) > eof (new Object)] >(read prdr nil eof) > ) > > Using false instead of nil works: > > (

Re: Help writing this Lazy Sequence Macro

2008-10-15 Thread CuppoJava
Thanks for replying Rich and Meikel, I'm trying to use this macro to port a game-framework that I've written in Ruby, to Clojure. Essentially, I just need the ability to spawn an extremely large amount (~1) of light-weight threads. My framework takes care of sequencing them in the right order

Re: are pr & friends correct for regexps?

2008-10-15 Thread Stuart Halloway
Yep, I was on an older build. Nevermind. :-) > On Mon, Oct 13, 2008 at 9:06 AM, Stuart Halloway > <[EMAIL PROTECTED]> wrote: >> >> (prn #"\\w+") >> -> \w+ > > Works for me, SVN 1067: > user=> #"\\w+" > #"\\w+" > user=> (prn #"\\w+") > #"\\w+" > nil > > --Chouser > --~--~-~--~~---

Re: (map f coll) using memfn

2008-10-15 Thread Rich Hickey
On Oct 15, 11:26 am, "Jim Menard" <[EMAIL PROTECTED]> wrote: > On Wed, Oct 15, 2008 at 8:21 AM, I wrote: > > map can take more than one argument. If it has N arguments, it calls f > > with N arguments, each taken from the Nth value of each collection. > > Too many "N"s. Restated, map takes a fun

Re: Help writing this Lazy Sequence Macro

2008-10-15 Thread Rich Hickey
On Oct 15, 1:11 pm, CuppoJava <[EMAIL PROTECTED]> wrote: > Thanks for replying Rich and Meikel, > I'm trying to use this macro to port a game-framework that I've > written in Ruby, to Clojure. > > Essentially, I just need the ability to spawn an extremely large > amount (~1) of light-weight

Re: using libraries

2008-10-15 Thread Paul Drummond
On Oct 15, 9:34 am, mb <[EMAIL PROTECTED]> wrote: > You might want to try (require ['clojure.contrib.zip-filter :as 'zf]). > AFAIR, you have to use [] when you want to specify :as. Ah, that's it! This isn't clear (or mentioned unless I'm mistaken) in the docs. Thanks for your help. Paul. --~--

Re: (map f coll) using memfn

2008-10-15 Thread Jim Menard
On Wed, Oct 15, 2008 at 1:09 PM, Graham Fawcett <[EMAIL PROTECTED]> wrote: > > On Wed, Oct 15, 2008 at 8:21 AM, Jim Menard <[EMAIL PROTECTED]> wrote: >> >> On Wed, Oct 15, 2008 at 7:46 AM, Timothy Pratley >> <[EMAIL PROTECTED]> wrote: >>> >>> Can I get some help with (map f coll)... >>> >>> What I

Re: Making a living on Clojure

2008-10-15 Thread Chance
Have any of you had a look at the Commercial Users of Functional Programming (CUFP) group? They are not specific to Clojure, but are people who have been working on making the business case for functional languages like clojure. They would probably be interested in this discussion. http://group

Re: Help writing this Lazy Sequence Macro

2008-10-15 Thread mb
Hi, On 15 Okt., 19:11, CuppoJava <[EMAIL PROTECTED]> wrote: > I'm trying to use this macro to port a game-framework that I've > written in Ruby, to Clojure. > ... > Do you guys have any ideas? Or a direction that I might consider > looking in? I can only offer a general advice: Don't stick

Re: (map f coll) using memfn

2008-10-15 Thread mb
Hi, On 15 Okt., 19:09, "Graham Fawcett" <[EMAIL PROTECTED]> wrote: > > (map f coll (range (count coll))) > > Rather than (range (count coll)), I would use (iterate inc 0), which > incurs no overhead for counting the argument. There is not only the overhead of counting, (count coll) might also d

Re: primitive meta data

2008-10-15 Thread Parth Malwankar
On Oct 15, 8:34 am, Islon <[EMAIL PROTECTED]> wrote: > Hi. > > I've made a dumb (very dumb) performance comparison function just to play > with the language. > I wanted to mark some symbols with a float primitive type but the compiler > complained so I had to annotate it with the Float class. >

Re: using libraries

2008-10-15 Thread Paul Drummond
It's funny how things suddenly click. While out for a run (the only time I seem to be able find clarity it seems) I started thinking that it would be nice to have macros for "require" and "use" so that you don't have to worry about quoting then I realized that's exactly what ns is for! I *should

Re: Can't find swank/core/DebugQuitException under rev. 1068

2008-10-15 Thread Matthew D. Swank
On Oct 15, 10:45 am, "Matthew D. Swank" <[EMAIL PROTECTED]> wrote: > Picking the abort restart in the slime debugging window causes an > exception: > java.lang.NoClassDefFoundError: swank/core/DebugQuitException > (NO_SOURCE_FILE:0) >   [Thrown class clojure.lang.Compiler$CompilerException] > > Re

Re: What Windows IDE are you using?

2008-10-15 Thread Paul Drummond
On Oct 15, 5:05 pm, Mike Hinchey <[EMAIL PROTECTED]> wrote: > I use emacs and slime, also.  Has anyone used http://jdee.sourceforge.net/ > with Clojure, or even just with Java? > I tried to get it working in Java a while back but failed miserably - I can't really remember exactly what the problem

Re: Preliminary AOT support and swank-clojure startup times

2008-10-15 Thread Matthew D. Swank
On Oct 14, 6:35 pm, "Matthew D. Swank" <[EMAIL PROTECTED]> wrote: > On Oct 14, 4:48 pm, Randall R Schulz <[EMAIL PROTECTED]> wrote: > > > > > On Tuesday 14 October 2008 14:17, Matthew D. Swank wrote: > > > > Just a data-point: > > > OS: Windows-XP > > > CPU: Pentium-IV 2.8 Ghz > > > Mem: 504 MB

(map f coll) using memfn

2008-10-15 Thread Timothy Pratley
Can I get some help with (map f coll)... What I want to do is map a java function that takes 2 arguments over a list where the first argument is the index into the list itself and the second argument is taken from the list The problem being map uses a function of 1 argument. Does that mean I nee

Re: Can't find swank/core/DebugQuitException under rev. 1068

2008-10-15 Thread Rich Hickey
On Oct 15, 2:22 pm, "Matthew D. Swank" <[EMAIL PROTECTED]> wrote: > On Oct 15, 10:45 am, "Matthew D. Swank" <[EMAIL PROTECTED]> > wrote: > > > > > Picking the abort restart in the slime debugging window causes an > > exception: > > java.lang.NoClassDefFoundError: swank/core/DebugQuitException >

Re: What Windows IDE are you using?

2008-10-15 Thread Fredrik Appelberg
On Wed, Oct 15, 2008 at 6:05 PM, Mike Hinchey <[EMAIL PROTECTED]> wrote: > > I use emacs and slime, also. Has anyone used http://jdee.sourceforge.net/ > with Clojure, or even just with Java? > I've made a few attempts to get going with JDEE, but never really got off the ground. It has *tons* of

Re: (map f coll) using memfn

2008-10-15 Thread Jim Menard
On Wed, Oct 15, 2008 at 7:46 AM, Timothy Pratley <[EMAIL PROTECTED]> wrote: > > Can I get some help with (map f coll)... > > What I want to do is map a java function that takes 2 arguments over a > list > where the first argument is the index into the list itself > and the second argument is taken

Re: What Windows IDE are you using?

2008-10-15 Thread Dmitri P
I followed Hans's instructions and was able to use compojure's repl script as swank-clojure-binary. Also, I don't use jline on windows because cmd provides sufficient editing facilities. I found that swing JFrame displayed through setVisible hangs slime, it probably needs a thread wrapper. On Oc

remainder function

2008-10-15 Thread Islon
Is there a remainder (rest of the division) function in closure? (as java '%' operator). I browse the docs but couldn't find one. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group,

Re: remainder function

2008-10-15 Thread Achim Passen
Hi, Am 15.10.2008 um 23:35 schrieb Islon: > Is there a remainder (rest of the division) function in closure? (as > java '%' operator). > I browse the docs but couldn't find one. clojure/rem ([num div]) rem[ainder] of dividing numerator by denominator. I ran into the same problem some time

Re: remainder function

2008-10-15 Thread Brian Doyle
The function is 'rem'. user=> (rem 5 2) 1 On Wed, Oct 15, 2008 at 3:35 PM, Islon <[EMAIL PROTECTED]> wrote: > Is there a remainder (rest of the division) function in closure? (as java > '%' operator). > I browse the docs but couldn't find one. > > > > --~--~-~--~~~-

Re: remainder function

2008-10-15 Thread Islon
Same problem for me. I didn't know there's a find-doc function, thanks! Regards On Wed, Oct 15, 2008 at 6:44 PM, Achim Passen <[EMAIL PROTECTED]>wrote: > > Hi, > > Am 15.10.2008 um 23:35 schrieb Islon: > > > Is there a remainder (rest of the division) function in closure? (as > > java '%' operat

Re: remainder function

2008-10-15 Thread Rich Hickey
On Oct 15, 5:44 pm, Achim Passen <[EMAIL PROTECTED]> wrote: > Hi, > > Am 15.10.2008 um 23:35 schrieb Islon: > > > Is there a remainder (rest of the division) function in closure? (as > > java '%' operator). > > I browse the docs but couldn't find one. > > clojure/rem > ([num div]) >rem[ainde

Re: Asking for Permission

2008-10-15 Thread Rich Hickey
On Oct 14, 1:05 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > hello,rich, > > i'm from china, i found content in your Clojure web is thoughtful > and attractive, i wanna translate it to chinese, > > it will be helpful for learning Clojure by myself, also for other > chinese interest

Re: regex literal syntax

2008-10-15 Thread Rich Hickey
On Oct 10, 5:02 pm, Chouser <[EMAIL PROTECTED]> wrote: > On Fri, Oct 10, 2008 at 7:48 AM, Chouser <[EMAIL PROTECTED]> wrote: > > > Of course that means I need to do this for you when printing... > > I've attached an updated patch with a new print method, against the > latest SVN 1058. > > If you

Re: regex literal syntax

2008-10-15 Thread Chouser
On Wed, Oct 15, 2008 at 7:12 PM, Rich Hickey <[EMAIL PROTECTED]> wrote: > > Patch applied - SVN rev 1070 - thanks! Possible reader docs: Regex patterns (#"pattern") A regex pattern is read and compiled at read time. The pattern is passed directly to the java.util.regex.Pattern compile method, so

Re: Help writing this Lazy Sequence Macro

2008-10-15 Thread CuppoJava
Mmm, this is really mind-bending. Particularly because it's a game framework, so the state changes with time. Thinking about it from a functional programming perspective takes some thinking. Rich, Agents seem capable of doing some amazing things. Is there a way to implement a light-weight threadi

Documentation bug: assoc

2008-10-15 Thread Michel Salim
The documentation for assoc (both using find-doc and on the website) stipulates that the index must be <= (count col). This is incorrect, though, since index ranges from [0, (count col)) ? Thanks, -- Michel Salim --~--~-~--~~~---~--~~ You received this message bec

Re: Documentation bug: assoc

2008-10-15 Thread Rich Hickey
On Oct 15, 8:14 pm, Michel Salim <[EMAIL PROTECTED]> wrote: > The documentation for assoc (both using find-doc and on the website) > stipulates that the index must be <= (count col). This is incorrect, > though, since index ranges from [0, (count col)) ? > No, the docs are correct - you can ass

Re: Help writing this Lazy Sequence Macro

2008-10-15 Thread Rich Hickey
On Oct 15, 7:53 pm, CuppoJava <[EMAIL PROTECTED]> wrote: > Mmm, this is really mind-bending. Particularly because it's a game > framework, so the state changes with time. Thinking about it from a > functional programming perspective takes some thinking. > > Rich, Agents seem capable of doing som

Re: splat operator

2008-10-15 Thread Martin DeMello
On Oct 15, 5:49 pm, Martin DeMello <[EMAIL PROTECTED]> wrote: > Is there any sort of "splat" operator that expands a list into an > inline sequence of arguments? Failing that, is there any way to use > apply within a doto block? > > e..g > > (def search-replace '("ll" "") > (def target "hello worl

splat operator

2008-10-15 Thread Martin DeMello
Is there any sort of "splat" operator that expands a list into an inline sequence of arguments? Failing that, is there any way to use apply within a doto block? e..g (def search-replace '("ll" "") (def target "hello world") (doto target ;(apply replace search-replace) <-- that, except somethi

Re: Help writing this Lazy Sequence Macro

2008-10-15 Thread CuppoJava
I just found your ants demo Rich. It looks amazingly concise. Just a quick question: What does the # symbol do? ie. what's happening here? ( #(println "hi") ) is # short for: (fn [] ( ... )) ? --~--~-~--~~~---~--~~ You received this message because you are subsc

Re: Documentation bug: assoc

2008-10-15 Thread Michel Salim
On Oct 15, 8:38 pm, Rich Hickey <[EMAIL PROTECTED]> wrote: > On Oct 15, 8:14 pm, Michel Salim <[EMAIL PROTECTED]> wrote: > > > The documentation for assoc (both using find-doc and on the website) > > stipulates that the index must be <= (count col). This is incorrect, > > though, since index ran

Re: Asking for Permission

2008-10-15 Thread [EMAIL PROTECTED]
Rich,thanks, After i finish my translating work, I will contact you to see whether it fit on your web. But i hope so :) Best regards Gerry On Oct 16, 6:55 am, Rich Hickey <[EMAIL PROTECTED]> wrote: > On Oct 14, 1:05 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > > > hello,rich, > > >

Re: splat operator

2008-10-15 Thread Michel Salim
On Oct 15, 9:08 pm, Martin DeMello <[EMAIL PROTECTED]> wrote: > On Oct 15, 5:49 pm, Martin DeMello <[EMAIL PROTECTED]> wrote: > > > Is there any sort of "splat" operator that expands a list into an > > inline sequence of arguments? Failing that, is there any way to use > > apply within a doto bl

Re: Help writing this Lazy Sequence Macro

2008-10-15 Thread Rich Hickey
On Oct 15, 10:31 pm, CuppoJava <[EMAIL PROTECTED]> wrote: > I just found your ants demo Rich. It looks amazingly concise. > > Just a quick question: What does the # symbol do? > > ie. what's happening here? > > ( #(println "hi") ) > > is # short for: (fn [] ( ... )) ? Yes, #(...) => (fn [args]

Can macros be used for blunt token-pasting?

2008-10-15 Thread Tom Lynch
Hi all, I have a naive question regarding Clojure macros. As someone new to Lisp-style macros, can I use the system to generate new names using substitution / token-pasting? Conceptually something like (defmacro paste-tokens [first second] `(def ~first~second [])) so that (paste-tokens foo ba

Re: splat operator

2008-10-15 Thread Michel Salim
On Oct 15, 9:08 pm, Martin DeMello <[EMAIL PROTECTED]> wrote: > On Oct 15, 5:49 pm, Martin DeMello <[EMAIL PROTECTED]> wrote: > > > Is there any sort of "splat" operator that expands a list into an > > inline sequence of arguments? Failing that, is there any way to use > > apply within a doto bl

Re: (map f coll) using memfn

2008-10-15 Thread Timothy Pratley
Thanks so much for all the replies, that showed the way to what I wanted (simplified example using substring): (defn lazy-self [me] ((fn rfib [a] (lazy-cons a (rfib a))) me)) (defmacro map-obj [jobj jmeth argbinds & colls] `(map (memfn ~jmeth [EMAIL PROTECTED]) (lazy-self ~jobj) [EMAIL PROTEC

toUpperCase on java.lang.String

2008-10-15 Thread Parth Malwankar
Calling a java method on a string directly works. user=> (.toUpperCase "hello") "HELLO" user=> (class "hello") #=java.lang.String But if I do this in a doto, it doesn't seem to work but I don't get any error message. user=> (doto (new java.lang.String "hello") (toUpperCase)) "hello" user=> (cla

Re: toUpperCase on java.lang.String

2008-10-15 Thread Chouser
On Wed, Oct 15, 2008 at 11:20 PM, Parth Malwankar <[EMAIL PROTECTED]> wrote: > > But if I do this in a doto, it doesn't seem to work but > I don't get any error message. > > user=> (doto (new java.lang.String "hello") (toUpperCase)) > "hello" > user=> (class (new java.lang.String)) > #=java.lang.S

Re: toUpperCase on java.lang.String

2008-10-15 Thread Stephen C. Gilardi
Hi Parth, > But if I do this in a doto, it doesn't seem to work but > I don't get any error message. > > user=> (doto (new java.lang.String "hello") (toUpperCase)) > "hello" > user=> (class (new java.lang.String)) > #=java.lang.String > > Shouldn't this be working? If this is (by design) because

Re: Can macros be used for blunt token-pasting?

2008-10-15 Thread Chouser
On Wed, Oct 15, 2008 at 10:02 PM, Tom Lynch <[EMAIL PROTECTED]> wrote: > > Hi all, I have a naive question regarding Clojure macros. As someone > new to Lisp-style macros, can I use the system to generate new names > using substitution / token-pasting? [snip] > I realise this may be a huge ideol

Re: Can macros be used for blunt token-pasting?

2008-10-15 Thread Asbjørn Bjørnstad
On Oct 16, 10:02 am, Tom Lynch <[EMAIL PROTECTED]> wrote: > Hi all, I have a naive question regarding Clojure macros.  As someone > new to Lisp-style macros, can I use the system to generate new names > using substitution / token-pasting? > > Conceptually something like > > (defmacro paste-token

Re: Can macros be used for blunt token-pasting?

2008-10-15 Thread Tom Lynch
Ah, thanks -- it was the ability of the symbol call to generate a new sym from a string that I was missing. On Oct 16, 2:03 pm, Asbjørn Bjørnstad <[EMAIL PROTECTED]> wrote: > Why would it be? Code generation is a ideological yes-yes > in lisps. No idea. I was just vaguely aware of Strong Opini

Re: splat operator

2008-10-15 Thread Martin DeMello
On Oct 15, 8:07 pm, Michel Salim <[EMAIL PROTECTED]> wrote: > > Ah, so to clarify, you need some way to say > > (. "hello" (replace \l \m)) > > but if \l and \m are given in a list, rather than as two separate > things? Sounds like you might need to write a function to do that. Yes, apply works i

Re: Help writing this Lazy Sequence Macro

2008-10-15 Thread CuppoJava
Thanks again Rich. Another question about agents. I understand that the actions are executed automatically by the thread pool. Is there any manual way to schedule the actions to agents, in case I need some manual control? --~--~-~--~~~---~--~~ You received this mes

Re: Can macros be used for blunt token-pasting?

2008-10-15 Thread Mike Hinchey
On Oct 15, 9:12 pm, Tom Lynch <[EMAIL PROTECTED]> wrote: > On Oct 16, 2:03 pm, Asbjørn  Bjørnstad <[EMAIL PROTECTED]> wrote: > > > Why would it be? Code generation is a ideological yes-yes > > in lisps. > > No idea.  I was just vaguely aware of Strong Opinions floating around > on topics such as t

Re: toUpperCase on java.lang.String

2008-10-15 Thread Timothy Pratley
Oh wow, powerful syntax! > user=> (-> "hello" .toUpperCase (.replace "H" "J")) > "JELLO" > .. would also work, but I pretty much always prefer -> because you can > mix in non-methods, and the methods are clearly indicated with a > leading dot.  In fact, I could imagine lobbying to have .. remove

Re: (map f coll) using memfn

2008-10-15 Thread mb
Hi, On 16 Okt., 05:13, Timothy Pratley <[EMAIL PROTECTED]> wrote: > Just a few follow on questions... > 1) Is there any way to do away with the input bindings altogether? map > doesn't need input bindings, but memfn does. I don't quite grasp why > they are needed for memfn, or how to construct an