Observing namespace changes

2009-01-14 Thread lpetit
Hello, Is it possible for my code to subscribe to events of type namespace change which would inform of deltas on top level namespaces : - added symbol - removed symbol - changed root var binding of a symbol Indeed, I'm currently implementing a little namespace browser View for clojuredev

*1 *2 isn't working properly

2009-01-14 Thread HB
Hey, I'm trying to run my first Clojure example user= (defn hello [name] (str Cool! name)) #'user/hello user= (hello Google) Cool! Google user= (hello Wicket) Cool! Wicket user= (str *1) Cool! Wicket user= (str *2) Cool! Wicket Isn't (str *2) supposed to return Cool! Google ? Environment:

Re: *1 *2 isn't working properly

2009-01-14 Thread Brian Doyle
Here's an example of *1 *2 *3 1:1 user= (str gavin) gavin 1:2 user= (str teri) teri 1:3 user= (str brian) brian 1:4 user= (str-join [*1 *2 *3]) brian teri gavin On Wed, Jan 14, 2009 at 2:29 AM, Stephen C. Gilardi squee...@mac.comwrote: By the time you evaluated *2, the second most recent

Re: *1 *2 isn't working properly

2009-01-14 Thread HB
I didn't get you, would you please hold my hand and walking me as you explain line by line what is happening in my code? On Jan 14, 11:29 am, Stephen C. Gilardi squee...@mac.com wrote: By the time you evaluated *2, the second most recent result was what   it showed you. All top level

question about understanding/exploring agents

2009-01-14 Thread bOR_
Hi all. I am trying to figure out what the effect of the agent-function is on the efficiency of concurrency. Here is something I do not really understand. I've a fibonacci function and a simple multiplication, both are wrapped in their respective dotimes 100k loop. However, on this 4core

Re: *1 *2 isn't working properly

2009-01-14 Thread Martin Wood-Mitrovski
On Wed, 14 Jan 2009 02:47:23 -0800 (PST) HB hubaghd...@gmail.com wrote: I didn't get you, would you please hold my hand and walking me as you explain line by line what is happening in my code? the simple way to work it out is to count up from where you are running the code, so if you use

Can't get clojure or clojure.contrib via SVN over https

2009-01-14 Thread Paul Drummond
Hi all, I realised today that my work machine still has the old Sourceforge version of clojure-contrib but when I try to get the latest version from google-code it falls over - most likely due to a proxy: svn checkout http://clojure-contrib.googlecode.com/svn/trunk/clojure-contrib svn: REPORT

Re: *1 *2 isn't working properly

2009-01-14 Thread HB
Lets say that the result of each method invocation will be saved in a stack. The stack now contains, Google and Wicket When I run (str *1) , I will get the last item in the stack which it is Wicket and the result of the method invocation iteself (which it is also Wicket) will be pushed into the

Re: *1 *2 isn't working properly

2009-01-14 Thread Martin Wood-Mitrovski
On Wed, 14 Jan 2009 04:15:18 -0800 (PST) HB hubaghd...@gmail.com wrote: Lets say that the result of each method invocation will be saved in a stack. The stack now contains, Google and Wicket When I run (str *1) , I will get the last item in the stack which it is Wicket and the result of

Re: detecting running as script

2009-01-14 Thread Grunde
Hi all, I managed to make this work by first making a clj script as instructed here: http://en.wikibooks.org/wiki/Clojure_Programming/Getting_Started (thanks, great stuff!) But there is still one small thing: Is there an elegant way to unwrap the passed command line arguments? And is there any

Re: *1 *2 isn't working properly

2009-01-14 Thread e
is that just for fun or can it be used in programs? HB, how'd you even learn about that so fast? do I suck at reading? On Wed, Jan 14, 2009 at 7:20 AM, Martin Wood-Mitrovski marvot...@gmail.comwrote: On Wed, 14 Jan 2009 04:15:18 -0800 (PST) HB hubaghd...@gmail.com wrote: Lets say that

Re: *1 *2 isn't working properly

2009-01-14 Thread HB
is that just for fun or can it be used in programs? Consider it a shenanigan :) HB, how'd you even learn about that so fast? do I suck at reading? I'm reading the beta version of Programming Clojure ; Am I doing fine Stu? :D On Jan 14, 2:31 pm, e evier...@gmail.com wrote: is that just for

Re: detecting running as script

2009-01-14 Thread Grunde
Hi folks, I'm almost there. My small script: -- #! /usr/bin/env clj (defn somefunc [ args] (println somefunc! args)) (defn main [ args] (somefunc args)) ; Only run the application automatically if run as a script, ; not if loaded in a REPL with load-file. (when *command-line-args*

Re: Patch: Arbitrary Symbols between ||

2009-01-14 Thread Rich Hickey
On Jan 13, 4:56 pm, Robert Pfeiffer pfeiffer.rob...@googlemail.com wrote: Hello everybody, this patch implements a pipe-delimited syntax for symbols. The Reader parses |this symbol| and one symbol. Symbols containing clojure syntax are printed in this form, so they can be printed and read

Re: Can't get clojure or clojure.contrib via SVN over https

2009-01-14 Thread Paul Drummond
2009/1/14 Mark Feeney mark.fee...@gmail.com (no /clojure-contrib on the end of the URL now) Thanks for your reply Mark but I don't get what you mean. Can you elaborate? You say no /clojure-contrib on the end of the URL but it's not on there anyway. The url is exactly as it is on the

Re: Can't get clojure or clojure.contrib via SVN over https

2009-01-14 Thread Mark Feeney
I was just referring to the svn command you posted in your original message: svn checkout http://clojure-contrib.googlecode.com/svn/trunk/clojure-contrib What it should be is: svn checkout http://clojure-contrib.googlecode.com/svn/trunk/ clojure- contrib (note the space at the end before

Re: Patch: Arbitrary Symbols between ||

2009-01-14 Thread Christian Vest Hansen
On Wed, Jan 14, 2009 at 1:59 PM, Rich Hickey richhic...@gmail.com wrote: I am interested in symbols with arbitrary names, Why is this interesting? -- Venlig hilsen / Kind regards, Christian Vest Hansen. --~--~-~--~~~---~--~~ You received this message because

Re: IntelliJ Plugin

2009-01-14 Thread Peter Wolf
Hi Aria, Actually, I am just in the process of writing up the install instructions. Watch this space! aria42 wrote: Did you ever get around to posting the notes on getting the IntelliJ plugin to work? I sorely would love IDE support for Clojure in either Eclipse or IntelliJ. Is the

Re: Can't get clojure or clojure.contrib via SVN over https

2009-01-14 Thread Rich Hickey
On Jan 14, 8:44 am, Mark Feeney mark.fee...@gmail.com wrote: I was just referring to the svn command you posted in your original message: svn checkouthttp://clojure-contrib.googlecode.com/svn/trunk/clojure-contrib What it should be is: svn

Re: Can't get clojure or clojure.contrib via SVN over https

2009-01-14 Thread Paul Drummond
2009/1/14 Rich Hickey richhic...@gmail.com I think the salient difference is http, not https, for non-members. Hi Rich, The point is that I could use https on Sourceforge to get around the proxy issue. I've had the same problem before when using SVN for Clojure (sourceforge) and assembla (a

Re: when performance matters

2009-01-14 Thread Rich Hickey
For those interested in numeric performance, Clojure lets you use arrays of primitives, has primitive math support, primitive local support, and has higher-level macros for dealing with them (amap, areduce) which can also serve as models for your own. You can also use :inline to wrap arithmetic

How To Load Source File

2009-01-14 Thread Onorio Catenacci
Hi all, I'm new to Clojure and new to Lisp but not new to software development. And I feel very dumb for having to ask what seems like a very noob question but I can't seem to figure this out. If I want to load a source file into REPL it seems that I should be able to do this: (load-file

Re: How To Load Source File

2009-01-14 Thread Tom Ayerst
This works for me in every configuration I could think of (at worst I get java.io.FileNotFoundException). Are you running a plain cmd prompt? (not MSys or cygwin) How did you launch clj? Rgds. Tom 2009/1/14 Onorio Catenacci catena...@gmail.com Hi all, I'm new to Clojure and new to

Re: when performance matters

2009-01-14 Thread Peter Wolf
Rich, I must apologize-- I worded my question *far* too harshly. I knew it as I pushed the send button. I am a huge fan of Clojure, and plan to use it as often as possible. My question was really looking for hints, so that I can use it in more places. You gave me a great one, thanks! Is

Re: IntelliJ Plugin

2009-01-14 Thread HB
I'm an IntelliJ 8 user and I can test the plugin on my own machine if this helps the plugin's development. On Jan 14, 3:52 pm, Peter Wolf opus...@gmail.com wrote: Hi Aria, Actually, I am just in the process of writing up the install instructions.  Watch this space! aria42 wrote: Did you

Re: How To Load Source File

2009-01-14 Thread Onorio Catenacci
On Jan 14, 9:56 am, Tom Ayerst tom.aye...@gmail.com wrote: This works for me in every configuration I could think of (at worst I get java.io.FileNotFoundException).   Are you running a plain cmd prompt? (not MSys or cygwin)   How did you launch clj? Hi Tom, Thanks for the response. I'm

Re: Trying to define next-agent function

2009-01-14 Thread Justin Johnson
I found my problem. I wasn't calling agents. I was doing this. = (defn next-agent [] (nth agents (next-counter))) and should have been doing this. = (defn next-agent [] (nth (agents) (next-counter))) Still, I would like feedback. Is there a cleaner way to do this? Thanks. Justin On Wed,

Re: Can't get clojure or clojure.contrib via SVN over https

2009-01-14 Thread Cosmin Stejerean
On Wed, Jan 14, 2009 at 8:16 AM, Paul Drummond paul.drumm...@iode.co.ukwrote: 2009/1/14 Rich Hickey richhic...@gmail.com I think the salient difference is http, not https, for non-members. Hi Rich, The point is that I could use https on Sourceforge to get around the proxy issue. I've

Re: How To Load Source File

2009-01-14 Thread Greg Harman
For more than just experimentation with one file, you might also want to look into lib packaging so that you can 'require' or 'use' rather than have to go down to the level of 'load' or 'load-file'. Quick summary, if your file has namespace foo.bar then package it in file / foo/bar.clj (relative

Re: Patch: Arbitrary Symbols between ||

2009-01-14 Thread Robert Pfeiffer
On 14 Jan., 13:59, Rich Hickey richhic...@gmail.com wrote: [...] the toString in the patch is quite inefficient. Because symbols are immutable, they could cache the printable representation in an extra field, but this would double the space occupied by them. Second, it would be better not

Re: typo near http://clojure.org/API#toc248

2009-01-14 Thread Chouser
On Mon, Jan 12, 2009 at 10:26 PM, .Bill Smith william.m.sm...@gmail.com wrote: The gen-class documentation at http://clojure.org/API#toc248 has a minor typo: the description of the :state keyword begins at the end of the :factory paragraph instead of beginning a new paragraph. Not a big

Re: How To Load Source File

2009-01-14 Thread Tom Ayerst
Glad to help. If you haven't found it yet the wiki is very helpful, especialyy: http://en.wikibooks.org/wiki/Clojure_Programming/Getting_Started If you want to spend some money Stuart Halloway's book is excellent http://www.pragprog.com/titles/shcloj/programming-clojure Cheers Tom 2009/1/14

Re: Designing a Performance Vector Math library in Clojure.

2009-01-14 Thread Chouser
On Tue, Jan 13, 2009 at 5:54 PM, Timothy Pratley timothyprat...@gmail.com wrote: I'm not sure how to cpu frequency set to not change or how significant that is on my results. I was afraid that was too vague a reference, sorry. My laptop usually slows down the CPU when its idle or nearly so.

Re: when performance matters

2009-01-14 Thread Asbjørn Bjørnstad
On Jan 14, 12:20 pm, Mark H. mark.hoem...@gmail.com wrote: I humbly propose that folks shouldn't complain about Clojure being slow for their apps until they have at least one of the following: 1. A targeted benchmark for an important bottleneck in their application, implemented in both

newbie question!!

2009-01-14 Thread wubbie
Hi, Earlier Stuart Sierra replied as follows: Hi Patrick, Here's one way to do it: (defn new-person [name] (ref {:name name, :friends #{}})) (defn are-friends [a b] (dosync (commute a assoc :friends (conj (:friends @a) b)) (commute b assoc :friends (conj (:friends @b) a (def

Re: when performance matters

2009-01-14 Thread Greg Harman
Asbjxrn, One thing that leaps out to me performance-wise is the 3 nested loops (dotimes, dotimes, loop/recur). Whatever's inside the inner loop is getting run a lot of times! General advice about reducing loop depth and computation required inside the innermost loop aside... have you looked at

Re: Observing namespace changes

2009-01-14 Thread MikeM
There's no event mechanism to monitor namespace changes. I accomplish this by taking a snapshot before and after any possible namespace- changing execution, using ns-map. Not as efficient as an event callback, but I haven't had any performance issues (map lookups are plenty fast for me). You can

Re: newbie question!!

2009-01-14 Thread David Nolen
(:name @(first (:friends @bill))) You need to dereference before trying to access name. David --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to

Re: Learning Clojure WikiBook

2009-01-14 Thread Rock
Here's an update on syntax-quote in the WikiBook (Reader Macro section): The most complicated reader macro is syntax-quote, denoted by ` (back- tick). When used on a symbol, syntax-quote is like quote but the symbol is resolved to its fully-qualified name: `meow; (quote cat/meow)

Re: Learning Clojure WikiBook

2009-01-14 Thread Chouser
On Wed, Jan 14, 2009 at 6:07 AM, Rock rocco.ro...@gmail.com wrote: [snip] #^{:ack bar} foo ; (clojure/with-meta foo {:ack bar}) This is not correct, and a common misunderstanding. #^ is not sugar for with-meta. It does not expand into a call to with- meta. They are not equivalent.

Re: detecting running as script

2009-01-14 Thread Chouser
On Wed, Jan 14, 2009 at 5:58 AM, Grunde grunde.lov...@gmail.com wrote: Now, it these some elegant way to parse and use the passed command line arguments in my program? Is there any lib like Ruby/Pythons optparse to assist parsing of command line arguments? There is

Re: newbie question!!

2009-01-14 Thread wubbie
Thanks David. -sun On Jan 14, 11:55 am, David Nolen dnolen.li...@gmail.com wrote: (:name @(first (:friends @bill))) You need to dereference before trying to access name. David --~--~-~--~~~---~--~~ You received this message because you are subscribed to the

Re: Learning Clojure WikiBook

2009-01-14 Thread Rock
On 14 Gen, 17:58, Chouser chou...@gmail.com wrote: On Wed, Jan 14, 2009 at 6:07 AM, Rock rocco.ro...@gmail.com wrote: [snip] #^{:ack bar} foo      ; (clojure/with-meta foo {:ack bar}) This is not correct, and a common misunderstanding. #^ is not sugar for with-meta. It does not expand

Is there any way to dereference %1 %2 etc?

2009-01-14 Thread wubbie
(map #(println %) [1 2 3 4]) prints 1 2 3 and 4 But what if the vector element is a hash with [ {:a 1 :b 11} {:a 2 :b 22} {:a 3 :b 33}]? can we dereference :a using %1, like (:a %1)? If not, any alternative? maybe destructuring or something? thanks -sun

Re: How To Load Source File

2009-01-14 Thread Onorio Catenacci
On Jan 14, 10:50 am, Greg Harman ghar...@gmail.com wrote: For more than just experimentation with one file, you might also want to look into lib packaging so that you can 'require' or 'use' rather than have to go down to the level of 'load' or 'load-file'. Quick summary, if your file has

Re: Delays and their efficiency

2009-01-14 Thread Michael Reid
On Tue, Jan 13, 2009 at 12:39 PM, samppi rbysam...@gmail.com wrote: Recently, I asked how to make a function evaluate its arguments lazily (http://groups.google.com/group/clojure/browse_thread/thread/ cd01ef39c2b62530), and I was given a good solution: use Delay objects (with the delay and

Re: Is there any way to dereference %1 %2 etc?

2009-01-14 Thread Stuart Halloway
It doesn't make sense to mix map and println. If you want side effects, use doseq instead of map: (doseq [{a :a} [ {:a 1 :b 11} {:a 2 :b 22} {:a 3 :b 33}]] (println a)) {:a 1, :b 11} {:a 2, :b 22} {:a 3, :b 33} If you don't want side effects, use str instead of println (you could also use

Expanding args in (fn [ args]...) to actual args, not ArraySeq

2009-01-14 Thread Justin Johnson
Is there a way to have args expanded to the actual arguments, not an ArraySeq? I need the actual args to pass to a multimethod so it knows how to dispatch appropriately. Code similar to this (send-off (next-agent) (fn [v args] (somefn args)) arg1 arg2 arg3) Give me an error like this. ...

Re: Utilities for clojure.contrib?

2009-01-14 Thread Chouser
I also think it's unhelpful for codebases to stray further from the builtin functions than needed, because it makes that code harder to read as well. So I will consider each of these more carefully. My comments below are of course highly influence by my personal experiences using Clojure. I'm

Re: Utilities for clojure.contrib?

2009-01-14 Thread Chouser
On Wed, Jan 14, 2009 at 12:11 AM, GS gsincl...@gmail.com wrote: On Jan 13, 7:17 pm, Nick Vogel voge...@gmail.com wrote: seq returns nil when a collection has no items. According to the documentation for empty?, empty? is the same as (not (seq coll)) so you should use seq for expressing the

Re: Parameterized query with clojure.contrib.sql

2009-01-14 Thread Greg Harman
Steve, Thanks much for your work. The new with-query-results seems to work quite well. Your timing is impeccable with this set of changes: I had just finished hacking out a (much uglier) version of update-values as well. (I'll switch over to using the clojure.contrib.sql versions now for a

Re: Expanding args in (fn [ args]...) to actual args, not ArraySeq

2009-01-14 Thread Justin Johnson
Ah, that's right! Thank you. I'm having a hard time thinking functionally. On Wed, Jan 14, 2009 at 12:31 PM, Stuart Halloway stuart.hallo...@gmail.com wrote: Hi Justin, Use apply: (send-off (next-agent) (fn [v args] (apply somefn args)) arg1 arg2 arg3) Cheers, Stuart Is there a

Re: detecting running as script

2009-01-14 Thread Grunde Løvoll
Thanks! I'll have a look at clojure.contrib.command-line. I don't need anything super-powerfull, just something that make it easy to define and parse command line arguments in the normal manner. Sorry about my previous double post :( Grunde On Wed, Jan 14, 2009 at 6:00 PM, Chouser

Re: clojure.contrib.command-line patch: multiple option format

2009-01-14 Thread Chouser
On Tue, Jan 13, 2009 at 8:08 PM, Perry Trolard trol...@gmail.com wrote: Hi Chouser list, I like clojure.contrib.command-line -- thanks for it! -- but I wanted to be able to specify multiple forms for an option, e.g. --help, -h, -?, etc. Here (in the Files section) http://bit.ly/fIVH

Re: when performance matters

2009-01-14 Thread Mark H.
On Jan 14, 8:27 am, Asbjørn Bjørnstad asbj...@gmail.com wrote: Anyway, here is a core part of the algorithm. It's a diffusion step, this gets called 3 times and in total this takes up more than one second of cpu time on my machine which makes framerates very slow. If anyone got any

Re: Observing namespace changes

2009-01-14 Thread lpetit
OK thank you both Chris Mike for your answer. What I've done for the moment is similar to what Mike did: at any place where there is a chance for something to change namespaces, I reload a new snapshot (and I throw the old). Registering watchers for Vars seems very interesting, I'll

Re: Delays and their efficiency

2009-01-14 Thread Rich Hickey
On Jan 13, 12:39 pm, samppi rbysam...@gmail.com wrote: Recently, I asked how to make a function evaluate its arguments lazily (http://groups.google.com/group/clojure/browse_thread/thread/ cd01ef39c2b62530), and I was given a good solution: use Delay objects (with the delay and force

Re: when performance matters

2009-01-14 Thread Chouser
On Wed, Jan 14, 2009 at 11:27 AM, Asbjørn Bjørnstad asbj...@gmail.com wrote: Anyway, here is a core part of the algorithm. It's a diffusion step, this gets called 3 times and in total this takes up more than one second of cpu time on my machine which makes framerates very slow. If anyone

Re: when performance matters

2009-01-14 Thread Rich Hickey
On Jan 14, 11:27 am, Asbjørn Bjørnstad asbj...@gmail.com wrote: On Jan 14, 12:20 pm, Mark H. mark.hoem...@gmail.com wrote: I humbly propose that folks shouldn't complain about Clojure being slow for their apps until they have at least one of the following: 1. A targeted benchmark

Re: Utilities for clojure.contrib?

2009-01-14 Thread Michael Harrison (goodmike)
I agree with Chouser that an uncluttered library is a great virtue. I too have been turned off by CL in part because of the enormous number of subtly distinct built-in functions. I'm partial to Scheme, though, so maybe I'm best viewed as a fanatic on this point. :-) That said, it does seem

Re: Utilities for clojure.contrib?

2009-01-14 Thread Jason Wolfe
On Jan 14, 10:10 am, Chouser chou...@gmail.com wrote: I also think it's unhelpful for codebases to stray further from the builtin functions than needed, because it makes that code harder to read as well.  So I will consider each of these more carefully. Thanks for your detailed response! To

Re: clojure.contrib.command-line patch: multiple option format

2009-01-14 Thread Perry Trolard
Hi Chouser, Thanks for checking out the patch. It's a good idea.  Any sane way to allow the single-letter variety to be specified with a single leading dash, instead of a double-dash? Single or double dashes should work for both kinds of options (long- or short-style), based on your code.

Re: Utilities for clojure.contrib?

2009-01-14 Thread GS
So, either:  1. My experiment was wrong, and seq? is not a valid stand-in     for seq in the above code. Right on the first try!  :-) Well, that's something :) user= (seq-chunk 2 [1 2 3 4 5]) ((1 2) (3 4) (5)) user= (seq?-chunk 2 [1 2 3 4 5]) nil This is because a vector is not

Re: Clojure now running in production

2009-01-14 Thread budu
Congratulation, this is quite amazing to see Clojure mature so fast and already working in production system. Sorry but I need to get back at finding that damn bug in a 10 years old VB legacy application :-( On Jan 13, 10:38 am, Luc Prefontaine lprefonta...@softaddicts.ca wrote: Hi everyone,

Re: Utilities for clojure.contrib?

2009-01-14 Thread Jason Wolfe
Sigh, I wish the API docs were more helpful in this case. clojure.core/seq? ([x]) Return true if x implements ISeq It's asking a lot from me to know whether vectors implement ISeq. If you don't know, you can always just ask the language :) user (ancestors (class [1 2 3]))

Re: Utilities for clojure.contrib?

2009-01-14 Thread Chouser
On Wed, Jan 14, 2009 at 4:26 PM, Jason Wolfe jawo...@berkeley.edu wrote: user (contains? (ancestors (class [1 2 3])) clojure.lang.ISeq) false Also there's 'isa?': user= (isa? (class [1 2 3]) clojure.lang.ISeq) false user= (isa? (class (seq [1 2 3])) clojure.lang.ISeq) true And 'instance?':

Re: Delays and their efficiency

2009-01-14 Thread Rich Hickey
On Jan 14, 2:57 pm, Rich Hickey richhic...@gmail.com wrote: On Jan 13, 12:39 pm, samppi rbysam...@gmail.com wrote: Recently, I asked how to make a function evaluate its arguments lazily (http://groups.google.com/group/clojure/browse_thread/thread/ cd01ef39c2b62530), and I was given a

Re: By Example - another Clojure introduction wiki page

2009-01-14 Thread Mark Volkmann
On Tue, Jan 13, 2009 at 8:12 PM, GS gsincl...@gmail.com wrote: On Jan 14, 1:12 am, Timothy Pratley timothyprat...@gmail.com wrote: I've written small wiki article which dives right into the look and meaning of common Clojure constructs with examples. Personally I find I learn best by

Re: Parameterized query with clojure.contrib.sql

2009-01-14 Thread Stephen C. Gilardi
On Jan 14, 2009, at 1:26 PM, Greg Harman wrote: Thanks much for your work. The new with-query-results seems to work quite well. You're quite welcome. I'm glad to hear it! Your timing is impeccable with this set of changes: I had just finished hacking out a (much uglier) version of

Re: Parameterized query with clojure.contrib.sql

2009-01-14 Thread Greg Harman
You're my personal Santa Claus today! :-) Confirmed present and working for both insert and update, using a 2 field where clause. On Jan 14, 5:14 pm, Stephen C. Gilardi squee...@mac.com wrote: I've added update-or-insert-values. I'd appreciate hearing how it   works for you.

Only 9 agent send-offs complete?

2009-01-14 Thread Justin Johnson
Will someone please help me understand what I'm doing wrong? The code below is *supposed* to do the following. 1) Checkout the top level directory of a Subversion repository with empty depth. 2) Update the project directories (the ones right under the root of the repository) with depth

Re: Utilities for clojure.contrib?

2009-01-14 Thread Rich Hickey
On Jan 14, 5:02 pm, Chouser chou...@gmail.com wrote: On Wed, Jan 14, 2009 at 4:26 PM, Jason Wolfe jawo...@berkeley.edu wrote: user (contains? (ancestors (class [1 2 3])) clojure.lang.ISeq) false Also there's 'isa?': user= (isa? (class [1 2 3]) clojure.lang.ISeq) false user= (isa?

Pre-Alpha of IntelliJ plugin for Clojure

2009-01-14 Thread Peter Wolf
Hey Randall, Justin, Aria, HB, and all other IntelliJ enthusiasts Pre-Alpha of IntelliJ plugin for the Clojure is open for testing... Plugin currently provides editing with syntax coloring, syntax error high-lighting, folding, and brace matching. Also provides run configuration for Clojure

Re: Only 9 agent send-offs complete?

2009-01-14 Thread Timothy Pratley
Your omission of (apply await agents) is allowing the program to terminate before all your created threads finish I think. If I might further comment, your threading model is not quite right to me... You've created 5 agents and then used them to 'send-off' as many threads as there are projects. I

Re: question about understanding/exploring agents

2009-01-14 Thread Timothy Pratley
Hi Chris What exactly are you trying to measure? I think what Boris is expecting is that for 4 CPUs, running 1,2,3,4 equal work threads will take the same amount of time. This is true when he calls loopfib, but not true when he calls loopmult: threads: 1 Elapsed time: 205.458949 msecs

Re: when performance matters

2009-01-14 Thread Mark H.
On Jan 14, 12:29 pm, chris cnuern...@gmail.com wrote: For a completely different way of doing this, you could certainly use GPGPU programming to speed this up. ... You want this for a game engine anyway; do it in opengl or directx using shaders. I recommend OpenCL or CUDA instead for less

Re: Utilities for clojure.contrib?

2009-01-14 Thread Jason Wolfe
user (= '(1) [1]) true user (= '() []) false Hm. That does seem rather odd. Fixed - svn 1208. Oh, I always assumed this was intentional ... I guess I never tried switching the order of arguments. Well, that makes a bit more sense then :).

Multiple hashing functions? (+ bug in PersistentHashMap.java?)

2009-01-14 Thread Jason Wolfe
I've already posted here [1] and on the issue board [2] about hashing. In particular, .hashCode for seqs/colls break the Java contract that whenever (.equals x y), (= (.hashCode x) (.hashCode y)). (let x = [1] and y = (seq [1])). As I've mentioned earlier, I hope that eventually .hashCode and

Re: when performance matters

2009-01-14 Thread Asbjørn Bjørnstad
On Jan 15, 3:38 am, Mark H. mark.hoem...@gmail.com wrote: On Jan 14, 8:27 am, Asbjørn  Bjørnstad asbj...@gmail.com wrote: Anyway, here is a core part of the algorithm. It's a diffusion step, this gets called 3 times and in total this takes up more than one second of cpu time on my

Re: when performance matters

2009-01-14 Thread Asbjørn Bjørnstad
On Jan 15, 8:42 am, Mark H. mark.hoem...@gmail.com wrote: On Jan 14, 12:29 pm, chris cnuern...@gmail.com wrote: For a completely different way of doing this, you could certainly use GPGPU programming to speed this up. ... You want this for a game engine anyway; do it in opengl or

Re: when performance matters

2009-01-14 Thread rzeze...@gmail.com
On Jan 13, 8:04 am, Mark P pierh...@gmail.com wrote: A macro cannot depend on runtime information. A macro is a function   that is called at compile time, its argument is an expression (as   written by the programmer, or as returned by another macro), and its   result is a modified

Re: when performance matters

2009-01-14 Thread Asbjørn Bjørnstad
On Jan 15, 4:33 am, Rich Hickey richhic...@gmail.com wrote: Try this (and make sure you are using -server): (defn diffuse [grid diff-ratio dt]   (let [a (float (* dt diff-ratio grid-size grid-size))         a4-1 (float (+ 1 (* 4 a)))         grid #^floats (deref grid)        

Re: Why aren't lists callable?

2009-01-14 Thread Ethan Herdrick
Makes sense, but (#{:a :b :c} :b) doesn't return 'true', it returns :b. So it's not really acting like an object to boolean mapping. Doesn't much matter, though. By the way, I'd like to see map-map in the core. -Ethan On Jan 12, 5:30 pm, Stuart Sierra the.stuart.sie...@gmail.com wrote: A

Re: Utilities for clojure.contrib?

2009-01-14 Thread Chouser
On Wed, Jan 14, 2009 at 4:03 PM, Jason Wolfe jawo...@berkeley.edu wrote: To keep this manageable, I'll cut out the parts where I don't think comments are needed. Good idea! (defn concat-elts Lazily concatenate elements of a seq of seqs. [s] (when (seq s) (lazy-cat (first s) (concat-elts

Re: Why aren't lists callable?

2009-01-14 Thread Chouser
On Wed, Jan 14, 2009 at 10:23 PM, Ethan Herdrick herdr...@gmail.com wrote: By the way, I'd like to see map-map in the core. If you're referring to Jason Wolfe's suggested function, I think you may be pretty satisfied with (into {} (map ...)) instead. --Chouser

Re: clojure.contrib.command-line patch: multiple option format

2009-01-14 Thread Perry Trolard
A thought: if you end up using the patch, I gave the 'justify' function an inappropriate name. It should be 'align' or 'align-cols' or some such. (No one in their right mind would justify text on the console!) Perry On Jan 14, 3:16 pm, Perry Trolard trol...@gmail.com wrote: Hi Chouser,

test-is: set! *e

2009-01-14 Thread Allen Rohner
Here's a trivial patch that I've found useful. After catching an uncaught exception in a test, set! *e so you can examine the stack trace afterward. === --- src/clojure/contrib/test_is.clj (revision 314) +++

Re: By Example - another Clojure introduction wiki page

2009-01-14 Thread e
example's of API isn't the same as real, known, problems and how to solve them in clojure. Like my merge sort problem before. I think the last post there of the loop/recur and how it's better than the with-local-vars version . . .and what leaking is about how it's not really recursion is all

Re: when performance matters

2009-01-14 Thread Mark H.
On Jan 14, 6:37 pm, Asbjørn Bjørnstad asbj...@gmail.com wrote: Look closer, I'm using a 1-D array and indexing by hand :-) oops, sorry about that -- i see you are doing the right thing here ;-) 3. I noticed you are doing 20 iterations of Gauss-Seidel.  There are some smart ways to speed

Re: Utilities for clojure.contrib?

2009-01-14 Thread Jason Wolfe
On Jan 14, 12:07 pm, Michael Harrison (goodmike) goodmike...@gmail.com wrote: But I'm not afraid of using reduce, map, and apply to prepare values to use as arguments to built-ins. And I'm not afraid to encapsulate this into my own functions when I need to. I'm OK with building up a bit of a

Re: question about understanding/exploring agents

2009-01-14 Thread bOR_
Hi Timothy, that is indeed what I was surprised about. I have been reading up on agents (using the forum and the website), and one thing that I noticed is that rich is very brief on when to use send vs send-off. I tried figuring out what the difference is by sourcecode, but it just seems to call