Re: using libraries

2008-10-15 Thread Paul Drummond
Of course. Hmmm. And I thought I knew this stuff! :) I think I was getting all confused because I was playing with ns and it doesn't require quoting (because it's a macro). It makes sense now - thanks. Regarding the use of require, am I right in thinking that ns is for library modules and

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 unless I'm

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. --  -asbjxrn

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. Emacs

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 (require

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 Ns. Restated, map takes a function f and N collections, each of which should have the same number of

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

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) (yield

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

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

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:

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

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 Clojure

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

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 larger goals

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

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 PROTECTED]

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 (when

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 first argument is

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: (let [frdr (new

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

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 --~--~-~--~~~---~--~~ You

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 Ns. Restated, map takes a function f and

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: (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 want to do is map a java

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.

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 to

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 destroy

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. Here is

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*

(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

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 (NO_SOURCE_FILE:0)

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: 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 '%' operator). I

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 interested in

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 really want

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

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

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 assoc one

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 some

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 world) (doto

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 something that

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 ranges from [0,

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, i'm from

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 block? e..g

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

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

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= (class (new

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 ideological

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 in general,