Re: leiningen - a Clojure build tool

2009-11-22 Thread bOR_
Leiningen is very easy to pronounce for the dutch :). We've the word Leningen anyway (Loans), and ei is a common vowel combination in dutch as well (I actually grew up in Leiden). Ontopic: I might be missing something, but is there an obvious way to do something like lein src/chlamydia.clj when

Re: leiningen - a Clojure build tool

2009-11-22 Thread ajuc
On 22 Lis, 13:09, bOR_ boris.sch...@gmail.com wrote: Ontopic: I might be missing something, but is there an obvious way to do something like lein src/chlamydia.clj when I'm in the projects' directory (chlamydia), to run a script as in java -server clojure.main chlamydia.clj? I didn't see

Re: leiningen - a Clojure build tool

2009-11-22 Thread bOR_
I'm currently modeling the spread and prevalence of chlamydia over a dynamic sexual contact network. Hence the name :-). Plotting the graphs etc is done with Incanter, and I'm looking into processing to draw parts of the network. Its my second science project in Clojure (the first one was called

Re: Oh, yeah, transients are fast!

2009-11-22 Thread Michael Wood
2009/11/21 John Harrop jharrop...@gmail.com: On Fri, Nov 20, 2009 at 5:16 PM, Raoul Duke rao...@gmail.com wrote: Try with a 1.6 JVM... wow. it actually got worse than when i was using 1.5. ... so much for hallowed write-once-run-the-same-anywhere-ish of the jvm, d'oh. Clojure

Re: Transforming a SeqMap to a Map

2009-11-22 Thread Emeka
(apply has-map (apply concat (map (fn [b] [(apply hash-map (apply concat (butlast b))) (val (last b))]) (list {9 5 9 9 7 8} {3 4 5 6 7 0} {{3 4, 5 6} 0, {8 9, 9 5} 8} I just added some noise! On Wed, Nov 18, 2009 at 2:05 PM, Sean Devlin francoisdev...@gmail.comwrote: user=(def your-data

Re: leiningen - a Clojure build tool

2009-11-22 Thread bOR_
What is the normal way to let Leiningen know about local jars? I am using brics automaton in one of my projects, and that jar is only downloadable after confirming the bsd licence (http://www.brics.dk/ automaton/), so I have it locally on my disk, but it isn't in clojars or mvnrepositiory.com. It

Re: Oh, yeah, transients are fast!

2009-11-22 Thread John Harrop
On Sun, Nov 22, 2009 at 6:05 AM, Michael Wood esiot...@gmail.com wrote: You've got some kind of system problem confounding your results, I'll bet. It got slower? One test actually hung? My suspicion, of course, lies with the emacs environment you've just confessed to using. Half the

Re: positions

2009-11-22 Thread John Harrop
On Sun, Nov 22, 2009 at 7:54 AM, Emeka emekami...@gmail.com wrote: John, You should have added that you code came from Programming Clojure. It didn't. If it's the same as, or closely similar to, code from there, it's entirely coincidental. In Clojure there's usually several ways to do

Re: Monad problems: finding an m-zero

2009-11-22 Thread samppi
Thanks for the help. After working it out, I just figured out that the reason why the second axiom isn't fulfilled by the m-zero above is this part in m- bind: ((product-fn product) new-state)) product-fn, which in the second axiom's case is (fn [x] m-zero), gets

Re: leiningen - a Clojure build tool

2009-11-22 Thread David Brown
On Sun, Nov 22, 2009 at 01:05:43AM -0800, bOR_ wrote: elif [ ${1: -4} = .clj ]; then # Small hack to use lein to start clojure scripts java -cp $CLASSPATH clojure.main $1 How about elif [ ${1: -4} = .clj ]; then # Small hack to use lein to start clojure scripts java

Re: leiningen - a Clojure build tool

2009-11-22 Thread David Brown
On Sun, Nov 22, 2009 at 07:14:33AM -0800, bOR_ wrote: What is the normal way to let Leiningen know about local jars? I am using brics automaton in one of my projects, and that jar is only downloadable after confirming the bsd licence (http://www.brics.dk/ automaton/), so I have it locally on my

Re: Oh, yeah, transients are fast!

2009-11-22 Thread David Brown
On Sun, Nov 22, 2009 at 11:45:46AM -0500, John Harrop wrote: Nothing so serious as a hang, though, and at least I can do basic things in my IDE without reaching for the frelling manual every two minutes to look up some key-combination :) I suspect both models are going to be important. I feel

How to make this a non-reflecting call?

2009-11-22 Thread David Brown
java.nio.channels.FileChannel contains some .write methods: [27] write : int (ByteBuffer) [28] write : int (ByteBuffer,long) [29] write : long (ByteBuffer[]) [30] write : long (ByteBuffer[],int,int) I have an array of ByteBufers, but I can't figure out how to call #29 without it being a

Re: leiningen - a Clojure build tool

2009-11-22 Thread John Harrop
How is it pronounced anyway, at the start? LINE... or LANE...? -- 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 Note that posts from new members are moderated - please be patient with your

Re: How to make this a non-reflecting call?

2009-11-22 Thread John Harrop
On Sun, Nov 22, 2009 at 12:55 PM, David Brown cloj...@davidb.org wrote: java.nio.channels.FileChannel contains some .write methods: [27] write : int (ByteBuffer) [28] write : int (ByteBuffer,long) [29] write : long (ByteBuffer[]) [30] write : long (ByteBuffer[],int,int) I have an array of

Re: leiningen - a Clojure build tool

2009-11-22 Thread Michael Wood
2009/11/22 John Harrop jharrop...@gmail.com: How is it pronounced anyway, at the start? LINE... or LANE...? If it's German-ish, it would be the former. If it's more like Afrikaans (or maybe Dutch?) it would be the latter, although it would be a very strange sort of Afrikaans word, so I'd go

Re: How to make this a non-reflecting call?

2009-11-22 Thread David Brown
On Sun, Nov 22, 2009 at 01:00:51PM -0500, John Harrop wrote: On Sun, Nov 22, 2009 at 12:55 PM, David Brown cloj...@davidb.org wrote: java.nio.channels.FileChannel contains some .write methods: [27] write : int (ByteBuffer) [28] write : int (ByteBuffer,long) [29] write : long (ByteBuffer[])

Re: Clojure Scoping Rules

2009-11-22 Thread nchubrich
Richard--- It's not the same thing: (class (doall (map (fn [x] x) [1 2 3]))) - clojure.lang.LazySeq whereas (class (binding [*strict* true] (map (fn[x] x) [1 2 3]))) - clojure.lang.LazilyPersistentVector Also, having a dynamic var that turns laziness on and off would allow you to do it

Re: How to make this a non-reflecting call?

2009-11-22 Thread Christophe Grand
Hi David, On Sun, Nov 22, 2009 at 6:55 PM, David Brown cloj...@davidb.org wrote: java.nio.channels.FileChannel contains some .write methods: [27] write : int (ByteBuffer) [28] write : int (ByteBuffer,long) [29] write : long (ByteBuffer[]) [30] write : long (ByteBuffer[],int,int) I have an

Re: positions

2009-11-22 Thread nchubrich
Thanks Emeka, I took a look at it. I still say it would be nice to organize the sequence functions (somehow). -- 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 Note that posts from new

Re: Clojure Scoping Rules

2009-11-22 Thread Richard Newman
Richard--- It's not the same thing: (class (doall (map (fn [x] x) [1 2 3]))) - clojure.lang.LazySeq whereas (class (binding [*strict* true] (map (fn[x] x) [1 2 3]))) - clojure.lang.LazilyPersistentVector From Clojure's perspective those *are* the same thing: user= (= (map

Re: leiningen - a Clojure build tool

2009-11-22 Thread Alex Osborne
bOR_ wrote: What is the normal way to let Leiningen know about local jars? I am using brics automaton in one of my projects, and that jar is only downloadable after confirming the bsd licence (http://www.brics.dk/ automaton/), so I have it locally on my disk, but it isn't in clojars or

Re: Monad problems: finding an m-zero

2009-11-22 Thread samppi
Yes, I see. I'm going to guess that the parser-m that I give above has no possible m-zero, so I think I'll have to rethink how I'm going to approach this problem. I probably am going to just define failure in another way. (The reason why I can't use nil is because I need to store metadata on the

Re: Monad problems: finding an m-zero

2009-11-22 Thread John Harrop
Is there an explanation of monads out there that doesn't require the reader to know Haskell to understand it? One that's generic to any FP-capable language? -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to

Re: Monad problems: finding an m-zero

2009-11-22 Thread Martin DeMello
On Mon, Nov 23, 2009 at 2:40 AM, John Harrop jharrop...@gmail.com wrote: Is there an explanation of monads out there that doesn't require the reader to know Haskell to understand it? One that's generic to any FP-capable language? Most of them use the concrete syntax of *some* language. But

Re: Clojure Scoping Rules

2009-11-22 Thread nchubrich
Richard--- What if you accidentally cause a library to realize an infinite lazy sequence? True, that's a problem. But couldn't the library protect itself by putting a (binding [*strict* false] ...) in front of its code? (Having a namespace-level binding construct would be helpful.) This

Does a standard function exist that acts like assoc except it applies fns to vals

2009-11-22 Thread samppi
Does a function that does this: (vary coll :x fn-x, :y fn-y) ; Equivalent to (assoc coll :x (fn-x (:x coll)), :y (fn-y (:y coll))) exist in the core or contrib APIs? I'm surprised that I can't find any. It's a very natural extension of assoc. But if there really isn't any, is the code below

Re: Does a standard function exist that acts like assoc except it applies fns to vals

2009-11-22 Thread John Harrop
On Sun, Nov 22, 2009 at 4:32 PM, samppi rbysam...@gmail.com wrote: Does a function that does this: (vary coll :x fn-x, :y fn-y) ; Equivalent to (assoc coll :x (fn-x (:x coll)), :y (fn-y (:y coll))) exist in the core or contrib APIs? I'm surprised that I can't find any. It's a very

Re: Monad problems: finding an m-zero

2009-11-22 Thread John Harrop
On Sun, Nov 22, 2009 at 4:25 PM, Martin DeMello martindeme...@gmail.comwrote: On Mon, Nov 23, 2009 at 2:40 AM, John Harrop jharrop...@gmail.com wrote: Is there an explanation of monads out there that doesn't require the reader to know Haskell to understand it? One that's generic to any

Re: Does a standard function exist that acts like assoc except it applies fns to vals

2009-11-22 Thread samppi
Ah, update-in is exactly what I need. Excellent, thank you. On Nov 22, 2:38 pm, John Harrop jharrop...@gmail.com wrote: On Sun, Nov 22, 2009 at 4:32 PM, samppi rbysam...@gmail.com wrote: Does a function that does this:  (vary coll :x fn-x, :y fn-y)  ; Equivalent to (assoc coll :x (fn-x (:x

Re: Clojure Scoping Rules

2009-11-22 Thread Richard Newman
True, that's a problem. But couldn't the library protect itself by putting a (binding [*strict* false] ...) in front of its code? (Having a namespace-level binding construct would be helpful.) That's exactly what I meant when I wrote it would introduce a problem that library authors have to

Re: Monad problems: finding an m-zero

2009-11-22 Thread jim
I wrote one specifically for monads in Clojure. http://intensivesystems.net/tutorials/monads_101.html There's also a second part. Also, Konrad Hinson wrote one: http://onclojure.com/2009/03/06/a-monad-tutorial-for-clojure-programmers-part-1 it's in 4 parts, I believe. John Harrop wrote: On

Holding onto your head step functions -- confusion

2009-11-22 Thread Garth Sheldon-Coulson
Hi All, I'll confused about the hold-onto-your-head business when building lazy seqs using lazy-seq. The lazier documentation on the web site doesn't really clear things up for me, though I've read it a few times. Under what circumstances must one use a step function, and under what

String to Decimal Conversion

2009-11-22 Thread Don
I am having a problem converting a string to decimal. I want to convert 1.0 to decimal 1.0. I have tried the java.lang.Integer class use= (Integer/parseInt 1.1) java.lang.NumberFormatException: For input string: 1.1 (NO_SOURCE_FILE:0) But it won't give. It does however work when I run it with

Re: String to Decimal Conversion

2009-11-22 Thread Kevin Downey
1.1 is not representable as an Integer(Java class, or primitive int) and is not an integer (mathematical sense) so expecting to be representable as one, is kind of... odd. On Sun, Nov 22, 2009 at 4:14 PM, Don josereyno...@gmail.com wrote: I am having a problem converting a string to decimal.  I

Re: String to Decimal Conversion

2009-11-22 Thread Don
Yes you are right. Hence the error message I posted. But it was the only idea that came to mind. I'm new to clojure and not a java programmer. On Nov 22, 4:20 pm, Kevin Downey redc...@gmail.com wrote: 1.1 is not representable as an Integer(Java class, or primitive int) and is not an integer

Re: String to Decimal Conversion

2009-11-22 Thread Richard Newman
I am having a problem converting a string to decimal. I want to convert 1.0 to decimal 1.0. For a double (not decimal): (Double/parseDouble 1.1) = 1.1 for a decimal: (BigDecimal. 1.1) 1.1M Note that Clojure has reader support for BigDecimal (the M).

Re: String to Decimal Conversion

2009-11-22 Thread Don
Thanks a bunch Richard. On Nov 22, 4:47 pm, Richard Newman holyg...@gmail.com wrote: I am having a problem converting a string to decimal.  I want to convert 1.0 to decimal 1.0. For a double (not decimal):         (Double/parseDouble 1.1)         =         1.1 for a decimal:        

Re: String to Decimal Conversion

2009-11-22 Thread Kevin Downey
user= (read-string 1.1) 1.1 user= On Sun, Nov 22, 2009 at 4:48 PM, Don josereyno...@gmail.com wrote: Thanks a bunch Richard. On Nov 22, 4:47 pm, Richard Newman holyg...@gmail.com wrote: I am having a problem converting a string to decimal.  I want to convert 1.0 to decimal 1.0. For a

Re: String to Decimal Conversion

2009-11-22 Thread Don
Awesome Kevin. That solution is sexy. I don't even need the libraries anymore. On Nov 22, 5:02 pm, Kevin Downey redc...@gmail.com wrote: user= (read-string 1.1) 1.1 user= On Sun, Nov 22, 2009 at 4:48 PM, Don josereyno...@gmail.com wrote: Thanks a bunch Richard. On Nov 22, 4:47 pm,

Re: String to Decimal Conversion

2009-11-22 Thread Don
Awesome Kevin. That solution is sexy. I don't even need the java library anymore. On Nov 22, 5:02 pm, Kevin Downey redc...@gmail.com wrote: user= (read-string 1.1) 1.1 user= On Sun, Nov 22, 2009 at 4:48 PM, Don josereyno...@gmail.com wrote: Thanks a bunch Richard. On Nov 22, 4:47 

Re: Clojure Scoping Rules

2009-11-22 Thread nchubrich
Richard, do you know where one can read about Rich Hickey's speculative work on scoping constructs? I did find a good description by him of what Clojure currently does, from 2007: http://markmail.org/message/kpuq4dvcavek26sp#query:+page:1+mid:mgfsubipgaqdmzru+state:results -- You received this

Re: String to Decimal Conversion

2009-11-22 Thread Richard Newman
Awesome Kevin. That solution is sexy. I don't even need the java library anymore. Note, however, that this can return (or do!) near anything, because it accepts any Clojure syntax. user= (read-string \foo\) foo ; a string user= (read-string (1.1)) (1.1) ; a list containing a float user=

Re: Clojure Scoping Rules

2009-11-22 Thread Richard Newman
Richard, do you know where one can read about Rich Hickey's speculative work on scoping constructs? I did find a good description by him of what Clojure currently does, from 2007: http://clojure.org/todo http://www.assembla.com/spaces/clojure/tickets/2-Scopes Better off asking Rich, I think

Improving Clojure startup time with -Xbootclasspath

2009-11-22 Thread Alex Osborne
We were discussing Clojure startup time (in the context of Leiningen) and Phil Hagelberg asked some JRuby people about startup time. They suggested using -Xbootclasspath. Check this out: % time (echo | java -client -cp clojure.jar clojure.main) 0.84s user 0.04s system 96% cpu 0.908 total %

AOT'd namespaces lose their metadata

2009-11-22 Thread Phil Hagelberg
I noticed an odd bug when working on the help command for leiningen. It uses docstrings on metadata for help output, but when AOTing the project, the docstrings (as well as all other metadata) would be lost. Note that this doesn't happen when metadata is added to the namespace after the fact as

Mysterious errors w/ protocols and types

2009-11-22 Thread samppi
The following code contains an error, and I cannot figure out what it is at all. When I run StateMeta's test once, the statement marked with a comment above fails. When I run it again, it succeeds. This has been causing very weird bugs in my code. I've replicated the behavior in both a script and