Re: DISCUSS: replace (rand)

2008-12-02 Thread bOR_
I wanted to ask what algorithm Java is using for calculating its random numbers (having a choice of algorithms would be great - some applications favor one above the other), but I found a website digging into exactly this question: http://www.math.utah.edu/~beebe/java/random/README "I therefore

Re: Elegant but very slow

2008-12-04 Thread bOR_
>     (reduce #(+ %1 %2) 0 (map sum (range 1 (inc iterations can be replaced by (reduce + (map sum (range 1 (inc iterations There is at least some functions in clojure's api for doing unchecked calculations. That should speed up things. I'm not yet familiar enough with clojure or build

Re: Elegant but very slow

2008-12-04 Thread bOR_
using (int ..) should also help (type hinting) --~--~-~--~~~---~--~~ 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

Re: Atoms

2008-12-05 Thread bOR_
Are there any screencasts planned which will feature atoms? (I found that the screencasts are an excellent way of learning clojure). --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this gr

Re: DISCUSS: replace (rand)

2008-12-05 Thread bOR_
On Dec 4, 9:07 am, "don.aman" <[EMAIL PROTECTED]> wrote: > Since we're being all high-level, it'd be good for a random function > which allows us to specify the range of numbers, since % doesn't > promise an even spread of probabilities (especially for large ranges). Not sure if I understand th

anyone experience with brics.automaton regex engine?

2008-12-09 Thread bOR_
Hi all. Ported my research project to clojure, and now just benchmarking parts of it. I am currently spending about 5/6th of all simulation time doing regular expressions, so I looked into alternative regex engines, optimizing the regular expression and trying to find out whether clojure's (re-pa

Re: anyone experience with brics.automaton regex engine?

2008-12-10 Thread bOR_
Hired a monkey to hit random keys on my keyboard, and eventually figured out how to get the automaton working. RegExp r = new RegExp("ab(c|d)*"); Automaton a = r.toAutomaton(); String s = "abcccdc"; System.out.println("Match: " + a.run(s)); // prints: true (add-classpath "file:///home/boris/pro

frequency of each unique item in collection

2008-12-11 Thread bOR_
Hi all, I thought I remembered there was a method in the api somewhere that would count the frequency of each unique item in a collection, but I can't find it anymore. What would be a brief way to write that in clojure? (In ruby: array.inject(Hash.new(0)) {|hash,key| hash[key] += 1 ; hash}) --

(con)current confusion

2008-12-14 Thread bOR_
Hi all, I finished porting my model to clojure, and am now trying to get it to run concurrently. During the porting I already to care to wrap the main functions (birth [loc], death [loc] etc) in dosyncs, and all the slots in the world-vector are refs. I've the feeling those are all fine, and I a

Re: (con)current confusion

2008-12-14 Thread bOR_
Thanks! Needed only a small change then :) (time (do (dotimes i popsize (doseq a [birth death infect infect evolve evolve evolve evolve evolve] (send-off (agent i) a))) (dosync (commute year inc (report) --~--~-~--~~~---~--~--

Re: (con)current confusion

2008-12-14 Thread bOR_
look into it. On Dec 14, 2:55 pm, Chouser wrote: > On Sun, Dec 14, 2008 at 8:49 AM, bOR_ wrote: > > > Thanks! Needed only a small change then :) > > > (time > >  (do > >   (dotimes i popsize > >            (doseq a [birth death infect i

Re: (con)current confusion

2008-12-14 Thread bOR_
) (send-off myagent2 fib) )) (doublesend) On Dec 14, 3:07 pm, bOR_ wrote: > The order doesn't matter, and a somewhat mixed order would even be a > welcome side-effect of the whole concurrency bit. > > What does worry me is that the agents are very short-lived. The > l

Re: (con)current confusion

2008-12-17 Thread bOR_
Hmm. Starting to get it, I think. I now just made a small number of agents, and gave them one function (do-a-years-worth-of-simulations) to compute each. However, that didn't fool them either (still only uses 1 processor), while passing two agents a fibonnaci function does get both processors runn

Re: (con)current confusion

2008-12-17 Thread bOR_
Got it working! Removed the overzealous use of dosync in defn do-year. --~--~-~--~~~---~--~~ 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

transaction failed after retry limit

2008-12-22 Thread bOR_
Hi all, Long post, but it boils down that I'm running into a transaction failed after retry limit after running my simulation for a couple of hours. I chatted briefly with fyuryu in #clojure, and am now pasting some of the hopefully relevant information into this post. Hope anyone can shed a ligh

Re: transaction failed after retry limit

2008-12-22 Thread bOR_
eb/eden.clj?gsc=rQ4WoRYAAAB68Q78LH5olacUB2kwveU9S7ibph5ftdNh9K_-frBgDg *gather indeed scans all refs, but is only called once every 1000 years, and right after an 'await', so I figured everything should have been free then. On Dec 22, 2:56 pm, Rich Hickey wrote: > On Dec 22, 7:41 am, bOR_ wrote: >

Re: transaction failed after retry limit

2008-12-22 Thread bOR_
2 198 20 2) "Elapsed time: 984358.517 msecs" So. It actually happens 10 times earlier with 10,000 people than with a 1000 ones. Puzzling. On Dec 22, 3:33 pm, bOR_ wrote: > * So far it happened in both instances that I ran the simulation for > more than 100k simulated years, so while thi

Re: transaction failed after retry limit

2008-12-23 Thread bOR_
change in the svn http://code.google.com/p/clojure/source/detail?r=1181, I should be able to run simulations that are 5 billion times bigger. That should do ;). Not sure what I could change to avoid exhausting lastPoint though. On Dec 23, 8:46 am, bOR_ wrote: > Seems fairly reproducable. >

Re: transaction failed after retry limit

2008-12-23 Thread bOR_
Appreciate the attention and the help, Timothy. Let me answer. * the global time ref might indeed be incorrect. I just half- understood how to make a global incrementing counter and implemented it in a way that seemed to work. I'll look into the correct way of doing that. Right now, when I simula

Re: transaction failed after retry limit

2008-12-24 Thread bOR_
* Starting to see your point. In a 100 CPU case, where 98 CPU's have finished, we would find that the last few hosts that need to be calculated are suddenly a 100 years older, and probably just drop dead. That could be remedied by passing age as a value of the agent, but then your second point ind

Re: transaction failed after retry limit

2008-12-24 Thread bOR_
* Starting to see your point. In a 100 CPU case, where 98 CPU's have finished, we would find that the last few hosts that need to be calculated are suddenly a 100 years older, and probably just drop dead. That could be remedied by passing the year as a value of the agent, but then your second poin

take 1 element from each coll, make all possible strings?

2008-12-27 Thread bOR_
Hi all, Next problem. If I've a collection of sets of letters, and I want all possible words you can make with this collection if you keep the order of the sets intact, I would use 'for'. However, for wants me to know beforehand how many sets there are in my collection. Is there a more flexible w

Re: take 1 element from each coll, make all possible strings?

2008-12-28 Thread bOR_
or [x (first sets) y (expand (rest sets))] (str x y)) (for [x (first sets) y (second sets)] (str x y On Dec 27, 11:35 pm, "Mark Engelberg" wrote: > On Sat, Dec 27, 2008 at 2:18 PM, bOR_ wrote: > > but > > didn't see an obvious/elegant way to do it in there, an

Re: take 1 element from each coll, make all possible strings?

2008-12-28 Thread bOR_
s I should look at a way to approximate the score i am after, rather than caculate it exactly.. but at least these solutions let me check how good my approximation is. On Dec 28, 10:44 am, bOR_ wrote: > Ah. The prohibitively long bit comes mainly from printing out the > whole list in emacs.

Re: take 1 element from each coll, make all possible strings?

2008-12-28 Thread bOR_
c (input 2) d (input 3) e (input 4) f (input 5) g (input 6) h (input 7) i (input 8)] (str a b c d e f g h i (count (expand (first myset "Elapsed time: 1850.148 msecs" 403200 On Dec 28, 9:49 am, bOR_ wrote: > Annoying way to start a morning :P. Thanks though for the tip on >

Re: take 1 element from each coll, make all possible strings?

2008-12-28 Thread bOR_
On Dec 28, 12:26 pm, "Mark Engelberg" wrote: > This iterative version doesn't behave properly if one of the sequences > is empty.  Expand should probably check for this degenerate case > before passing the vector off to step. I'll take care of that Interesting. on my comp, the for loop runs abo

Re: take 1 element from each coll, make all possible strings?

2008-12-29 Thread bOR_
Timothy - It becomes more tricky if you want to know what fraction of everything a host can present that carries 2 or 3 different filters (I mentioned that somewhere). For example: everything is 4^4 = 256 options [ABCD][ABCD][ABCD][ABCD] Host carries these two filters: [ABC][AC][AB][ABC] [ABC][

Re: Clojure Box, alpha

2009-01-05 Thread bOR_
Just downloaded clojurebox and it installs like a charm here (windows vista business). It looks like I am stuck with windows at my new workspace (just had my first day of work there), so to have clojurebox was a nice thing. One question is how I would go about to setting up a emacs --daemon and em

Re: quote on side effects

2009-01-05 Thread bOR_
Closest I can get is this quote from a blog (http:// voelterblog.blogspot.com/2008_03_01_archive.html) but I remember it being written nicer somewhere else as well. However, using purely functional programming is also not very useful, since, if we allow no side effects, our program will do nothin

Re: when performance matters

2009-01-12 Thread bOR_
This might help: java libraries for fast computing. I guess they will be usable from within clojure as well. http://acs.lbl.gov/~hoschek/colt/ Welcome to the Colt Project. Colt provides a set of Open Source Libraries for High Performance Scientific and Technical Computing in Java. Scientific an

sending off 1,10,100,1000,10k,100k agents to do fib is fine, but 1M agents not

2009-01-12 Thread bOR_
Hi All. While familiarizing myself with different ways of making my models concurrent, I ran into something that might be a bug. given this code, and a 4core machine: (defn fib [n] (if (<= n 1) 1 (+ (fib (- n 1)) (fib (- n 2) (defn pow "from the tiny math library" [

Re: How much Clojure source code is complicated?

2009-01-13 Thread bOR_
Here you can peek at the source code of clojure. http://code.google.com/p/clojure/source/browse/trunk/src/clj/clojure/core.clj It is about 3700 lines, and although you have to get used to a few new functions and names that are normally not exposed when you use clojure, it looks fairly simple.

Re: How much Clojure source code is complicated?

2009-01-13 Thread bOR_
code? > What is the best place (file, package or what ever) to start reading > the source code? > > On Jan 13, 10:01 am, bOR_ wrote: > > > > > Here you can peek at the source code of clojure. > > >http://code.google.com/p/clojure/source/browse/trunk/src/clj/clo

Re: anyone experience with brics.automaton regex engine?

2009-01-13 Thread bOR_
t is a good idea to keep matchers or not. Now just forgetting about them after I made them" [rx string] (let [matcher (.newMatcher rx string)] (count (take-while #(= true %) (repeatedly (fn [] (.find matcher))) On Dec 10 2008, 9:27 am, bOR_ wrote: > Hired a monkey to hit ran

Re: How much Clojure source code is complicated?

2009-01-13 Thread bOR_
why I'm reading the source code, right? > > On Jan 13, 10:19 am, bOR_ wrote: > > > > > Not sure what you want to achieve by studying the source code. I think > > the answer that I can give to what works best for you will depend on > > what you want to study the s

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 machine

Re: Trying to define next-agent function

2009-01-14 Thread bOR_
Also a newbie wrestling with agents.. but perhaps you could do something with lazy-cons or cycle? An endless cycle of your agents: (def running true) (while running (doseq [a (cycle agents)] (send-off a somefunction)) On Jan 14, 4:48 pm, Justin Johnson wrote: > I found my problem.  I wasn

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

Re: when performance matters

2009-01-15 Thread bOR_
I remember from 5 years ago that a collegue of mine improved a diffusion algorithm for a successor of me by some heavy algorithms. My own algorithm was a simple loop-over-the- array once, dump-a-fraction- of-each-cell-into-spatially-neighbouring-cells-in-the-new-array, and sum what is in every cel

Re: Delays and their efficiency

2009-01-15 Thread bOR_
Thanks for reminding me about #1 ;) On Jan 14, 11:08 pm, Rich Hickey wrote: > On Jan 14, 2:57 pm, Rich Hickey wrote: > > > > > On Jan 13, 12:39 pm, samppi wrote: > > > > Recently, I asked how to make a function evaluate its arguments lazily > > > (http://groups.google.com/group/clojure/browse_

Re: question about understanding/exploring agents

2009-01-15 Thread bOR_
C. Gilardi" wrote: > On Jan 15, 2009, at 2:57 AM, bOR_ wrote: > > > That is, if I understand blocking correctly. Currently assuming that > > blocking only happens when two things would like to write the same > > ref? > > Blocking in this case refers to this definitio

Re: Clojure Box, alpha

2009-01-15 Thread bOR_
Sort of got distracted and stopped paying attention to getting that to run. I'll report when I get to it and learn more :). On Jan 5, 11:43 pm, "Shawn Hoover" wrote: > On Mon, Jan 5, 2009 at 4:24 PM, bOR_ wrote: > > > Just downloaded clojurebox and it installs

odd error with a dosync (not (empty? @someref))

2009-01-18 Thread bOR_
Hi all. I'm running into an odd error that occasionally pops up. Here is the ugly script and the two functions, one for which it does, and one for which it does not pop up. Anyone has a clue? (defn death [host] (dosync (if (not (empty? @host)) nil))) (defn death [host] (dosync

Re: odd error with a dosync (not (empty? @someref))

2009-01-18 Thread bOR_
Thanks for the pointers both. What still riddles me is why the above script with the first formula (with the deref problem) doesn't always cause a problem, but maybe one in every 5 times I run it. @Timothy - double thanks for your clarifications. I am changing my program from a ref-based to a sen

Re: running Gorilla

2009-01-21 Thread bOR_
Just for posterity: It took me a while to realize that my fresh vim didn't have a maplocalleader defined. Had to add it to the .vimrc so that chimp (and I guess gorilla as well) would actually have some keybindings associated with it. let maplocalleader = "," Gracias! On Dec 19 2008, 8:26 am, M

Re: Basic about setting upp Clojure and editor enviroment

2009-01-21 Thread bOR_
If you are running windows, clojurebox is the easiest way to set things up. On linux, this guide might help: http://riddell.us/clojure/ On Jan 21, 3:05 pm, anderspe wrote: > Hello, i am waiting for the book "Programming Clojure" by Stuart > Halloway, > I have set upp a enviroment that i can run

Re: import doesn't work when jar was loaded with add-classpath ?

2009-01-26 Thread bOR_
Thanks for that solution. Ran into the same problem as well, and right now I don't want to solve it, but just finish something else. On Dec 13 2008, 11:21 pm, Eric Sessoms wrote: > Did you ever get this resolved?  I just had the same thing start > happening to me today, after not experiencing an

functional lazy shuffle

2009-01-26 Thread bOR_
In addition to the functional shuffle thread (can't seem to post to that one anymore, might be too old?), I've written a lazy shuffle. Not sure if it is the best way to write it, but I needed a lazy shuffle primarily because I wanted to randomly pair a few agents from a large vector of agents with

Dauphin: mona lisa genetic algorithm in clojure

2009-01-26 Thread bOR_
Hope this isn't a double-post, but here is a nice example of a rewrite of some reddit post on a genetic algorithm for generating the mona lisa in clojure by Yann N. Dauphin http://npcontemplation.blogspot.com/2009/01/clojure-genetic-mona-lisa-problem-in.html --~--~-~--~~~-

Re: Dauphin: mona lisa genetic algorithm in clojure

2009-01-26 Thread bOR_
According to one of the posts beneath the log, the issue has been fixed in the latests svns. I have no clue what the technical problem was in clojure's source. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure

odd error with filter

2009-01-26 Thread bOR_
Here is the error. (filter #(:born \...@%) world) java.lang.IllegalArgumentException: Start must be less than or equal to end: 2147483647, -2147483648 It is probably something I have done wrong in the code (the simulation crashed with a "java.lang.RuntimeException: Agent has errors (NO_SOURCE_FI

Re: Clojure for Games/Simluation/Art (Optimization in Clojure)

2009-01-28 Thread bOR_
There is many ways in which you can improve the algorithm. I have seen flocks of 10,000 birds being rendered real-time on a laptop by Hanno Hildenbrandt, theoretical biology Utrecht. http://www.rug.nl/biologie/onderzoek/onderzoekgroepen/theoreticalbiology/peoplePages/hannoPage Also, Craig Reynol

Re: Clojure for Games/Simluation/Art (Optimization in Clojure)

2009-01-28 Thread bOR_
Errata: Hanno works in Groningen. As I work in Utrecht, I sort of automatically appended 'Utrecht' after 'Theoretical Biology'. Ontopic: There is a thing called Hilbert curves that you could use. http://en.wikipedia.org/wiki/Hilbert_curve You could define a 1d array, and translate the bird 2d po

Re: Clojure for Games/Simluation/Art (Optimization in Clojure)

2009-01-28 Thread bOR_
> On Wednesday 28 January 2009 18:09:30 bOR_ wrote: > > > Errata: Hanno works in Groningen. As I work in Utrecht, I sort of > > automatically appended 'Utrecht' after 'Theoretical Biology'. > > > Ontopic: There is a thing called Hilbert curves that you coul

Re: functional lazy shuffle

2009-01-29 Thread bOR_
Hmm. (time isn't that reliable here. my lazy-shuffle might be quite slow after all. On Jan 26, 10:46 pm, bOR_ wrote: > In addition to the functional shuffle thread (can't seem to post to > that one anymore, might be too old?), I've written alazy shuffle. Not > sure

Re: Documenting Clojure Code

2009-01-30 Thread bOR_
Related. (defn myfunc "a nice description here" [coll] (apply + coll)) but no (def myvar ; cant do a nice " "description here, even though hash-maps can stand in for functions. (hash-map :a 1 :b 3)) On Jan 30, 10:42 pm, Kevin Albrecht wrote: > How are people generating HTML or text docu

Re: Amsterdam.clj

2009-02-03 Thread bOR_
Using Clojure at the RIVM in bilthoven, and at University of Utrecht. Previous projects of my phd were in ruby, last one is in clojure. Postdoc is in Clojure. Amsterdam is closeby. I've about no free time till end of march (finishing thesis!), but might find it fun to join in April. On Feb 3

Re: My SLIME installation diary

2009-02-04 Thread bOR_
As we never can have enough examples, and this one was about the simplest that just worked on Ubuntu, I'll paste my variant of it here. It is slightly different because I'm behind a proxy, and thus my git calls are somewhat different, and I got my slime from a git repository rather than a cvs one.

Re: My SLIME installation diary

2009-02-09 Thread bOR_
HI Phil. Tried the clojure-install on a fairly clean ubuntu / emacs23 Here is what went and what went wrong: Had to use a different .emacs. Just autoload and add-to-list didn't seem to load clojure-mode.el. Took a moment to figure out that I had to set clojure-src-root as well, as that isn't me

Re: My SLIME installation diary

2009-02-09 Thread bOR_
Slowly wrestling myself through getting to know emacs. Ok. autoload works fine. Didn't realize I have to open emacs with a .clj file for the clojure-mode to load. Now looking where this 'Cannot open load file:slime-repl' is coming from. On Feb 9, 10:36 am, bOR_ wrote: >

Re: My SLIME installation diary

2009-02-09 Thread bOR_
Thanks for all the explanations. I'll try again this wednesday! --~--~-~--~~~---~--~~ 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 g

Re: My SLIME installation diary

2009-02-11 Thread bOR_
>> (push "/home/boris/.emacs.d" load-path) >This is actually already on the load-path by default; no need to add it. Standard load-path on ubuntu didn't include ~/.emacs.d for me. Not sure why not. load-path is a variable defined in `C source code'. Its value is ("/etc/emacs-snapshot" "/etc/emac

Re: My SLIME installation diary

2009-02-11 Thread bOR_
> > Success! Thank you. Success lasted till I tried to restart emacs. Here is where I am stuck again: 1. It can't find M-x slime clojure-slime-config doesn't seem to be an option either to manually run with M-x clojure The solution seems to be to take the functions in clojure-slime-config and pu

Re: My SLIME installation diary

2009-02-11 Thread bOR_
Spotted an error in clojure-mode.el. Swank-clojure-extra-classpaths needs to be changed from this to the following, in order for people to be able to use contrib. (setq swank-clojure-jar-path (concat clojure-src-root "/clojure/ clojure.jar") swank-clojure-extra-classpaths (list

Re: Dejcartes

2009-02-11 Thread bOR_
Just started using it. I had some trouble understanding the whole java classpath and jar concept, but I'm now happily producing graphs. Will start using it tomorrow for some population data, and expand it as I need :). On Jan 21, 12:35 am, "Tom Ayerst" wrote: > Mark, > > Thanks for doing this, I

Re: Random elements

2009-02-11 Thread bOR_
I was a bit surprised that random-permutation is in lazy-seqs.. there doesn't seem to be much lazy about it, right? It is just java's shuffle. On Feb 11, 8:16 pm, Phil Hagelberg wrote: > Jason Wolfe writes: > >> Would you consider changing the names of these 2 functions ? > > >> random-permutat

Re: How to build tree with nodes that 'point' to each other?

2009-02-12 Thread bOR_
Not a guru here (far from!), but don't get too thrown off by what the word 'immutable' means in your head. In Clojure 'immutable' refers more to how things work in the belly of the beast.. Clojure has 4 constructs (vars, refs, agents and atoms) to faciliate mutating things. Probably the best thin

Re: My SLIME installation diary

2009-02-13 Thread bOR_
That starter-kit sounds perhaps easier. I'll try the starter-kit. I want the install to be fairly easy, if I want to convince others at work to play with it :). On Feb 12, 6:35 pm, Phil Hagelberg wrote: > bOR_ writes: > >>> (push "/home/boris/.emacs.d" load-path

Re: Trojan horse in our Files section

2009-02-14 Thread bOR_
> Gone now. > > Rich but was it written in clojure? =). --~--~-~--~~~---~--~~ 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

making a counter from an agent, atom or ref?

2009-02-15 Thread bOR_
Getting a bit confused again. It seems possible to make counters from agents, atoms and refs (def countagent (agent 0)) (send agent inc) (def countatom (atom 0)) (swap! atom inc) (def countref (ref 0)) (dosync (commute countref inc)) Is there a time and place for all three of them? I am leani

Re: unintended consequences of printing

2009-02-16 Thread bOR_
Thanks for pointing this out, and glad I remember I read it. Just ran into this 'bug'. I've a social network of agents, that can refer to each other as either steady or casual partners (recreated a model described in "Modeling Prevention Strategies for Gonorrhea and Chlamydia Using Stochastic Netw

Re: where is contrib?

2009-02-21 Thread bOR_
Note that clojure just changed the lazy branch to be the main version of clojure, so right now clojure-contrib and the latest svn do not play nicely yet. I belief there is a old version of clojure-contrib available and probably also for clojure-main. On Feb 21, 1:15 pm, Emeka wrote: > http://tel

Optimizations

2009-02-21 Thread bOR_
Hi all. Recently started to optimize two models written in clojure, and I could use some tips from you guys. I first enabled the set reflection-warning thing, and removed reflections in the inner loop of my program. That already helped a lot, speeding up the whole thing to about 40% of its origi

Re: Should (pop nil) throw an exception?

2009-02-22 Thread bOR_
Perhaps some context help. Why would you want to continue popping an empty collection? If you are in a loop, when will you stop popping it? Perhaps there is a more logical idiom to use for the case you run into pop nil exceptions (doseq?) On Feb 22, 5:18 pm, Frantisek Sodomka wrote: > Any though

Nice Conversation between hardware lisp and hardware java architects

2009-02-22 Thread bOR_
Here is an interesting read, for those of you that (also) occasionally daydream about having a hardware jvm to play with ;). >From Cliff Click Jr.’s Blog's Blog "I had an email conversation between myself, David Moon & Daniel Weinreb. For the younger readers: David Moon is one of the original ar

Re: Waterfront - The Clojure-based editor for Clojure

2009-02-25 Thread bOR_
I'm trying to rewrite the wf.bat to a linux version, but I was a bit puzzled what all the ;%~dp0 's mean. Apparently the bash version of it is ${0%/*} java -cp ~/src/clojure/clojure.jar;${0%/*}clj;${0%/*}java - Dnet.sourceforge.waterfront.plugins=${0%/*}clj/net/sourceforge/ waterfront/ide/plugins

how to get concurrent - model design question

2009-02-26 Thread bOR_
Hi all. First. For those who remember, I posted an individual-based model in this group some time ago (eden.clj), and got some very helpful replies on where I misunderstood clojure and did things the hard way. I wanted to report that that model by now is written purely as nonblocking agents, and

Re: how to get concurrent - model design question

2009-02-26 Thread bOR_
Thanks for the reply Timothy! I'll look into the future things :). The main reason for using refs was because I am constructing a contact network between different refs (a graph, consisting of nodes and edges.), which changes over time (all the short-term and long-term relations between hosts bei

Re: doc suggestion for future function

2009-02-28 Thread bOR_
Related to the (future function. (there is a bit of a lack of documentation on it, but I guess I can derive more from the example in http://clojure.org/refs,) can I call something like (apply await myvectorofrefs) if I have a bunch of futures running and I want to wait for them to finish before I

Re: doc suggestion for future function

2009-02-28 Thread bOR_
(increase year with 1) (concurrent: (break and create bidirectional links between refs)) (wait for year to finish) ) I'll try your suggestion and see if it is workable. Thanks! On Feb 28, 10:35 am, Christophe Grand wrote: > bOR_ a écrit : > > > can I call something like (app

Re: fitness

2009-03-04 Thread bOR_
If you use hash-maps, or a struct-map as the basis of your individual, you can just make a key 'fitness', and store the once-calculated fitness in there. I'm not sure how, but it might be possible that at the creation of your animals, you assign the key 'fitness' a basic function that upon being

Re: fitness

2009-03-05 Thread bOR_
Didn't know of the existence of delay yet. Thanks for pointing that out :). Is there a reason why delay needs a force to be calculated? > > >    {:fitness (delay (compute-my-fitness))} > > > > And when you access the value use force. > > > >    (-> my-thing :fitness force) > --~--~-~--~

Re: What is Clojure NOT good for?

2009-03-09 Thread bOR_
I'm not from the software engineers field, but how difficult is it for some non-lisp, but java-savvy software writer to pick up a 600-line clojure program and learn to understand it? I mean, everyone in this forum managed to learn clojure to some degree without too much trouble.. including me. If

Re: What is Clojure NOT good for?

2009-03-10 Thread bOR_
> Also, how do you think this increase in required effort grows? What if > we are talking about a +10.000-line Clojure program? Now add schedule > pressure, deadlines and the cost of missed oppotunities and you will > find that many companies sees the introduction of a new programming > language -

Re: Speed issues vs. Python

2009-03-12 Thread bOR_
Setting that one (set! *warn-on-reflection* true) Helped a lot in my simulation model to find out where clojure/java were having trouble. It pointed out that one of my main functions was causing trouble, and could do with a bit of typehinting. (defn #^Short find-all-epi "turns the rx and stri

Re: New mod code is broken

2009-03-12 Thread bOR_
Mod seems to have broken again (mod 9 -3) gives -3 (map #(mod % 3) (range -10 10)) (2 3 1 2 3 1 2 3 1 2 0 1 2 0 1 2 0 1 2 0) svn 1372. Chouser wrote: > On Sat, Feb 14, 2009 at 12:45 AM, Stephen C. Gilardi wrote: > > > > The new mod isn't working properly though: > > > >Testing clojur

Re: New mod code is broken

2009-03-12 Thread bOR_
1 2 0) > > Test-clojure runs ok too. > > Frantisek > > On Mar 12, 10:30 am, bOR_ wrote: > > > > > Mod seems to have broken again > > > (mod 9 -3)  gives -3 > > > (map #(mod % 3) (range -10 10)) > > (2 3 1 2 3 1 2 3 1 2 0 1 2 0 1 2 0 1 2 0) >

Re: Parallel Game of Life

2009-03-16 Thread bOR_
Nice! A few more days of work and I've time to play with these kind of things again. Here are some comments, based on your description. As game of life is a cellular automata, you do not need any blocking at all, so you could use agents, rather than refs. It does become an asynchronous CA then, b

Re: Parallel Game of Life

2009-03-16 Thread bOR_
> > I'm not very used to concurrent programming, so I have a few questions you > may find naïve, but well, let's just pretend they're interesting  ... : Learning here as well :). > > It seems to me that the game of life works in "increments" of its "world". > So I don't see at first what can be

Re: A clojure server

2009-04-04 Thread bOR_
Has anyone tried to combine clojure-server and vimclojure yet? I'm still hopping IDEs to see which system I like best, and vim was next on the list :). On Apr 4, 9:56 pm, Konrad Hinsen wrote: > On 04.04.2009, at 19:45, christ...@mvonessen.de wrote: > > > I'm not sure I undestand what you want to

howto update with a constant when a function is expected?

2009-04-16 Thread bOR_
Hi all, some functions (like map, or update-in) expect a function to be applied on a value. In the case where the update I want is merely a constant, is there a short way to write it? (map (fn [n] :new) (list :old1 :old2 :old3)) works (map :new (list :old1 :old2 :old3)) unfortunately doesn't w

Re: howto update with a constant when a function is expected?

2009-04-16 Thread bOR_
(fn [n] (ref nil)) (range 10)) 52 (# # # # # # # # # #) On Apr 16, 11:54 am, David Sletten wrote: > On Apr 15, 2009, at 11:30 PM, bOR_ wrote: > > > > > Hi all, > > > some functions (like map, or update-in) expect a function to be > > applied on a value. In the

Re: VimClojure 2.1.0 released

2009-04-16 Thread bOR_
Worked with the 2.1.0 version today. Impressions so far are more stable than the developmental version of a week ago (no hanging repls), a feeling intense gratitude for the ,ct command. Furthermore a bit of collision with the default keybindings when I try to browse the history with ctrl-p and ctr

Re: Design advice/patterns for Clojure concurrency

2009-04-17 Thread bOR_
I've written individual-based models using agents, and using refs. Currently my decision tree is 'agents, if there are no events which need to be atomically synchronized between individuals**'. In both cases I had a vector full of individuals called 'world'. When the individuals were agents, I c

Re: Design advice/patterns for Clojure concurrency

2009-04-17 Thread bOR_
> bigfun (comp retire-host slowdown-host infect-hosts naturalrecovery- > host pair-host) > proc1 (future (doseq [i (subvec world 0 2499)] (bigfun i))) > proc2 (future (doseq [i (subvec world 2500 4999)] (bigfun i))) > proc3 (future (doseq [i (subvec world 5000 7499)] (bigfun i))) > proc4 (future

difference between vimclojure and slime

2009-05-03 Thread bOR_
Hi Meikel, I've tried running / developing both in vimclojure and slime, and one difference I noticed is that if I manually start a function in the buffer, vimclojure won't show me any output until the function that is completed. Slime would do fine. I could start a (simulation) of 1 years,

Re: The Santa Claus Problem

2009-05-06 Thread bOR_
> When writing this code, I found the watcher system a bit clunky to > use, and a bit too heavyweight for what I needed.  Sometimes, within a > dosync block, you want to trigger some sort of side effect once the > current transaction is committed.  To make this easy, I would very > much like to s

Re: The Santa Claus Problem

2009-05-06 Thread bOR_
Why isn't this enough for the problem? Elves and deer are entering Santa's frontdoor 1 at a time, when there is three elves in the room, santa instantly deals with them (resetting the number of elves to 0), when there is 9 deer in the room, santa goes sleighing. (def santa (agent {:elves 0 :deer

Re: The Santa Claus Problem

2009-05-06 Thread bOR_
minimum? I see people assuming that santa needs time to fix whatever the 3 elves are bringing to him, for example. On May 6, 10:32 am, bOR_ wrote: > Why isn't this enough for the problem? Elves and deer are entering > Santa's frontdoor 1 at a time, when there is three elves in t

Re: Clojure at JavaOne

2009-05-18 Thread bOR_
Well, the ant demo does show java interoperability (the whole graphics bit). You could start with a world with the empty square, and a filled square, start with one type of ant that is just lugging the food from the filled to the empty square. This shows off agents. Have four numbers being print

  1   2   >