Re: Clojure/LLVM

2010-03-23 Thread mac
Like Per says, if you want to compile Clojure to LLVM code that's
probably a huge project, have you looked at VMKit? I think that's a
JVM/CLR implementation based on LLVM, perhaps it could run Clojure?

If you just want to use LLVM from Clojure however, you can use my C
FFI clj-native with the C interface for LLVM. I actually made it
because I wanted to play around with LLVM but I never got around to
actually doing that again once I had a working version of clj-native.
It would be very interesting to see if clj-native is suitable for the
task.

http://github.com/bagucode/clj-native

/Markus

On 24 mar, 05:56, Per Vognsen  wrote:
> Clojure depends on aggressive dynamic optimization for performance.
> It's a very different set of techniques than what is used in the
> ahead-of-time static compilation world from which LLVM hails. The
> Google guys working on Unladen Swallow seem to have had enough
> problems getting it to work well even as a basic JIT code generator;
> the layers of abstraction make it very slow. There's a good reason V8
> is using unlayered, direct code generation.
>
> In my judgement it would be a multi-year project for an experienced
> specialist in the field. Mike Pall took several years to do just the
> x86 version of LuaJIT 2.0, but he had already done LuaJIT 1.0, and he
> is arguably one of the world's top experts in this area.
>
> Besides, one of the Clojure's main raisons d'etre is the vast pool of
> existing libraries in the JVM (and now CLR) world to draw from.
>
> -Per
>
>
>
> On Wed, Mar 24, 2010 at 11:42 AM, Antony Blakey  
> wrote:
> > Has anyone looked at driving LLVM from Clojure and then doing code 
> > generation to LLVM? I've had some experience doing it in a JIT context for 
> > VisualWorks Smalltalk, but I'd rather not reinvent the wheel. I'd love to 
> > be able to use Clojure on the iPad.
>
> > Antony Blakey
> > -
> > CTO, Linkuistics Pty Ltd
> > Ph: 0438 840 787
>
> > Did you hear about the Buddhist who refused Novocain during a root canal?
> > His goal: transcend dental medication.
>
> > --
> > 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 first post.
> > To unsubscribe from this group, send email to
> > clojure+unsubscr...@googlegroups.com
> > For more options, visit this group at
> >http://groups.google.com/group/clojure?hl=en
>
> > To unsubscribe from this group, send email to 
> > clojure+unsubscribegooglegroups.com or reply to this email with the words 
> > "REMOVE ME" as the subject.

-- 
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 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

To unsubscribe from this group, send email to 
clojure+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.


Re: destructuring / rest (was: Re: Counting vowels, take II.)

2010-03-23 Thread Meikel Brandmeyer
Hi,

On Mar 24, 2:22 am, Douglas Philips  wrote:

> would (let [s1 (first seq1)
>              s1tail (rest seq1)] ...)
> be any better? rest says it calls seq on its argument, and that would  
> force as well?
> Hmmm... So only things like map are able to realize first without  
> realizing (first (rest seq1)) too?

No. Understand the difference between next and rest.

Sincerely
Meikel

-- 
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 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

To unsubscribe from this group, send email to 
clojure+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.


Re: Help optimizing array-to-integer operation?

2010-03-23 Thread ataggart
It was added here: 
http://github.com/richhickey/clojure/commit/d0e1eef26abd215668ed27357839b2bba4ba095c

Not automatically overflowing numbers is a Good Thing.  For example:
http://seclists.org/fulldisclosure/2010/Mar/447

Though the behavior now deviates from the java casting behavior where
the more significant bits are just truncated.  I can't think of many
cases where a downcast is used *and* the original value is expected to
ever be larger than the target type.  If you really need that, then
bit-masking prior to casting seems appropriate.



On Mar 23, 7:41 am, Per Vognsen  wrote:
> Interesting. It's Clojure 1.2.0-master-SNAPSHOT as of last week:
>
> Clojure 1.2.0-master-SNAPSHOT
> user=> 0xff
> 255
> user=> (byte 0xff)
> java.lang.IllegalArgumentException: Value out of range for byte: 255
> (NO_SOURCE_FILE:0)
>
> So, this looks like a new issue. Rich?
>
> -Per
>
> On Tue, Mar 23, 2010 at 8:39 PM, Mark J. Reed  wrote:
>
>
>
> > On Tue, Mar 23, 2010 at 8:40 AM, Per Vognsen  wrote:
> >> Sorry, I didn't put that right. 0xFF would only be -1 as a signed
> >> byte. What I'm saying is that the interaction between the type system
> >> of integers and the reader's hexadecimal notation is pretty surprising
> >> to me. In particular, (byte 0xFF) throws an error.
>
> > What version?  It works here:
>
> > Clojure 1.1.0
> > user=> (byte 0xff)
> > -1
>
> > In fact, it seems that (byte) doesn't check the range at all:
>
> > user=> (byte -129)
> > 127
>
> > --
> > Mark J. Reed 
>
> > --
> > 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 first post.
> > To unsubscribe from this group, send email to
> > clojure+unsubscr...@googlegroups.com
> > For more options, visit this group at
> >http://groups.google.com/group/clojure?hl=en
>
> > To unsubscribe from this group, send email to 
> > clojure+unsubscribegooglegroups.com or reply to this email with the words 
> > "REMOVE ME" as the subject.

-- 
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 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

To unsubscribe from this group, send email to 
clojure+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.


Re: Clojure/LLVM

2010-03-23 Thread Per Vognsen
Clojure depends on aggressive dynamic optimization for performance.
It's a very different set of techniques than what is used in the
ahead-of-time static compilation world from which LLVM hails. The
Google guys working on Unladen Swallow seem to have had enough
problems getting it to work well even as a basic JIT code generator;
the layers of abstraction make it very slow. There's a good reason V8
is using unlayered, direct code generation.

In my judgement it would be a multi-year project for an experienced
specialist in the field. Mike Pall took several years to do just the
x86 version of LuaJIT 2.0, but he had already done LuaJIT 1.0, and he
is arguably one of the world's top experts in this area.

Besides, one of the Clojure's main raisons d'etre is the vast pool of
existing libraries in the JVM (and now CLR) world to draw from.

-Per

On Wed, Mar 24, 2010 at 11:42 AM, Antony Blakey  wrote:
> Has anyone looked at driving LLVM from Clojure and then doing code generation 
> to LLVM? I've had some experience doing it in a JIT context for VisualWorks 
> Smalltalk, but I'd rather not reinvent the wheel. I'd love to be able to use 
> Clojure on the iPad.
>
> Antony Blakey
> -
> CTO, Linkuistics Pty Ltd
> Ph: 0438 840 787
>
> Did you hear about the Buddhist who refused Novocain during a root canal?
> His goal: transcend dental medication.
>
>
> --
> 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 
> first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
>
> To unsubscribe from this group, send email to 
> clojure+unsubscribegooglegroups.com or reply to this email with the words 
> "REMOVE ME" as the subject.
>

-- 
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 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

To unsubscribe from this group, send email to 
clojure+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.


Clojure/LLVM

2010-03-23 Thread Antony Blakey
Has anyone looked at driving LLVM from Clojure and then doing code generation 
to LLVM? I've had some experience doing it in a JIT context for VisualWorks 
Smalltalk, but I'd rather not reinvent the wheel. I'd love to be able to use 
Clojure on the iPad.

Antony Blakey
-
CTO, Linkuistics Pty Ltd
Ph: 0438 840 787

Did you hear about the Buddhist who refused Novocain during a root canal?
His goal: transcend dental medication.


-- 
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 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

To unsubscribe from this group, send email to 
clojure+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.


Re: Named arguments in HEAD and prettier default arguments for :keys destructuring

2010-03-23 Thread Douglas Philips

On 2010 Mar 23, at 10:56 PM, Per Vognsen wrote:

:keys elements optionally be two-element vectors with the second
element supplying the default value:

user=> (defn funkymonkey [x y z & {:keys [[a -1] [b -2] [c -3]]] [x  
y z a b c])


What do you think? I hacked this into my local version of core.clj's
destructure and it feels very natural to me.


I like the existing arity overloading, and when I looked into the core  
source, was saddened to see the repeated code that handled optional  
parameters. This is one thing I like from Common Lisp, so I'm glad to  
see it here.
However, as a clojure newbie, I have no idea what subtle interactions  
this might have.


-Doug

--
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 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

To unsubscribe from this group, send email to clojure+unsubscribegooglegroups.com or 
reply to this email with the words "REMOVE ME" as the subject.


Named arguments in HEAD and prettier default arguments for :keys destructuring

2010-03-23 Thread Per Vognsen
Those of you following the clojure repo on GitHub may have noticed this commit:

http://github.com/richhickey/clojure/commit/29389970bcd41998359681d9a4a20ee391a1e07c

Now you can do things like this:

user=> (defn funkymonkey [x y z & {:keys [a b c]}] [x y z a b c])
#'user/funkymonkey
user=> (funkymonkey 1 2 3)
[1 2 3 nil nil nil]
user=> (funkymonkey 1 2 3 :b 5)
[1 2 3 nil 5 nil]
user=> (funkymonkey 1 2 3 :c 6 :a 4 :b 5)
[1 2 3 4 5 6]

Very nice! It feels smoothly integrated with the general destructuring
infrastructure. You can also supply default values with the :or
binder:

user=> (defn funkymonkey [x y z & {:keys [a b c] :or {a -1 b -2 c -3}]
[x y z a b c])
#'user/funkymonkey
user=> (funkymonkey 1 2 3)
[1 2 3 -1 -2 -3]
user=> (funkymonkey 1 2 3 :b 5)
[1 2 3 -1 5 -3]

The great thing about :keys is that it cuts down on redundancy: you
specify a symbol only once and it is dually interpreted as a map
keyword and a lexically bound symbol. Since :keys already expects a
flat sequence of symbols rather than arbitrary nested binding forms
(otherwise this trick of dual interpretation wouldn't work), you could
further cut down on the redundancy in the above :keys/:or idiom (which
I expect would become commonplace with named arguments) by letting
:keys elements optionally be two-element vectors with the second
element supplying the default value:

user=> (defn funkymonkey [x y z & {:keys [[a -1] [b -2] [c -3]]] [x y z a b c])

What do you think? I hacked this into my local version of core.clj's
destructure and it feels very natural to me.

-Per

-- 
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 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

To unsubscribe from this group, send email to 
clojure+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.


Lazyness of range (was: Re: Counting vowels, take II.)

2010-03-23 Thread Douglas Philips

On 2010 Mar 23, at 9:28 PM, Per Vognsen wrote:

So you can see that scan-filter-zip is lazy in the source sequence but
apparently not the primary input sequence. That was surprising to me
because I see nothing in my code that should have forced that. Then I
remember that some functions like range are not really lazy but only
chunky-lazy. You can verify this by replacing (range 10) by (range
100) and noting that the trace stops at the 32nd element (chunks are
currently 32 elements wide). So, everything is as lazy as can be,
given the input sequences.


Thanks!

When I replaced range with (take 10 (iterate inc 100)) trace-seq
showed no chunking. I guess range is generating cheap enough sequences  
that the chunking is worth it. :)


-Doug

--
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 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

To unsubscribe from this group, send email to clojure+unsubscribegooglegroups.com or 
reply to this email with the words "REMOVE ME" as the subject.


Re: listing factors of a number

2010-03-23 Thread Per Vognsen
I'm sure that code would be useful if he were looking for a slow
implementation of a slow algorithm. I believe he asked for an
optimized algorithm. An example might be Lenstra's elliptic curve
factorization or the general number field sieve. I don't know of any
implementations in Clojure but there seem to be a few floating around
in Java.

-Per


On Wed, Mar 24, 2010 at 3:35 AM, kotor  wrote:
> On Mar 23, 1:02 pm, Glen Rubin  wrote:
>> Does anyone know of any existing libraries for clojure that has code
>> which is optimized to list all of the factors of any given integer?
>
> (defn factors [x]
> "integer -> vector[integers]"
>  (loop [xf [] i 2]
>    (if (> (* i i) x)
>      (vec (sort (distinct xf)))
>      (if (zero? (rem x i))
>        (recur (conj xf i (/ x i)) (inc i))
>        (recur xf (inc i))
>
> --
> 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 
> first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
>
> To unsubscribe from this group, send email to 
> clojure+unsubscribegooglegroups.com or reply to this email with the words 
> "REMOVE ME" as the subject.
>

-- 
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 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

To unsubscribe from this group, send email to 
clojure+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.


Re: Counting vowels, take II.

2010-03-23 Thread Per Vognsen
For laziness analysis, I typically use code like this:

(defn trace-seq* [name xs]
  (for [x xs]
(do (println (str name ": " x))
x)))

(defmacro trace-seq [xs]
  `(trace-seq* ~(str xs) ~xs))

If I use it on the code I posted, I get this:

user> (take 3 (scan-filter-zip even? (trace-seq (iterate inc 0))
(trace-seq (range 10
((range 10): 0
(range 10): 1
(range 10): 2
(range 10): 3
(range 10): 4
(range 10): 5
(range 10): 6
(range 10): 7
(range 10): 8
(range 10): 9
(iterate inc 0): 0
[0 0] (iterate inc 0): 1
[1] [1 2])

You might want to temporarily redirect *out* so you don't get
interleaved return values and traces.

So you can see that scan-filter-zip is lazy in the source sequence but
apparently not the primary input sequence. That was surprising to me
because I see nothing in my code that should have forced that. Then I
remember that some functions like range are not really lazy but only
chunky-lazy. You can verify this by replacing (range 10) by (range
100) and noting that the trace stops at the 32nd element (chunks are
currently 32 elements wide). So, everything is as lazy as can be,
given the input sequences.

-Per

On Wed, Mar 24, 2010 at 1:35 AM, Douglas Philips  wrote:
> On 2010 Mar 23, at 9:14 AM, Per Vognsen wrote:
>
>> Remember the one-liner I gave you last time?
>
> Yup. It was the 'hard coded + 0' parts that had been ruminating in the back
> of my mind as being something that could be abstracted out. :)
>
> Since the one you just posted didn't have all the features of my version,
> I've taken the liberty of
> adjusting it:
> ; Variation on Per Vognsen's version.
> (defn semi-map
>  [pred fun seq1 seq2]
>  "Lazy sequence of seq1 optionally combined with seq2.
>   when pred on seq1 item is true, yield fun of seq1 and seq2
>   otherwise yield seq1 item without advancing seq2.
>   Example: (semi-map vowel? vector \"Hello Word\" (iterate inc 1))
>   -> (\\H [\\e 1] \\l \\l [\\o 2] \\space \\W [\\o 3] \\r \\d)
>  "
>  (map #(if (pred %1) (fun %1 (first %2)) %1)
>       seq1
>       (reductions #(if (pred %2) (rest %1) %1)
>                   seq2 seq1)))
> ;;;
>
> What I don't understand (yet) is how to do a lazyness analysis on this
> similar to what
> Meikel Brandmeyer did with my original code.
>
> So, for my own understanding:
>    the outermost map is lazy, hence nothing will happen it the first result
> needs to be realized.
> OK, so far so good.
>    when the first result of the map needs to be realized, I'm getting a bit
> foggy...
>    the 2nd parameter to map 'seq1' will have to have its first element (and
> tail?) realized
>        in order to call the mapping function #(if...)
>    the 3rd parameter to map '(reductions...)' will have to have its first
> element realized
>        in order to call the mapping function #(if...) of the outermost map.
> then:
>    In order to realize the first value of the result of reductions, both the
> first value of seq1
>       has to be realized to pass in as the second parameter to the
> reductions' function #(if ...)
>
> Ok, so now my head hurts. But in a good way.
>
> I think I have convinced myself that the only "eager" realization/evaluation
> might be of the tail of seq1, but I'm not sure.
>
> Thanks Per!
>
> -Doug
>
> --
> 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
> first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
>
> To unsubscribe from this group, send email to
> clojure+unsubscribegooglegroups.com or reply to this email with the words
> "REMOVE ME" as the subject.
>

-- 
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 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

To unsubscribe from this group, send email to 
clojure+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.


destructuring / rest (was: Re: Counting vowels, take II.)

2010-03-23 Thread Douglas Philips

On 2010 Mar 23, at 4:13 PM, Meikel Brandmeyer wrote:

   (let [[s1 & s1tail]   seq1
In the above destructuring the first element of s1tail is also  
realised.

That is what I mean with "one step ahead". I'm not sure why it is done
like this. I does not seem necessary. But I'm not an expert in the
destructuring code…


would (let [s1 (first seq1)
s1tail (rest seq1)] ...)
be any better? rest says it calls seq on its argument, and that would  
force as well?
Hmmm... So only things like map are able to realize first without  
realizing (first (rest seq1)) too?


-D

--
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 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

To unsubscribe from this group, send email to clojure+unsubscribegooglegroups.com or 
reply to this email with the words "REMOVE ME" as the subject.


Re: Can't call public method of non-public class

2010-03-23 Thread Stuart Campbell
Whoops... I completely glazed over the fact that the equivalent Java code
worked perfectly :(

On 24 March 2010 11:19, Armando Blancas  wrote:

> You want Clojure to treat 'env' as a Map instead of its implementation
> class, which is not public. Just add the type hint #^Map to 'env''s
> def:
>
> user=> (def pb (new ProcessBuilder ["myCommand" "myArg"]))
> #'user/pb
> user=> (def #^Map env (.environment pb))
> #'user/env
> user=> (.put env "VAR1", "myValue")
> "myValue"
>
> --
> 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 first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
>
> To unsubscribe from this group, send email to clojure+
> unsubscribegooglegroups.com or reply to this email with the words "REMOVE
> ME" as the subject.
>

-- 
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 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

To unsubscribe from this group, send email to 
clojure+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.


Re: Can't call public method of non-public class

2010-03-23 Thread Armando Blancas
You want Clojure to treat 'env' as a Map instead of its implementation
class, which is not public. Just add the type hint #^Map to 'env''s
def:

user=> (def pb (new ProcessBuilder ["myCommand" "myArg"]))
#'user/pb
user=> (def #^Map env (.environment pb))
#'user/env
user=> (.put env "VAR1", "myValue")
"myValue"

-- 
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 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

To unsubscribe from this group, send email to 
clojure+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.


Re: Can't call public method of non-public class

2010-03-23 Thread Stuart Campbell
Hi Konstantin,

>From JDK docs (
http://java.sun.com/j2se/1.5.0/docs/api/java/lang/ProcessBuilder.html#environment%28%29
):

The behavior of the returned map is system-dependent. A system may not allow
> modifications to environment variables or may forbid certain variable names
> or values. For this reason, attempts to modify the map may fail with
> UnsupportedOperationExceptionor
> IllegalArgumentExceptionif
>  the modification is not permitted by the operating system.
>

Regards,
Stuart

On 24 March 2010 02:43, Konstantin Barskiy  wrote:

> I'm trying to reproduce ProcessBuilder example from java documentation
> http://java.sun.com/javase/6/docs/api/java/lang/ProcessBuilder.html
> This is that example:
>
> ProcessBuilder pb = new ProcessBuilder("myCommand", "myArg1",
> "myArg2");
>  Map env = pb.environment();
>  env.put("VAR1", "myValue");
>  env.remove("OTHERVAR");
>  env.put("VAR2", env.get("VAR1") + "suffix");
>  pb.directory(new File("myDir"));
>  Process p = pb.start();
>
> I'm typing folowing in clojure repl:
>
> D:\Users\Konstantin>java -jar clojure.jar
> Clojure 1.1.0
> user=> (def pb (new ProcessBuilder ["myCommand" "myArg"]))
> #'user/pb
> user=> (def env (.environment pb))
> #'user/env
> user=> (.put env "VAR1", "myValue")
> java.lang.IllegalArgumentException: Can't call public method of non-
> public class: public java.lang.String
> java.lang.ProcessEnvironment.put(java.lang.String,java.lang.String)
> (NO_SOURCE_FILE:0)
>
> What does this error mean and what i am doing wrong?
>
> --
> 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 first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
>
> To unsubscribe from this group, send email to clojure+
> unsubscribegooglegroups.com or reply to this email with the words "REMOVE
> ME" as the subject.
>

-- 
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 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

To unsubscribe from this group, send email to 
clojure+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.


Re: Introduction + question re. diff between 'Programming Clojure'

2010-03-23 Thread Robert Lally
On 23 March 2010 20:57, Meikel Brandmeyer  wrote:

> Hi,
>
> On Tue, Mar 23, 2010 at 08:04:34PM +, Robert Lally wrote:
>
> > I ask because I found that every time I wanted to change my code from
> > (.method1 object) to (.. object method1 method2) it would have been
> easier
> > if the code were (. object method1) moving to (.. object method1 method2)
> > and, after a while, I started consistently using the form you've
> indicated
> > is sub-optimal.
>
> I abandoned .. long ago. I only use ->.
>
> (-> object .method1 .method2 works-also-with-clojure-fns (.method3 with
> args))
>
> Neat!

-- 
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 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

To unsubscribe from this group, send email to 
clojure+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.


Re: Introduction + question re. diff between 'Programming Clojure'

2010-03-23 Thread Meikel Brandmeyer
Hi,

On Tue, Mar 23, 2010 at 08:04:34PM +, Robert Lally wrote:

> I ask because I found that every time I wanted to change my code from
> (.method1 object) to (.. object method1 method2) it would have been easier
> if the code were (. object method1) moving to (.. object method1 method2)
> and, after a while, I started consistently using the form you've indicated
> is sub-optimal.

I abandoned .. long ago. I only use ->.

(-> object .method1 .method2 works-also-with-clojure-fns (.method3 with args))

Sincerely
Meikel

-- 
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 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

To unsubscribe from this group, send email to 
clojure+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.


Re: ANN: labrepl, making Clojure more accessible

2010-03-23 Thread Laurent PETIT
I'll do the counterclockwise review tonight, review soon to come

2010/3/23 Stuart Halloway :
> The labrepl project (http://github.com/relevance/labrepl) is a tutorial
> environment for learning Clojure. It is open source under the same license
> as Clojure. Whether you are learning Clojure on your own, or teaching or
> learning in a classroom environment, I want labrepl to be useful to you.
>
> Features:
>
> * A compojure-based application that delivers step-by-step instructions for
> writing Clojure code
> * lab instructions, solutions, and tests (currently enough for 3-4 days of
> instructor-led training, YMMV)
> * IDE integration (ish, see below)
>
> Help wanted:
>
> As the creator of labrepl, I intend to keep it up to date. I will be adding
> new labs, adding new features, and making sure that the labs all work with
> whatever new hotness appears in the Clojure language. But I need your help.
> Specifically, I would like volunteers to sign up for the following tasks:
>
> (1) NetBeans integration: Test the instructions in the README and make sure
> that they work, and show off NetBeans/Enclojure in its best light. Bonus
> credit for writing a lab specifically on using Enclojure.
> (2) CounterClockwise integration: Ditto above but for
> Eclipse/Counterclockwise.
> (3) IDEA integration: Ditto but for IDEA/La Clojure.
> (4) Maven integration. The instruction use leiningen and project.clj, but
> the maven pom.xml is checked in. For Java folks, it might be easier to have
> instructions that just use maven and skip leiningen.
> (5) Out-of-box experience audit. Is the leiningen-based setup easy enough?
> If not, please make something simpler (maybe shell scripts that pull the
> libs from a download site?)
> (6) Better windows instructions/integration.
>
> Let's make getting started with Clojure easier!
>
> Stu
>
> --
> 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
> first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
>
> To unsubscribe from this group, send email to
> clojure+unsubscribegooglegroups.com or reply to this email with the words
> "REMOVE ME" as the subject.
>

-- 
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 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

To unsubscribe from this group, send email to 
clojure+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.


Re: ANN: labrepl, making Clojure more accessible

2010-03-23 Thread Mark Derricutt
1.3.2 is the latest version of the plugin and fixes some issues with the
replScript settings ( it actually continues to run the repl, and not just
exits - doh!)

-- 
Pull me down under...

On Wed, Mar 24, 2010 at 4:16 AM, Alex Ott  wrote:

> Hello
>
> Stuart Halloway  at "Tue, 23 Mar 2010 10:37:51 -0400" wrote:
>  SH> GIt just needed a little push. It's there now. Thanks Rich!
>
> It's better to add
>
>
>  
>com.theoryinpractise
>clojure-maven-plugin
>1.3
>  
>
>
> into  section, and
>
>
>  swank-clojure
>  swank-clojure
>  1.1.0-SNAPSHOT
>
>
> into dependencies - in this case user can get access to 'mvn clojure:repl'
> & 'mvn clojure:swank' commands
>
> --
> With best wishes, Alex Ott, MBA
> http://alexott.blogspot.com/   http://alexott.net
> http://alexott-ru.blogspot.com/
>
> --
> 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 first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
>
> To unsubscribe from this group, send email to clojure+
> unsubscribegooglegroups.com or reply to this email with the words "REMOVE
> ME" as the subject.
>

-- 
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 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

To unsubscribe from this group, send email to 
clojure+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.


Re: Introduction + question re. diff between 'Programming Clojure'

2010-03-23 Thread Robert Lally
On 23 March 2010 20:16, ataggart  wrote:

>
>
> On Mar 23, 1:04 pm, Robert Lally  wrote:
> > On 23 March 2010 12:31, Meikel Brandmeyer  wrote:
> >
> > > Hi,
> >
> > > one difference which shows up everywhere, is the method and
> > > constructor notation. While in the book the old is used - (. obj
> > > (method args ...)) - one should stick to the new one - (.method obj
> > > args ...). Similar for Contructors. (note trailing dot) and Static/
> > > methodCalls.
> > > --
> >
> > Is there a technical reason that one should prefer the (.method object)
> > syntax over the (. object method) variant or is it purely a style that
> the
> > community has converged on?
>
> The latter as it more closely resembles the arrangement of function
> calls.


Thanks Alex, glad to know I'm not doing something that'll have unexpected
side-effects.

As an aside, in my mind I treated . as the 'method call' operator and then
(. object arg) felt just as lispy as (+ 1 2)


Rob Lally.

-- 
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 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

To unsubscribe from this group, send email to 
clojure+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.


Re: listing factors of a number

2010-03-23 Thread kotor
On Mar 23, 1:02 pm, Glen Rubin  wrote:
> Does anyone know of any existing libraries for clojure that has code
> which is optimized to list all of the factors of any given integer?

(defn factors [x]
"integer -> vector[integers]"
  (loop [xf [] i 2]
(if (> (* i i) x)
  (vec (sort (distinct xf)))
  (if (zero? (rem x i))
(recur (conj xf i (/ x i)) (inc i))
(recur xf (inc i))

-- 
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 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

To unsubscribe from this group, send email to 
clojure+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.


Re: ANN: labrepl, making Clojure more accessible

2010-03-23 Thread Rob Wolfe
Stuart Halloway  writes:

> The labrepl project (http://github.com/relevance/labrepl) is a
> tutorial environment for learning Clojure. It is open source under the
> same license as Clojure. Whether you are learning Clojure on your own,
> or teaching or learning in a classroom environment, I want labrepl to
> be useful to you.

It's really great tutorial to start playing with Clojure.
I think it will be very useful for people just wanted
to check what's interesting in Clojure.
So I'm afraid that this requirement:
"""
Make sure you have leiningen installed 
(http://github.com/technomancy/leiningen).
"""
might be a little bit too hard to fulfil for beginners.

What about creating standalone ZIP file, which will contain
all necessary components: Clojure, Leiningem and Labrepl?
I have in mind something like this:

|-- bin
|   |-- lein
|   |-- lein.bat
|   |-- repl
|   `-- repl.bat
|-- config
|   `-- log4j.properties
|-- core
|   |-- clojure-1.1.0.jar
|   |-- labrepl-0.0.1.jar
|   `-- leiningen-1.1.0-standalone.jar
|-- log
|-- project.clj
`-- public

Actually I created such structure myself pretty easy.
I needed just to tweak a little bit: lein, lein.bat,
repl and repl.bat in order to use JARs from "core" subdirectory.

Now in order to start reading this awesome tutorial there are
needed only these steps:
1. unzip labrepl-package.zip
2. cd labrepl-package
3. ./bin/lein deps (Windows: bin\lein deps)
4. ./bin/repl (Windows: bin\repl)

I tried that on Linux and Windows and it just plain works.
I uploaded this ZIP here:
http://github.com/downloads/robwolfe/lein-diagnostics/labrepl-package.zip
in case you want to take a look.

Br,
Rob


-- 
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 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

To unsubscribe from this group, send email to 
clojure+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.


Re: Introduction + question re. diff between 'Programming Clojure'

2010-03-23 Thread ataggart


On Mar 23, 1:04 pm, Robert Lally  wrote:
> On 23 March 2010 12:31, Meikel Brandmeyer  wrote:
>
> > Hi,
>
> > one difference which shows up everywhere, is the method and
> > constructor notation. While in the book the old is used - (. obj
> > (method args ...)) - one should stick to the new one - (.method obj
> > args ...). Similar for Contructors. (note trailing dot) and Static/
> > methodCalls.
> > --
>
> Is there a technical reason that one should prefer the (.method object)
> syntax over the (. object method) variant or is it purely a style that the
> community has converged on?

The latter as it more closely resembles the arrangement of function
calls.

-- 
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 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

To unsubscribe from this group, send email to 
clojure+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.


Re: Counting vowels, take II.

2010-03-23 Thread Meikel Brandmeyer
Hi,

On Tue, Mar 23, 2010 at 01:33:54PM -0400, Douglas Philips wrote:

> >> (let [[s1 & s1tail]   seq1
> >
> >Don't use this destructuring in this case, because it forces again the
> >realisation of the seq one step ahead.
> 
> If I need s1 anyways, what is the "one step ahead part" that you
> refer to?
> That is just my translation of the Haskell idiom. I'm sad to see
> that there
> isn't a parallel clojure idiom with the lazy semantics.

In the above destructuring the first element of s1tail is also realised.
That is what I mean with "one step ahead". I'm not sure why it is done
like this. I does not seem necessary. But I'm not an expert in the
destructuring code…

Sincerely
Meikel

-- 
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 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

To unsubscribe from this group, send email to 
clojure+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.


Re: Would it be possible to make a "dumped" clojure, a la dumped emacs?

2010-03-23 Thread Michael Kohl
On Tue, Mar 23, 2010 at 8:57 PM, Alex Coventry  wrote:
> I am considering developing for Android using clojure, but I gather
> it's slow to start up.

I thought there are some issues re the Dalvik VM and Clojure? Does
anyone have experience with this?

-- 
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 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

To unsubscribe from this group, send email to 
clojure+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.


Re: Introduction + question re. diff between 'Programming Clojure'

2010-03-23 Thread Robert Lally
On 23 March 2010 12:31, Meikel Brandmeyer  wrote:

> Hi,
>
> one difference which shows up everywhere, is the method and
> constructor notation. While in the book the old is used - (. obj
> (method args ...)) - one should stick to the new one - (.method obj
> args ...). Similar for Contructors. (note trailing dot) and Static/
> methodCalls.
> --


Is there a technical reason that one should prefer the (.method object)
syntax over the (. object method) variant or is it purely a style that the
community has converged on?

I ask because I found that every time I wanted to change my code from
(.method1 object) to (.. object method1 method2) it would have been easier
if the code were (. object method1) moving to (.. object method1 method2)
and, after a while, I started consistently using the form you've indicated
is sub-optimal.

Thanks,


Rob Lally.

-- 
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 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

To unsubscribe from this group, send email to 
clojure+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.


Re: Why I have chosen not to employ clojure

2010-03-23 Thread e
I'm starring that post.  Still haven't gotten Aquamacs working with
clojure.  will try yet again tonight.

On Tue, Mar 23, 2010 at 3:28 PM, Carson  wrote:

> I second Lee's thought -- my "work" as a grad student is AI research,
> not application development.  I'm glad I discovered Incanter's package
> (three lines of instructions [1]) that allows me to run a Swank server
> that I can easily connect to from Emacs (and Slime from the Emacs end
> can be easily installed thru Elpa).  The part about getting Swank/
> Slime easily going achieves the threshold on the editor front.
>
> [1] from http://data-sorcery.org/2009/12/20/getting-started/
> $ git clone git://github.com/liebke/incanter.git
> $ cd incanter
> $ mvn install
>
> then $ bin/clj to get a repl on the terminal or $ bin/swank to start
> up a swank server.
>
> For me, if it takes more than three lines on the terminal, it's just
> too much. :)
>
> So labrepl sounds interesting from what I read here (especially as it
> includes Incanter?).  It'd be great if it also has Swank as part of it
> so Emacs can connect to it (or does it already?).
>
> Thanks!
> Carson
>
>
> On Mar 23, 11:53 am, Lee Spector  wrote:
> > I like where this is going but I would suggest that there's a significant
> audience (including me and most of my students) in what we might call
> category A.01: Want to explore and even do some real work, but not
> necessarily work involving deploying apps, connecting to databases, working
> with third party code, or anything else that requires a full-featured
> production environment or project management system. A working REPL with
> access to contrib and a classpath that allows "load" to work (all of which I
> can get pretty painlessly with ClojureX) is *almost* enough, but the 0.01
> extra that makes an enormous difference is an editor with the minimal
> functionality of clojure-aware indentation and bracket matching.
> >
> > I'm intrigued by what I've read here about labrepl, but can someone tell
> me if it's possible that the lein installation step will mess up my existing
> setup in any way? Not knowing anything about lein, and having had a
> confusing time creating my setup that now works (with ClojureX + slime), I
> don't want to endanger it. This is part of the reason that I (and I presume
> others who have expressed similar sentiments) really like the idea of a
> "getting started" package for which the installation process is literally
> just "download and double click" or maybe "download, unzip, and double
> click". (And "if you don't like it, throw away what you downloaded and the
> rest of your system will be unchanged.")
> >
> > For me the functionality threshold for such a package, which would not
> only get me started but allow me to do serious work (AI research, not
> application development) and teach using Clojure, is: a REPL, access to
> contrib, a classpath that lets "load" find my source files, and a
> clojure-indenting, bracket-matching editor. Anything else is gravy, but most
> of the existing "getting started" setups fall short of my threshold at least
> on the editor front.
> >
> >  -Lee
> >
> > On Mar 23, 2010, at 11:30 AM, Stuart Halloway wrote:
> >
> >
> >
> >
> >
> > > I think it is important to be clear about the difference between:
> >
> > > (A) exploring Clojure (non trivially, including interesting Java
> libraries)
> >
> > > (B) deploying Clojure into production.
> >
> > > I nominate the labrepl (http://github.com/relevance/labrepl) as a
> solution for (A). It already includes interesting libraries (e.g. compojure,
> incanter), and it has instructions for working with different IDEs (which I
> hope the community will improve upon).
> >
> > > I don't think there is, or needs to be, a one-size-fits-all solution
> for (B). That's what the Java ecosystem is for. Plus, beginners don't need
> (B).
> >
> > > Stu
> >
> > >> So perhaps it would be worthwhile to create, like jruby, a single zip/
> > >> tgz file containing clojure, clojure-contrib, and a reasonable bin/clj
> > >> file that will find at least the core clojure jar files on its own? I
> > >> don't see how you're going to actually deploy any clojure apps, or
> > >> connect to a database, or really use any third party code at all
> > >> without understanding how java's classpath works but at least you can
> > >> get a REPL going.
> >
> > >> --
> > >> 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 first post.
> > >> To unsubscribe from this group, send email to
> > >> clojure+unsubscr...@googlegroups.com
> > >> For more options, visit this group at
> > >>http://groups.google.com/group/clojure?hl=en
> >
> > >> To unsubscribe from this group, send email to clojure+
> unsubscribegooglegroups.com or reply to this email with the words "REMOVE
> ME" as the subject.

listing factors of a number

2010-03-23 Thread Glen Rubin
Does anyone know of any existing libraries for clojure that has code
which is optimized to list all of the factors of any given integer?

-- 
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 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

To unsubscribe from this group, send email to 
clojure+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.


Would it be possible to make a "dumped" clojure, a la dumped emacs?

2010-03-23 Thread Alex Coventry
I am considering developing for Android using clojure, but I gather
it's slow to start up.  I'm wondering whether the startup delay would
be substantially reduced in a "dumped" version of clojure.  This would
be an image which already contains initialized versions of most of the
data structures clojure generates on startup, much like the emacs
build process bootstraps itself to a binary which contains most of the
standard libraries already loaded.  (http://www.gnu.org/software/emacs/
elisp/html_node/Building-Emacs.html)  Is there anyone already working
on something like this, and if not, does it sound like a feasible and
effective approach?

-- 
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 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

To unsubscribe from this group, send email to 
clojure+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.


Re: The % Schemer Series - are they worth the money?

2010-03-23 Thread Marek Kubica
On Tue, 23 Mar 2010 08:37:06 -0700 (PDT)
Sean Devlin  wrote:

> I'm looking to add to my bookshelf.  I was wondering what this groups
> experience with the Schemer series of books is?

Yes, The Little Schemer is nice when you need to learn recursion. I
currently read The Reasoned Schemer and it is definitely mind-expanding.

regards,
Marek

-- 
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 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

To unsubscribe from this group, send email to 
clojure+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.


Can't call public method of non-public class

2010-03-23 Thread Konstantin Barskiy
I'm trying to reproduce ProcessBuilder example from java documentation
http://java.sun.com/javase/6/docs/api/java/lang/ProcessBuilder.html
This is that example:

ProcessBuilder pb = new ProcessBuilder("myCommand", "myArg1",
"myArg2");
 Map env = pb.environment();
 env.put("VAR1", "myValue");
 env.remove("OTHERVAR");
 env.put("VAR2", env.get("VAR1") + "suffix");
 pb.directory(new File("myDir"));
 Process p = pb.start();

I'm typing folowing in clojure repl:

D:\Users\Konstantin>java -jar clojure.jar
Clojure 1.1.0
user=> (def pb (new ProcessBuilder ["myCommand" "myArg"]))
#'user/pb
user=> (def env (.environment pb))
#'user/env
user=> (.put env "VAR1", "myValue")
java.lang.IllegalArgumentException: Can't call public method of non-
public class: public java.lang.String
java.lang.ProcessEnvironment.put(java.lang.String,java.lang.String)
(NO_SOURCE_FILE:0)

What does this error mean and what i am doing wrong?

-- 
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 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

To unsubscribe from this group, send email to 
clojure+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.


Re: Why I have chosen not to employ clojure

2010-03-23 Thread Carson
I second Lee's thought -- my "work" as a grad student is AI research,
not application development.  I'm glad I discovered Incanter's package
(three lines of instructions [1]) that allows me to run a Swank server
that I can easily connect to from Emacs (and Slime from the Emacs end
can be easily installed thru Elpa).  The part about getting Swank/
Slime easily going achieves the threshold on the editor front.

[1] from http://data-sorcery.org/2009/12/20/getting-started/
$ git clone git://github.com/liebke/incanter.git
$ cd incanter
$ mvn install

then $ bin/clj to get a repl on the terminal or $ bin/swank to start
up a swank server.

For me, if it takes more than three lines on the terminal, it's just
too much. :)

So labrepl sounds interesting from what I read here (especially as it
includes Incanter?).  It'd be great if it also has Swank as part of it
so Emacs can connect to it (or does it already?).

Thanks!
Carson


On Mar 23, 11:53 am, Lee Spector  wrote:
> I like where this is going but I would suggest that there's a significant 
> audience (including me and most of my students) in what we might call 
> category A.01: Want to explore and even do some real work, but not 
> necessarily work involving deploying apps, connecting to databases, working 
> with third party code, or anything else that requires a full-featured 
> production environment or project management system. A working REPL with 
> access to contrib and a classpath that allows "load" to work (all of which I 
> can get pretty painlessly with ClojureX) is *almost* enough, but the 0.01 
> extra that makes an enormous difference is an editor with the minimal 
> functionality of clojure-aware indentation and bracket matching.
>
> I'm intrigued by what I've read here about labrepl, but can someone tell me 
> if it's possible that the lein installation step will mess up my existing 
> setup in any way? Not knowing anything about lein, and having had a confusing 
> time creating my setup that now works (with ClojureX + slime), I don't want 
> to endanger it. This is part of the reason that I (and I presume others who 
> have expressed similar sentiments) really like the idea of a "getting 
> started" package for which the installation process is literally just 
> "download and double click" or maybe "download, unzip, and double click". 
> (And "if you don't like it, throw away what you downloaded and the rest of 
> your system will be unchanged.")
>
> For me the functionality threshold for such a package, which would not only 
> get me started but allow me to do serious work (AI research, not application 
> development) and teach using Clojure, is: a REPL, access to contrib, a 
> classpath that lets "load" find my source files, and a clojure-indenting, 
> bracket-matching editor. Anything else is gravy, but most of the existing 
> "getting started" setups fall short of my threshold at least on the editor 
> front.
>
>  -Lee
>
> On Mar 23, 2010, at 11:30 AM, Stuart Halloway wrote:
>
>
>
>
>
> > I think it is important to be clear about the difference between:
>
> > (A) exploring Clojure (non trivially, including interesting Java libraries)
>
> > (B) deploying Clojure into production.
>
> > I nominate the labrepl (http://github.com/relevance/labrepl) as a solution 
> > for (A). It already includes interesting libraries (e.g. compojure, 
> > incanter), and it has instructions for working with different IDEs (which I 
> > hope the community will improve upon).
>
> > I don't think there is, or needs to be, a one-size-fits-all solution for 
> > (B). That's what the Java ecosystem is for. Plus, beginners don't need (B).
>
> > Stu
>
> >> So perhaps it would be worthwhile to create, like jruby, a single zip/
> >> tgz file containing clojure, clojure-contrib, and a reasonable bin/clj
> >> file that will find at least the core clojure jar files on its own? I
> >> don't see how you're going to actually deploy any clojure apps, or
> >> connect to a database, or really use any third party code at all
> >> without understanding how java's classpath works but at least you can
> >> get a REPL going.
>
> >> --
> >> 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 first post.
> >> To unsubscribe from this group, send email to
> >> clojure+unsubscr...@googlegroups.com
> >> For more options, visit this group at
> >>http://groups.google.com/group/clojure?hl=en
>
> >> To unsubscribe from this group, send email to 
> >> clojure+unsubscribegooglegroups.com or reply to this email with the words 
> >> "REMOVE ME" as the subject.
>
> > --
> > 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

Re: Counting vowels, take II.

2010-03-23 Thread Douglas Philips

On 2010 Mar 23, at 8:26 AM, Meikel Brandmeyer wrote:

here some notes:


Thanks!


I would use vector instead of list in the example since vector is more
idiomatic in Clojure.


Ok. Just my old lisp roots showing. Still haven't gotten the fingers/ 
spine

rewired to use [] around defn parameters. :)



   (if (seq seq1)
   (lazy-seq


Use when-let (more idiomatic) and move lazy-seq outside to achieve
full laziness. Otherwise realisation of the seq is always one step
ahead.


Thanks. I wasn't sure how high to lift the lazy-seq. Still annoying that
(if seq1 ...) and (if (seq seq1) ...) aren't the same. Oh well,  
that'll take

some repetition to get into the reflexes as well.




 (let [[s1 & s1tail]   seq1


Don't use this destructuring in this case, because it forces again the
realisation of the seq one step ahead.


If I need s1 anyways, what is the "one step ahead part" that you refer  
to?
That is just my translation of the Haskell idiom. I'm sad to see that  
there

isn't a parallel clojure idiom with the lazy semantics.



So here is my try:

(defn semi-map
  "Lazy sequence of seq1, optionally combined with seq2.
   When (pred (first seq1)) item is true, yield
   (fun (first seq1) (first seq2)) otherwise yield (first seq1)
   without advancing seq2.
   Example:
  (semi-map vowel? vector \"Hellow Word\" (iterate inc 1))
   -> (\\H [\\e 1] \\l \\l [\\o 2] \\w \\space \\W [\\o 3] \\r \\d)"
  [pred f seq1 seq2]
  (lazy-seq
(when-let [seq1 (seq seq1)]
  (let [fst1 (first seq1)]
(if (pred fst1)
  (cons (f fst1 (first seq2))
(semi-map pred f (rest seq1) (rest seq2)))
  (cons fst1 (semi-map pred f (rest seq1) seq2)))


Thanks!

-Doug

--
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 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

To unsubscribe from this group, send email to clojure+unsubscribegooglegroups.com or 
reply to this email with the words "REMOVE ME" as the subject.


Re: Confused about "=", native java arrays and seqs...

2010-03-23 Thread Frank Siebenlist
Sorry, I copied the wrong snippet from my repl - the correct one is:

...
user> (= (.getBytes "a")(.getBytes "a"))
false
user> (= (seq (.getBytes "a")) (seq (.getBytes "a")))
true
...

although the previous extra "(bytes...)" doesn't change the example, it may add 
to the confusion ;-)

-FS/



On Mar 23, 2010, at 10:24 AM, Frank Siebenlist wrote:

> My REPL shows:
> ...
> user> (= (bytes (.getBytes "a"))(bytes (.getBytes "a")))
> false
> user> (= (seq (bytes (.getBytes "a"))) (seq (bytes (.getBytes "a"
> true
> ...
> 
> in other words, "equality" for java byte arrays is defined differently than 
> their seq'ed version.
> 
> It seems that the native arrays are compared on their reference while the 
> seq'ed version on their value (as it should...).
> 
> Sometimes the seq'ing seems implied, however, like in:
> 
> ...
> user> (first (bytes (.getBytes "a")))
> 97
> ...
> 
> but for the "=" function it is not.
> 
> This doesn't feel right and is confusing to say the least.
> 
> Could anyone shed some light on this behaviour?
> 
> Thanks, Frank.
> 

-- 
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 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

To unsubscribe from this group, send email to 
clojure+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.


Confused about "=", native java arrays and seqs...

2010-03-23 Thread Frank Siebenlist
My REPL shows:
...
user> (= (bytes (.getBytes "a"))(bytes (.getBytes "a")))
false
user> (= (seq (bytes (.getBytes "a"))) (seq (bytes (.getBytes "a"
true
...

in other words, "equality" for java byte arrays is defined differently than 
their seq'ed version.

It seems that the native arrays are compared on their reference while the 
seq'ed version on their value (as it should...).

Sometimes the seq'ing seems implied, however, like in:

...
user> (first (bytes (.getBytes "a")))
97
...

but for the "=" function it is not.

This doesn't feel right and is confusing to say the least.

Could anyone shed some light on this behaviour?

Thanks, Frank.

-- 
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 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

To unsubscribe from this group, send email to 
clojure+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.


Re: Counting vowels, take II.

2010-03-23 Thread Douglas Philips

On 2010 Mar 23, at 9:14 AM, Per Vognsen wrote:


Remember the one-liner I gave you last time?


Yup. It was the 'hard coded + 0' parts that had been ruminating in the  
back of my mind as being something that could be abstracted out. :)


Since the one you just posted didn't have all the features of my  
version, I've taken the liberty of

adjusting it:
; Variation on Per Vognsen's version.
(defn semi-map
  [pred fun seq1 seq2]
  "Lazy sequence of seq1 optionally combined with seq2.
   when pred on seq1 item is true, yield fun of seq1 and seq2
   otherwise yield seq1 item without advancing seq2.
   Example: (semi-map vowel? vector \"Hello Word\" (iterate inc 1))
   -> (\\H [\\e 1] \\l \\l [\\o 2] \\space \\W [\\o 3] \\r \\d)
  "
  (map #(if (pred %1) (fun %1 (first %2)) %1)
   seq1
   (reductions #(if (pred %2) (rest %1) %1)
   seq2 seq1)))
;;;

What I don't understand (yet) is how to do a lazyness analysis on this  
similar to what

Meikel Brandmeyer did with my original code.

So, for my own understanding:
the outermost map is lazy, hence nothing will happen it the first  
result needs to be realized.

OK, so far so good.
when the first result of the map needs to be realized, I'm  
getting a bit foggy...
the 2nd parameter to map 'seq1' will have to have its first  
element (and tail?) realized

in order to call the mapping function #(if...)
the 3rd parameter to map '(reductions...)' will have to have its  
first element realized
in order to call the mapping function #(if...) of the  
outermost map.

then:
In order to realize the first value of the result of reductions,  
both the first value of seq1
   has to be realized to pass in as the second parameter to the  
reductions' function #(if ...)


Ok, so now my head hurts. But in a good way.

I think I have convinced myself that the only "eager" realization/ 
evaluation might be of the tail of seq1, but I'm not sure.


Thanks Per!

-Doug

--
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 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

To unsubscribe from this group, send email to clojure+unsubscribegooglegroups.com or 
reply to this email with the words "REMOVE ME" as the subject.


Re: ANN: labrepl, making Clojure more accessible

2010-03-23 Thread Rich Hickey


On Mar 23, 10:13 am, Stuart Halloway 
wrote:
> The labrepl project (http://github.com/relevance/labrepl) is a  
> tutorial environment for learning Clojure. It is open source under the  
> same license as Clojure. Whether you are learning Clojure on your own,  
> or teaching or learning in a classroom environment, I want labrepl to  
> be useful to you.
>
> Features:
>
> * A compojure-based application that delivers step-by-step  
> instructions for writing Clojure code
> * lab instructions, solutions, and tests (currently enough for 3-4  
> days of instructor-led training, YMMV)
> * IDE integration (ish, see below)
>
> Help wanted:
>
> As the creator of labrepl, I intend to keep it up to date. I will be  
> adding new labs, adding new features, and making sure that the labs  
> all work with whatever new hotness appears in the Clojure language.  
> But I need your help. Specifically, I would like volunteers to sign up  
> for the following tasks:
>
> (1) NetBeans integration: Test the instructions in the README and make  
> sure that they work, and show off NetBeans/Enclojure in its best  
> light. Bonus credit for writing a lab specifically on using Enclojure.
> (2) CounterClockwise integration: Ditto above but for Eclipse/
> Counterclockwise.
> (3) IDEA integration: Ditto but for IDEA/La Clojure.
> (4) Maven integration. The instruction use leiningen and project.clj,  
> but the maven pom.xml is checked in. For Java folks, it might be  
> easier to have instructions that just use maven and skip leiningen.
> (5) Out-of-box experience audit. Is the leiningen-based setup easy  
> enough? If not, please make something simpler (maybe shell scripts  
> that pull the libs from a download site?)
> (6) Better windows instructions/integration.
>
> Let's make getting started with Clojure easier!
>

I've shaken out the Netbeans+Enclojure recipe. Thanks to Eric Thorsen
for providing a quick patch to Enclojure so the working directory is
set to the project directory. I've enhanced the docs in the README to
provide a complete recipe. The short of it - just pull labrepl from
git, and Enclojure can do the rest. No command line, no lein, no
maven. The labrepl browser can run from the Enclojure integrated repl.

Rich

-- 
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 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

To unsubscribe from this group, send email to 
clojure+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.


Re: Why I have chosen not to employ clojure

2010-03-23 Thread Michael Richter
On 23 March 2010 23:11, Brian Hurt  wrote:
>
> On Tue, Mar 23, 2010 at 11:07 AM, cageface  wrote:
>
>> So perhaps it would be worthwhile to create, like jruby, a single zip/
>> tgz file containing clojure, clojure-contrib, and a reasonable bin/clj
>> file that will find at least the core clojure jar files on its own? I
>> don't see how you're going to actually deploy any clojure apps, or
>> connect to a database, or really use any third party code at all
>> without understanding how java's classpath works but at least you can
>> get a REPL going.
>
>

> I comment that if you buy the Pragmatic Programmer's Clojure book, you get
> effectively this.
>

Or you can just download the environment from the Pragmatic web
site
.

-- 
"Perhaps people don't believe this, but throughout all of the discussions of
entering China our focus has really been what's best for the Chinese people.
It's not been about our revenue or profit or whatnot."
--Sergey Brin, demonstrating the emptiness of the "don't be evil" mantra.

-- 
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 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

To unsubscribe from this group, send email to 
clojure+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.


Re: General question: Petri nets and STM in clojure

2010-03-23 Thread Ryan Teo
Okie, thanks a lot! I'll bend my mind over other things then.. =p

Yup, I'm catching up on the videos I should watch.

Thank you!
Ryan

On Mar 22, 9:58 pm, alux  wrote:
> Hi Ryan,
>
> well, to describe in the terms of Petri nets how the Clojure STM is
> built? Thats a good topic for a thesis, but rather hard to do in news
> group articles.
>
> If you try to understand how to use the STM in Clojure, Petri nets
> probably will not help you. STM rather asks you to forget the stuff
> under the hood. (The best way I know to learn this is still Rich
> Hickeys videos.)
>
> Dont know whether thats been helpful, but I cant do more.
>
> Kind regards, alxu
>
> Ryan Teo schrieb:
>
> > Hi alux, Andrej,
> >   Thanks!
> >   I'm still trying to understand how STM works in Clojure, so I would
> > be happy if someone could tell me what's the relationship between
> > Petri nets and the STM model.
> >   Is Petri nets analogous to the STM? If you have any good online
> > resource, I would be very grateful if you can send some to me.
> >   Hopefully, the understanding I get can be shared with everyone. I
> > think concurrency is quite important for today's applications, and I'm
> > quite interested in that aspect of Clojure.
>
> > Ryan
>
> > On Mar 22, 11:14 am, Andrzej  wrote:
> > > On Mon, Mar 22, 2010 at 4:36 AM, alux  wrote:
>
> > > > as far as I understand, Petri nets are as powerful as any concurrent
> > > > mechanism. That means you can do all the good things Clojure does, and
> > > > all the bad things (the other languages do :) too in Petri nets.
>
> > > I wonder if Petri nets can be applied for modeling systems based on
> > > STM (in Clojure's flavor). I've only seen them used in common
> > > lock-based designs (not that it means anything - I barely touched the
> > > surface).
>
> > > Andrzej

-- 
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 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

To unsubscribe from this group, send email to 
clojure+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.


The end goal

2010-03-23 Thread Joel Martin
I'll know that this problem is solved when the Setup and Getting
Started sections of the main Getting Started page resemble this:

-
For debian and Ubuntu users:
apt-get install clojure

For Fedora and CentOS users:
yum install clojure

For other distributions:
wget XXX.tgz
tar xvzf XXX.tgz
./XXX/install.sh
source /etc/profile

Now run the REPL:
clj
-

This implies several things:

- The clojure package is in the universe or equivalent repo for
respective distros

- The clojure package is a meta-package that pulls in all the basics
needed for a useable clojure environment:
  - clojure-base (or whatever it is named as long as it's not
'clojure')
  - clojure-contrib
  - Java
  - documentation and examples
  - emacs config/example/integration
  - vim config/syntax highlight files, etc)
  - a default repl launcher with command line history and one that
catches Ctrl-C

- Clojure is a first class citizen on the system. It is installed to
normal system locations, paths/classpaths are configured to work out
of the box, the repl launcher is in /usr/bin (or at least in the
system default path)


Until Clojure is quite popular, distributions are unlikely to spend
effort on packaging it, but Clojure won't become popular until it is
packaged well for popular distributions (this is a typical problem
actually). This means that the Clojure community will have to have
people who know and are willing to endure the tedium of distro
packaging.

-- 
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 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

To unsubscribe from this group, send email to 
clojure+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.


Re: Why I have chosen not to employ clojure

2010-03-23 Thread Stuart Halloway
Labrepl (via leiningen) puts jars in a local lib directory. They  
shouldn't collide with to break anything else.


Stu


Lein is a command line tool that you can use independently of your
environment.  99.9% sure you won't break anything by installing it.

Is this right Phil?

Sean

On Mar 23, 2:53 pm, Lee Spector  wrote:
I like where this is going but I would suggest that there's a  
significant audience (including me and most of my students) in what  
we might call category A.01: Want to explore and even do some real  
work, but not necessarily work involving deploying apps, connecting  
to databases, working with third party code, or anything else that  
requires a full-featured production environment or project  
management system. A working REPL with access to contrib and a  
classpath that allows "load" to work (all of which I can get pretty  
painlessly with ClojureX) is *almost* enough, but the 0.01 extra  
that makes an enormous difference is an editor with the minimal  
functionality of clojure-aware indentation and bracket matching.


I'm intrigued by what I've read here about labrepl, but can someone  
tell me if it's possible that the lein installation step will mess  
up my existing setup in any way? Not knowing anything about lein,  
and having had a confusing time creating my setup that now works  
(with ClojureX + slime), I don't want to endanger it. This is part  
of the reason that I (and I presume others who have expressed  
similar sentiments) really like the idea of a "getting started"  
package for which the installation process is literally just  
"download and double click" or maybe "download, unzip, and double  
click". (And "if you don't like it, throw away what you downloaded  
and the rest of your system will be unchanged.")


For me the functionality threshold for such a package, which would  
not only get me started but allow me to do serious work (AI  
research, not application development) and teach using Clojure, is:  
a REPL, access to contrib, a classpath that lets "load" find my  
source files, and a clojure-indenting, bracket-matching editor.  
Anything else is gravy, but most of the existing "getting started"  
setups fall short of my threshold at least on the editor front.


 -Lee

On Mar 23, 2010, at 11:30 AM, Stuart Halloway wrote:




I think it is important to be clear about the difference between:


(A) exploring Clojure (non trivially, including interesting Java  
libraries)



(B) deploying Clojure into production.


I nominate the labrepl (http://github.com/relevance/labrepl) as a  
solution for (A). It already includes interesting libraries (e.g.  
compojure, incanter), and it has instructions for working with  
different IDEs (which I hope the community will improve upon).


I don't think there is, or needs to be, a one-size-fits-all  
solution for (B). That's what the Java ecosystem is for. Plus,  
beginners don't need (B).



Stu


So perhaps it would be worthwhile to create, like jruby, a single  
zip/
tgz file containing clojure, clojure-contrib, and a reasonable  
bin/clj
file that will find at least the core clojure jar files on its  
own? I

don't see how you're going to actually deploy any clojure apps, or
connect to a database, or really use any third party code at all
without understanding how java's classpath works but at least you  
can

get a REPL going.



--
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 first post.

To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


To unsubscribe from this group, send email to clojure 
+unsubscribegooglegroups.com or reply to this email with the  
words "REMOVE ME" as the subject.



--
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 first post.

To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


To unsubscribe from this group, send email to clojure 
+unsubscribegooglegroups.com or reply to this email with the words  
"REMOVE ME" as the subject.


--
Lee Spector, Professor of Computer Science
School of Cognitive Science, Hampshire College
893 West Street, Amherst, MA 01002-3359
lspec...@hampshire.edu,http://hampshire.edu/lspector/
Phone: 413-559-5352, Fax: 413-559-5438

Check out Genetic Programming and Evolvable 
Machines:http://www.springer.com/10710-http://gpemjournal.blogspot.com/


--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to

Re: Why I have chosen not to employ clojure

2010-03-23 Thread Sean Devlin
Lein is a command line tool that you can use independently of your
environment.  99.9% sure you won't break anything by installing it.

Is this right Phil?

Sean

On Mar 23, 2:53 pm, Lee Spector  wrote:
> I like where this is going but I would suggest that there's a significant 
> audience (including me and most of my students) in what we might call 
> category A.01: Want to explore and even do some real work, but not 
> necessarily work involving deploying apps, connecting to databases, working 
> with third party code, or anything else that requires a full-featured 
> production environment or project management system. A working REPL with 
> access to contrib and a classpath that allows "load" to work (all of which I 
> can get pretty painlessly with ClojureX) is *almost* enough, but the 0.01 
> extra that makes an enormous difference is an editor with the minimal 
> functionality of clojure-aware indentation and bracket matching.
>
> I'm intrigued by what I've read here about labrepl, but can someone tell me 
> if it's possible that the lein installation step will mess up my existing 
> setup in any way? Not knowing anything about lein, and having had a confusing 
> time creating my setup that now works (with ClojureX + slime), I don't want 
> to endanger it. This is part of the reason that I (and I presume others who 
> have expressed similar sentiments) really like the idea of a "getting 
> started" package for which the installation process is literally just 
> "download and double click" or maybe "download, unzip, and double click". 
> (And "if you don't like it, throw away what you downloaded and the rest of 
> your system will be unchanged.")
>
> For me the functionality threshold for such a package, which would not only 
> get me started but allow me to do serious work (AI research, not application 
> development) and teach using Clojure, is: a REPL, access to contrib, a 
> classpath that lets "load" find my source files, and a clojure-indenting, 
> bracket-matching editor. Anything else is gravy, but most of the existing 
> "getting started" setups fall short of my threshold at least on the editor 
> front.
>
>  -Lee
>
> On Mar 23, 2010, at 11:30 AM, Stuart Halloway wrote:
>
>
>
> > I think it is important to be clear about the difference between:
>
> > (A) exploring Clojure (non trivially, including interesting Java libraries)
>
> > (B) deploying Clojure into production.
>
> > I nominate the labrepl (http://github.com/relevance/labrepl) as a solution 
> > for (A). It already includes interesting libraries (e.g. compojure, 
> > incanter), and it has instructions for working with different IDEs (which I 
> > hope the community will improve upon).
>
> > I don't think there is, or needs to be, a one-size-fits-all solution for 
> > (B). That's what the Java ecosystem is for. Plus, beginners don't need (B).
>
> > Stu
>
> >> So perhaps it would be worthwhile to create, like jruby, a single zip/
> >> tgz file containing clojure, clojure-contrib, and a reasonable bin/clj
> >> file that will find at least the core clojure jar files on its own? I
> >> don't see how you're going to actually deploy any clojure apps, or
> >> connect to a database, or really use any third party code at all
> >> without understanding how java's classpath works but at least you can
> >> get a REPL going.
>
> >> --
> >> 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 first post.
> >> To unsubscribe from this group, send email to
> >> clojure+unsubscr...@googlegroups.com
> >> For more options, visit this group at
> >>http://groups.google.com/group/clojure?hl=en
>
> >> To unsubscribe from this group, send email to 
> >> clojure+unsubscribegooglegroups.com or reply to this email with the words 
> >> "REMOVE ME" as the subject.
>
> > --
> > 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 first post.
> > To unsubscribe from this group, send email to
> > clojure+unsubscr...@googlegroups.com
> > For more options, visit this group at
> >http://groups.google.com/group/clojure?hl=en
>
> > To unsubscribe from this group, send email to 
> > clojure+unsubscribegooglegroups.com or reply to this email with the words 
> > "REMOVE ME" as the subject.
>
> --
> Lee Spector, Professor of Computer Science
> School of Cognitive Science, Hampshire College
> 893 West Street, Amherst, MA 01002-3359
> lspec...@hampshire.edu,http://hampshire.edu/lspector/
> Phone: 413-559-5352, Fax: 413-559-5438
>
> Check out Genetic Programming and Evolvable 
> Machines:http://www.springer.com/10710-http://gpemjournal.blogspot.com/

-- 
You received this message because you a

Re: Logic programming in Clojure

2010-03-23 Thread Anniepoo
As well as optimizing compilers, there are many knowledge bases
available for prolog. Most people with a practical application that
needs an expert system are probably far more invested in that
knowledge base (the prolog code is a 'knowledge base') than in
anything else.

-- 
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 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

To unsubscribe from this group, send email to 
clojure+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.


Re: Why I have chosen not to employ clojure

2010-03-23 Thread Lee Spector

I like where this is going but I would suggest that there's a significant 
audience (including me and most of my students) in what we might call category 
A.01: Want to explore and even do some real work, but not necessarily work 
involving deploying apps, connecting to databases, working with third party 
code, or anything else that requires a full-featured production environment or 
project management system. A working REPL with access to contrib and a 
classpath that allows "load" to work (all of which I can get pretty painlessly 
with ClojureX) is *almost* enough, but the 0.01 extra that makes an enormous 
difference is an editor with the minimal functionality of clojure-aware 
indentation and bracket matching.

I'm intrigued by what I've read here about labrepl, but can someone tell me if 
it's possible that the lein installation step will mess up my existing setup in 
any way? Not knowing anything about lein, and having had a confusing time 
creating my setup that now works (with ClojureX + slime), I don't want to 
endanger it. This is part of the reason that I (and I presume others who have 
expressed similar sentiments) really like the idea of a "getting started" 
package for which the installation process is literally just "download and 
double click" or maybe "download, unzip, and double click". (And "if you don't 
like it, throw away what you downloaded and the rest of your system will be 
unchanged.") 

For me the functionality threshold for such a package, which would not only get 
me started but allow me to do serious work (AI research, not application 
development) and teach using Clojure, is: a REPL, access to contrib, a 
classpath that lets "load" find my source files, and a clojure-indenting, 
bracket-matching editor. Anything else is gravy, but most of the existing 
"getting started" setups fall short of my threshold at least on the editor 
front. 

 -Lee



On Mar 23, 2010, at 11:30 AM, Stuart Halloway wrote:

> I think it is important to be clear about the difference between:
> 
> (A) exploring Clojure (non trivially, including interesting Java libraries)
> 
> (B) deploying Clojure into production.
> 
> I nominate the labrepl (http://github.com/relevance/labrepl) as a solution 
> for (A). It already includes interesting libraries (e.g. compojure, 
> incanter), and it has instructions for working with different IDEs (which I 
> hope the community will improve upon).
> 
> I don't think there is, or needs to be, a one-size-fits-all solution for (B). 
> That's what the Java ecosystem is for. Plus, beginners don't need (B).
> 
> Stu
> 
>> So perhaps it would be worthwhile to create, like jruby, a single zip/
>> tgz file containing clojure, clojure-contrib, and a reasonable bin/clj
>> file that will find at least the core clojure jar files on its own? I
>> don't see how you're going to actually deploy any clojure apps, or
>> connect to a database, or really use any third party code at all
>> without understanding how java's classpath works but at least you can
>> get a REPL going.
>> 
>> -- 
>> 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 
>> first post.
>> To unsubscribe from this group, send email to
>> clojure+unsubscr...@googlegroups.com
>> For more options, visit this group at
>> http://groups.google.com/group/clojure?hl=en
>> 
>> To unsubscribe from this group, send email to 
>> clojure+unsubscribegooglegroups.com or reply to this email with the words 
>> "REMOVE ME" as the subject.
> 
> -- 
> 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 
> first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> 
> To unsubscribe from this group, send email to 
> clojure+unsubscribegooglegroups.com or reply to this email with the words 
> "REMOVE ME" as the subject.

--
Lee Spector, Professor of Computer Science
School of Cognitive Science, Hampshire College
893 West Street, Amherst, MA 01002-3359
lspec...@hampshire.edu, http://hampshire.edu/lspector/
Phone: 413-559-5352, Fax: 413-559-5438

Check out Genetic Programming and Evolvable Machines:
http://www.springer.com/10710 - http://gpemjournal.blogspot.com/

-- 
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 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/

Re: Logic programming in Clojure

2010-03-23 Thread jim
I've got to say that I'm not a logic programming guru. Mostly I just
see the promise there. The observation about graph search came from
the book "Simply Logical" that I linked to at the end, I believe. I
certainly didn't originate it.

If you check out Oleg's page, you'll find a lot of papers about logic
programming that will answer your question better than I could. (Along
with a ton of other interesting things to read. The man's a freakin
genius.) Check out the sourceforge page for Kanren.

http://kanren.sourceforge.net/

Konrad, you may be right about the optimizing compiler issue. With
mini-Kanren being implemented in Clojure, perhaps Hotspot could do a
good enough job optimizing to mitigate that issue somewhat. I don't
know. As I was writing that tutorial, I started thinking about ways to
implement mini-Kanren that would be better and other projects using
it. Like a business rules engine written in Clojure. Too many cool
things to work on, not enough time. :)

Jim

On Mar 23, 12:26 pm, Quzanti  wrote:
> Very interesting write up.
>
> What advantages would prolog have over such a language. Or if we are
> trying to move beyond language wars - what styles of logic programming
> would be more natural in either one or the other?
>
> I say that because my first thought is if you could build a logic
> language on top of LISP then would prolog be needed as the other AI
> language?
>
> I liked your insight on logic being a graph search.
>
> On Mar 23, 3:23 pm, jim  wrote:
>
> > I just posted a new tutorial about doing logic programming in Clojure.
> > It makes use of the mini-Kanren port to Clojure I did last year. It's
> > intended to reduce the learning curve when reading "The Reasoned
> > Schemer", which is an excellent book.
>
> >http://intensivesystems.net/tutorials/logic_prog.html
>
> > Jim

-- 
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 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

To unsubscribe from this group, send email to 
clojure+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.


Re: ANN: labrepl, making Clojure more accessible

2010-03-23 Thread Meikel Brandmeyer
Hi,

On Tue, Mar 23, 2010 at 11:37:13AM -0400, Stuart Halloway wrote:

> Absolutely!  (Shameful admission: I have never touched Vim in my life.)
> 
> I figured leaving it out entirely was the fastest way to entice a
> contributor. :-)

Hehe. And I should learn to stay quiet. :)

Sincerely
Meikel

-- 
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 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

To unsubscribe from this group, send email to 
clojure+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.


Re: The % Schemer Series - are they worth the money?

2010-03-23 Thread jim
Love 'em. Well worth the time and effort to go through them. They're
often available used for good prices on Amazon.

On Mar 23, 10:37 am, Sean Devlin  wrote:
> Hey folks,
> I'm looking to add to my bookshelf.  I was wondering what this groups
> experience with the Schemer series of books is?
>
> Sean

-- 
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 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

To unsubscribe from this group, send email to 
clojure+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.


Re: The % Schemer Series - are they worth the money?

2010-03-23 Thread Robert Campbell
I love the Little/Seasoned Schemer books. They feel lightweight, both
physically and in content, and I managed to work through them fairly
quickly. It was surprisingly fun. SICP/HTDP/PAIP, on the other hand,
have more of the textbook feel which has so far kept me from working
through them.

The only thing that's kind of bitten me in the ass is that when I
started Clojure, I wrote a lot "lower level" fns, in the style of the
book. By this I mean lots of explicit recursion with cons cells,
accumulators, etc. when in fact there were already much higher level
constructs (map/reduce/filter/etc) I should have been using. Still,
you quickly learn, and it's nice knowing the plumbing.

Rob


On Tue, Mar 23, 2010 at 6:45 PM, cody koeninger  wrote:
>
>
> On Mar 23, 10:37 am, Sean Devlin  wrote:
>> Hey folks,
>> I'm looking to add to my bookshelf.  I was wondering what this groups
>> experience with the Schemer series of books is?
>>
>> Sean
>
>
> Little, seasoned, + the little MLer are awesome, only thing that comes
> close in terms of pedagogical quality is How To Design Programs.
> Haven't read reasoned.  A little java isn't that great, that style
> doesn't really mesh well with java.
>
> The little schemer may be very basic, but given some of the job
> applicants I've seen, we'd all be better off if every programmer had
> read it at least once.
>
> --
> 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 
> first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
>
> To unsubscribe from this group, send email to 
> clojure+unsubscribegooglegroups.com or reply to this email with the words 
> "REMOVE ME" as the subject.
>

-- 
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 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

To unsubscribe from this group, send email to 
clojure+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.


Re: Why I have chosen not to employ clojure

2010-03-23 Thread cageface
On Mar 23, 11:09 am, Michael Kohl  wrote:
> http://github.com/citizen428/ClojureX/archives/1.1.0
>
> Sorry, really not trying to pitch my project here, but the archive
> above basically contains what you are asking for.

Cool. Maybe we could link this and/or Stuart's labrepl from the
getting started page?

-- 
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 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

To unsubscribe from this group, send email to 
clojure+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.


Re: Logic programming in Clojure

2010-03-23 Thread Konrad Hinsen
On 23.03.2010, at 18:26, Quzanti wrote:

> I say that because my first thought is if you could build a logic
> language on top of LISP then would prolog be needed as the other AI
> language?

Why do we need the hundreds of programming languages we have? We don't. It's 
just that different people have different ideas of what makes a language useful.

Practically speaking, the main advantage of Prolog is probably that optimizing 
compilers have been developed for quite some time. Logic programming systems in 
Lisp (and other languages) will probably never catch up with that, for lack of 
manpower.

Konrad.

-- 
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 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

To unsubscribe from this group, send email to 
clojure+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.


Re: Why I have chosen not to employ clojure

2010-03-23 Thread Michael Kohl
On Tue, Mar 23, 2010 at 4:07 PM, cageface  wrote:
> So perhaps it would be worthwhile to create, like jruby, a single zip/
> tgz file containing clojure, clojure-contrib, and a reasonable bin/clj
> file that will find at least the core clojure jar files on its own?

http://github.com/citizen428/ClojureX/archives/1.1.0

Sorry, really not trying to pitch my project here, but the archive
above basically contains what you are asking for.

Michael

-- 
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 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

To unsubscribe from this group, send email to 
clojure+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.


Re: ANN: labrepl, making Clojure more accessible

2010-03-23 Thread Stuart Halloway

Sounds like it is time to improve the README. :-)

Run the repl and browse to localhost:8080. Click on a lab to get  
started. That's it.


Better than plain HTML:
* Code less susceptible to copy paste errors: it is evaluated in  
Clojure before being rendered in the browser. (This doesn't matter a  
lot on day 1 but helps with maintainability.)
* The "show me" option makes it easy to try it yourself, or be gently  
led by the code.


Better than plain REPL:
* works out of the box
* classpath already correct for fun third-party libs
* IDE setup already done

Better than either:
* Won't fall out of date. Has a test suite, which I run regularly.
* Aspires to be systematic, not just a one-off tutorial on topic A.  
(Admittedly not there yet.)


This isn't rocket science, but it is sweating the details. Or it will  
be. Make me sweat.


Stu

On 23 March 2010 14:13, Stuart Halloway   
wrote:
The labrepl project (http://github.com/relevance/labrepl) is a  
tutorial
environment for learning Clojure. It is open source under the same  
license
as Clojure. Whether you are learning Clojure on your own, or  
teaching or
learning in a classroom environment, I want labrepl to be useful to  
you.


Hi Stuart,

I saw your github repo for this the other day and was intrigued after
you mentioned it in your recent screencast.

After taking a look at it, I quite like what I see, but I'm still a
little perplexed on how it is supposed to be used.

Do you care to enlighten the un-enlightened on the workflow and
benefits of labrepl over some plain html tutorials and a standard
clojure REPL?

R.

--
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 first post.

To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

To unsubscribe from this group, send email to clojure 
+unsubscribegooglegroups.com or reply to this email with the words  
"REMOVE ME" as the subject.


--
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 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

To unsubscribe from this group, send email to clojure+unsubscribegooglegroups.com or 
reply to this email with the words "REMOVE ME" as the subject.


Re: The % Schemer Series - are they worth the money?

2010-03-23 Thread cody koeninger


On Mar 23, 10:37 am, Sean Devlin  wrote:
> Hey folks,
> I'm looking to add to my bookshelf.  I was wondering what this groups
> experience with the Schemer series of books is?
>
> Sean


Little, seasoned, + the little MLer are awesome, only thing that comes
close in terms of pedagogical quality is How To Design Programs.
Haven't read reasoned.  A little java isn't that great, that style
doesn't really mesh well with java.

The little schemer may be very basic, but given some of the job
applicants I've seen, we'd all be better off if every programmer had
read it at least once.

-- 
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 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

To unsubscribe from this group, send email to 
clojure+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.


Re: ANN: labrepl, making Clojure more accessible

2010-03-23 Thread Rick Moynihan
On 23 March 2010 14:13, Stuart Halloway  wrote:
> The labrepl project (http://github.com/relevance/labrepl) is a tutorial
> environment for learning Clojure. It is open source under the same license
> as Clojure. Whether you are learning Clojure on your own, or teaching or
> learning in a classroom environment, I want labrepl to be useful to you.

Hi Stuart,

I saw your github repo for this the other day and was intrigued after
you mentioned it in your recent screencast.

After taking a look at it, I quite like what I see, but I'm still a
little perplexed on how it is supposed to be used.

Do you care to enlighten the un-enlightened on the workflow and
benefits of labrepl over some plain html tutorials and a standard
clojure REPL?

R.

-- 
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 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

To unsubscribe from this group, send email to 
clojure+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.


Re: Logic programming in Clojure

2010-03-23 Thread Quzanti
Very interesting write up.

What advantages would prolog have over such a language. Or if we are
trying to move beyond language wars - what styles of logic programming
would be more natural in either one or the other?

I say that because my first thought is if you could build a logic
language on top of LISP then would prolog be needed as the other AI
language?

I liked your insight on logic being a graph search.

On Mar 23, 3:23 pm, jim  wrote:
> I just posted a new tutorial about doing logic programming in Clojure.
> It makes use of the mini-Kanren port to Clojure I did last year. It's
> intended to reduce the learning curve when reading "The Reasoned
> Schemer", which is an excellent book.
>
> http://intensivesystems.net/tutorials/logic_prog.html
>
> Jim

-- 
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 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

To unsubscribe from this group, send email to 
clojure+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.


Re: The % Schemer Series - are they worth the money?

2010-03-23 Thread Konrad Hinsen
On 23.03.2010, at 16:45, Per Vognsen wrote:

> The Little Schemer is very basic. The Reasoned Schemer is quite
> advanced and definitely a worthwhile read.

+1 for The Reasoned Schemer. I never read the other parts.

> Lambda: The Ultimate X series of papers. One of my favorite Lisp books
> is Christian Quiennec's Lisp in Small Pieces. Though it's long out of
> print, you can probably find used copies.

Those who read French can get a recent (2007) re-edition, which is also much 
cheaper:

http://pagesperso-systeme.lip6.fr/Christian.Queinnec/WWW/LiSP.html

Konrad.

-- 
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 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

To unsubscribe from this group, send email to 
clojure+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.


Re: The % Schemer Series - are they worth the money?

2010-03-23 Thread Harold Ancell
At 10:45 AM 3/23/2010, Per Vognsen wrote:
>The Little Schemer is very basic. The Reasoned Schemer is quite
>advanced and definitely a worthwhile read.
>
>If you're looking for excellent Lisp reading material, you can't go
>wrong with Steele and Sussman's The Art of the Interpreter and their
>Lambda: The Ultimate X series of papers. One of my favorite Lisp books
>is Christian Quiennec's Lisp in Small Pieces. Though it's long out of
>print, you can probably find used copies

The paperback edition is still in print:

http://www.amazon.com/Lisp-Small-Pieces-Christian-Queinnec/dp/0521545668/

or http://tinyurl.com/y8pllql

And it is indeed very good.

- Harold

-- 
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 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

To unsubscribe from this group, send email to 
clojure+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.


Re: The % Schemer Series - are they worth the money?

2010-03-23 Thread Per Vognsen
The Little Schemer is very basic. The Reasoned Schemer is quite
advanced and definitely a worthwhile read.

If you're looking for excellent Lisp reading material, you can't go
wrong with Steele and Sussman's The Art of the Interpreter and their
Lambda: The Ultimate X series of papers. One of my favorite Lisp books
is Christian Quiennec's Lisp in Small Pieces. Though it's long out of
print, you can probably find used copies.

I won't mention the usual suspects like SICP and PAIP.

-Per

On Tue, Mar 23, 2010 at 10:37 PM, Sean Devlin  wrote:
> Hey folks,
> I'm looking to add to my bookshelf.  I was wondering what this groups
> experience with the Schemer series of books is?
>
> Sean
>
> --
> 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 
> first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
>
> To unsubscribe from this group, send email to 
> clojure+unsubscribegooglegroups.com or reply to this email with the words 
> "REMOVE ME" as the subject.
>

-- 
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 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

To unsubscribe from this group, send email to 
clojure+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.


Re: ANN: labrepl, making Clojure more accessible

2010-03-23 Thread Stuart Halloway

Absolutely!  (Shameful admission: I have never touched Vim in my life.)

I figured leaving it out entirely was the fastest way to entice a  
contributor. :-)


Stu


Hi,

On Mar 23, 3:13 pm, Stuart Halloway  wrote:


(1) NetBeans
(2) CounterClockwise
(3) IDEA
(x) Emacs


Are you also interested in Vim integration?

Sincerely
Meikel

--
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 first post.

To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

To unsubscribe from this group, send email to clojure 
+unsubscribegooglegroups.com or reply to this email with the words  
"REMOVE ME" as the subject.


--
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 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

To unsubscribe from this group, send email to clojure+unsubscribegooglegroups.com or 
reply to this email with the words "REMOVE ME" as the subject.


The % Schemer Series - are they worth the money?

2010-03-23 Thread Sean Devlin
Hey folks,
I'm looking to add to my bookshelf.  I was wondering what this groups
experience with the Schemer series of books is?

Sean

-- 
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 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

To unsubscribe from this group, send email to 
clojure+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.


Re: ANN: labrepl, making Clojure more accessible

2010-03-23 Thread Meikel Brandmeyer
Hi,

On Mar 23, 3:13 pm, Stuart Halloway  wrote:

> (1) NetBeans
> (2) CounterClockwise
> (3) IDEA
> (x) Emacs

Are you also interested in Vim integration?

Sincerely
Meikel

-- 
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 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

To unsubscribe from this group, send email to 
clojure+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.


Re: Why I have chosen not to employ clojure

2010-03-23 Thread Stuart Halloway

I think it is important to be clear about the difference between:

(A) exploring Clojure (non trivially, including interesting Java  
libraries)


(B) deploying Clojure into production.

I nominate the labrepl (http://github.com/relevance/labrepl) as a  
solution for (A). It already includes interesting libraries (e.g.  
compojure, incanter), and it has instructions for working with  
different IDEs (which I hope the community will improve upon).


I don't think there is, or needs to be, a one-size-fits-all solution  
for (B). That's what the Java ecosystem is for. Plus, beginners don't  
need (B).


Stu


So perhaps it would be worthwhile to create, like jruby, a single zip/
tgz file containing clojure, clojure-contrib, and a reasonable bin/clj
file that will find at least the core clojure jar files on its own? I
don't see how you're going to actually deploy any clojure apps, or
connect to a database, or really use any third party code at all
without understanding how java's classpath works but at least you can
get a REPL going.

--
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 first post.

To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

To unsubscribe from this group, send email to clojure 
+unsubscribegooglegroups.com or reply to this email with the words  
"REMOVE ME" as the subject.


--
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 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

To unsubscribe from this group, send email to clojure+unsubscribegooglegroups.com or 
reply to this email with the words "REMOVE ME" as the subject.


Re: Why I have chosen not to employ clojure

2010-03-23 Thread Stuart Halloway
You also get this with the labrepl (http://github.com/relevance/ 
labrepl) which is free. Plus I am attempting (with a little help from  
you all) to keep the labrepl working with various IDEs.


Stu


Stuart's book is by all accounts excellent, but I'm not sure we want
to be in the situation that Ruby once was in, where buying a book
(PragProg's Pickaxe book) was virtually a prerequisite for getting
started.

-Per

On Tue, Mar 23, 2010 at 10:11 PM, Brian Hurt   
wrote:



On Tue, Mar 23, 2010 at 11:07 AM, cageface   
wrote:


So perhaps it would be worthwhile to create, like jruby, a single  
zip/
tgz file containing clojure, clojure-contrib, and a reasonable bin/ 
clj
file that will find at least the core clojure jar files on its  
own? I

don't see how you're going to actually deploy any clojure apps, or
connect to a database, or really use any third party code at all
without understanding how java's classpath works but at least you  
can

get a REPL going.



I comment that if you buy the Pragmatic Programmer's Clojure book,  
you get

effectively this.

Brian

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

first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

To unsubscribe from this group, send email to
clojure+unsubscribegooglegroups.com or reply to this email with the  
words

"REMOVE ME" as the subject.



--
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 first post.

To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

To unsubscribe from this group, send email to clojure 
+unsubscribegooglegroups.com or reply to this email with the words  
"REMOVE ME" as the subject.


--
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 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

To unsubscribe from this group, send email to clojure+unsubscribegooglegroups.com or 
reply to this email with the words "REMOVE ME" as the subject.


Logic programming in Clojure

2010-03-23 Thread jim
I just posted a new tutorial about doing logic programming in Clojure.
It makes use of the mini-Kanren port to Clojure I did last year. It's
intended to reduce the learning curve when reading "The Reasoned
Schemer", which is an excellent book.

http://intensivesystems.net/tutorials/logic_prog.html

Jim

-- 
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 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

To unsubscribe from this group, send email to 
clojure+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.


Re: ANN: labrepl, making Clojure more accessible

2010-03-23 Thread Per Vognsen
This is awesome, Stuart. With the live web server, a great addition
would be if the embedded code snippets would be interactively runnable
and tweakable right there in the web page. I'll see about hacking that
in myself.

-Per

On Tue, Mar 23, 2010 at 9:13 PM, Stuart Halloway
 wrote:
> The labrepl project (http://github.com/relevance/labrepl) is a tutorial
> environment for learning Clojure. It is open source under the same license
> as Clojure. Whether you are learning Clojure on your own, or teaching or
> learning in a classroom environment, I want labrepl to be useful to you.
>
> Features:
>
> * A compojure-based application that delivers step-by-step instructions for
> writing Clojure code
> * lab instructions, solutions, and tests (currently enough for 3-4 days of
> instructor-led training, YMMV)
> * IDE integration (ish, see below)
>
> Help wanted:
>
> As the creator of labrepl, I intend to keep it up to date. I will be adding
> new labs, adding new features, and making sure that the labs all work with
> whatever new hotness appears in the Clojure language. But I need your help.
> Specifically, I would like volunteers to sign up for the following tasks:
>
> (1) NetBeans integration: Test the instructions in the README and make sure
> that they work, and show off NetBeans/Enclojure in its best light. Bonus
> credit for writing a lab specifically on using Enclojure.
> (2) CounterClockwise integration: Ditto above but for
> Eclipse/Counterclockwise.
> (3) IDEA integration: Ditto but for IDEA/La Clojure.
> (4) Maven integration. The instruction use leiningen and project.clj, but
> the maven pom.xml is checked in. For Java folks, it might be easier to have
> instructions that just use maven and skip leiningen.
> (5) Out-of-box experience audit. Is the leiningen-based setup easy enough?
> If not, please make something simpler (maybe shell scripts that pull the
> libs from a download site?)
> (6) Better windows instructions/integration.
>
> Let's make getting started with Clojure easier!
>
> Stu
>
> --
> 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
> first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
>
> To unsubscribe from this group, send email to
> clojure+unsubscribegooglegroups.com or reply to this email with the words
> "REMOVE ME" as the subject.
>

-- 
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 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

To unsubscribe from this group, send email to 
clojure+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.


Re: ANN: labrepl, making Clojure more accessible

2010-03-23 Thread Alex Ott
Hello

Stuart Halloway  at "Tue, 23 Mar 2010 10:37:51 -0400" wrote:
 SH> GIt just needed a little push. It's there now. Thanks Rich!

It's better to add


  
com.theoryinpractise
clojure-maven-plugin
1.3
  


into  section, and


  swank-clojure
  swank-clojure
  1.1.0-SNAPSHOT


into dependencies - in this case user can get access to 'mvn clojure:repl'
& 'mvn clojure:swank' commands

-- 
With best wishes, Alex Ott, MBA
http://alexott.blogspot.com/   http://alexott.net
http://alexott-ru.blogspot.com/

-- 
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 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

To unsubscribe from this group, send email to 
clojure+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.


Re: Why I have chosen not to employ clojure

2010-03-23 Thread Per Vognsen
Stuart's book is by all accounts excellent, but I'm not sure we want
to be in the situation that Ruby once was in, where buying a book
(PragProg's Pickaxe book) was virtually a prerequisite for getting
started.

-Per

On Tue, Mar 23, 2010 at 10:11 PM, Brian Hurt  wrote:
>
>
> On Tue, Mar 23, 2010 at 11:07 AM, cageface  wrote:
>>
>> So perhaps it would be worthwhile to create, like jruby, a single zip/
>> tgz file containing clojure, clojure-contrib, and a reasonable bin/clj
>> file that will find at least the core clojure jar files on its own? I
>> don't see how you're going to actually deploy any clojure apps, or
>> connect to a database, or really use any third party code at all
>> without understanding how java's classpath works but at least you can
>> get a REPL going.
>>
>
> I comment that if you buy the Pragmatic Programmer's Clojure book, you get
> effectively this.
>
> Brian
>
> --
> 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
> first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
>
> To unsubscribe from this group, send email to
> clojure+unsubscribegooglegroups.com or reply to this email with the words
> "REMOVE ME" as the subject.
>

-- 
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 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

To unsubscribe from this group, send email to 
clojure+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.


Re: Accidentally Retaining Head?

2010-03-23 Thread Per Vognsen
By the way, you seem to misunderstand some of the workings of GC. In
the kind of generational scheme used in virtually all modern
algorithms, a collection of the nursery (where allocations are first
hatched) will only be forced when the memory assigned to the nursery
is exhausted--not the memory of any higher generations.

-Per

On Tue, Mar 23, 2010 at 9:49 PM, aria42  wrote:
> Whoops duh. That was silly, far to early on the west coast.
>
> On Mar 23, 7:46 am, Per Vognsen  wrote:
>> It doesn't seem very accidental: the namespace binding for 'trees' is
>> retaining the head. You probably want to wrap it in a function:
>>
>> (defn trees []
>>   ...)
>>
>> -Per
>>
>> On Tue, Mar 23, 2010 at 9:40 PM, aria42  wrote:
>> > Hi,
>> >  I was experimenting with some code and I had an largish sequence I
>> > did  a doseq over. The memory hit the ceiling, which you expect since
>> > even though the head isn't retained GC doesn't happen until you hit
>> > your memory limit (is there a way to change that). Once it hit the
>> > memory limit, 1.2 gigs in this case,   the doseq slows to a halt.
>>
>> >  On the other hand if rather than make a long lazy seq, I do it
>> > implicitly in the doseq itself  (see FAST snippet below), the
>> > performance is great. Is there anyway to get good performance using a
>> > single lazy seq?  Relevant snippets below.
>>
>> > Thanks, Aria
>>
>> > (defn lines
>> >  "get lines from gz file"
>> >  [#^String path]
>> >  (-> path
>> >      java.io.FileInputStream.
>> >      java.util.zip.GZIPInputStream.
>> >      java.io.InputStreamReader.
>> >      java.io.BufferedReader.
>> >      line-seq))
>>
>> > ; the tree-from-str does some processing, but doesn't have state
>> > (def trees (for [l (lines "/usr/local/corpora//NANC/003.gz")
>> >                 :when (not (empty? l))
>> >                 :let [[t _] (tree/tree-from-str l)]]
>> >             t))
>>
>> > ; SLOW: hits memory limit and becomes slow b/c of constant
>> > ; GC hits
>> > (doseq [t trees]
>> >  (println (str t)))
>>
>> > ; FAST: low memory
>> > (doseq [l (lines "/usr/local/corpora//NANC/003.gz")
>> >                 :when (not (empty? l))
>> >                 :let [[t _] (tree/tree-from-str l)]]
>> >             (println (str t)))
>>
>> > --
>> > 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 first post.
>> > To unsubscribe from this group, send email to
>> > clojure+unsubscr...@googlegroups.com
>> > For more options, visit this group at
>> >http://groups.google.com/group/clojure?hl=en
>>
>> > To unsubscribe from this group, send email to 
>> > clojure+unsubscribegooglegroups.com or reply to this email with the words 
>> > "REMOVE ME" as the subject.
>>
>>
>
> --
> 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 
> first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
>
> To unsubscribe from this group, send email to 
> clojure+unsubscribegooglegroups.com or reply to this email with the words 
> "REMOVE ME" as the subject.
>

-- 
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 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

To unsubscribe from this group, send email to 
clojure+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.


Re: Why I have chosen not to employ clojure

2010-03-23 Thread Brian Hurt
On Tue, Mar 23, 2010 at 11:07 AM, cageface  wrote:

> So perhaps it would be worthwhile to create, like jruby, a single zip/
> tgz file containing clojure, clojure-contrib, and a reasonable bin/clj
> file that will find at least the core clojure jar files on its own? I
> don't see how you're going to actually deploy any clojure apps, or
> connect to a database, or really use any third party code at all
> without understanding how java's classpath works but at least you can
> get a REPL going.
>
>
I comment that if you buy the Pragmatic Programmer's Clojure book, you get
effectively this.

Brian

-- 
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 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

To unsubscribe from this group, send email to 
clojure+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.


Re: Why I have chosen not to employ clojure

2010-03-23 Thread cageface
So perhaps it would be worthwhile to create, like jruby, a single zip/
tgz file containing clojure, clojure-contrib, and a reasonable bin/clj
file that will find at least the core clojure jar files on its own? I
don't see how you're going to actually deploy any clojure apps, or
connect to a database, or really use any third party code at all
without understanding how java's classpath works but at least you can
get a REPL going.

-- 
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 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

To unsubscribe from this group, send email to 
clojure+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.


Re: Accidentally Retaining Head?

2010-03-23 Thread aria42
Whoops duh. That was silly, far to early on the west coast.

On Mar 23, 7:46 am, Per Vognsen  wrote:
> It doesn't seem very accidental: the namespace binding for 'trees' is
> retaining the head. You probably want to wrap it in a function:
>
> (defn trees []
>   ...)
>
> -Per
>
> On Tue, Mar 23, 2010 at 9:40 PM, aria42  wrote:
> > Hi,
> >  I was experimenting with some code and I had an largish sequence I
> > did  a doseq over. The memory hit the ceiling, which you expect since
> > even though the head isn't retained GC doesn't happen until you hit
> > your memory limit (is there a way to change that). Once it hit the
> > memory limit, 1.2 gigs in this case,   the doseq slows to a halt.
>
> >  On the other hand if rather than make a long lazy seq, I do it
> > implicitly in the doseq itself  (see FAST snippet below), the
> > performance is great. Is there anyway to get good performance using a
> > single lazy seq?  Relevant snippets below.
>
> > Thanks, Aria
>
> > (defn lines
> >  "get lines from gz file"
> >  [#^String path]
> >  (-> path
> >      java.io.FileInputStream.
> >      java.util.zip.GZIPInputStream.
> >      java.io.InputStreamReader.
> >      java.io.BufferedReader.
> >      line-seq))
>
> > ; the tree-from-str does some processing, but doesn't have state
> > (def trees (for [l (lines "/usr/local/corpora//NANC/003.gz")
> >                 :when (not (empty? l))
> >                 :let [[t _] (tree/tree-from-str l)]]
> >             t))
>
> > ; SLOW: hits memory limit and becomes slow b/c of constant
> > ; GC hits
> > (doseq [t trees]
> >  (println (str t)))
>
> > ; FAST: low memory
> > (doseq [l (lines "/usr/local/corpora//NANC/003.gz")
> >                 :when (not (empty? l))
> >                 :let [[t _] (tree/tree-from-str l)]]
> >             (println (str t)))
>
> > --
> > 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 first post.
> > To unsubscribe from this group, send email to
> > clojure+unsubscr...@googlegroups.com
> > For more options, visit this group at
> >http://groups.google.com/group/clojure?hl=en
>
> > To unsubscribe from this group, send email to 
> > clojure+unsubscribegooglegroups.com or reply to this email with the words 
> > "REMOVE ME" as the subject.
>
>

-- 
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 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

To unsubscribe from this group, send email to 
clojure+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.


Re: Accidentally Retaining Head?

2010-03-23 Thread Per Vognsen
It doesn't seem very accidental: the namespace binding for 'trees' is
retaining the head. You probably want to wrap it in a function:

(defn trees []
  ...)

-Per


On Tue, Mar 23, 2010 at 9:40 PM, aria42  wrote:
> Hi,
>  I was experimenting with some code and I had an largish sequence I
> did  a doseq over. The memory hit the ceiling, which you expect since
> even though the head isn't retained GC doesn't happen until you hit
> your memory limit (is there a way to change that). Once it hit the
> memory limit, 1.2 gigs in this case,   the doseq slows to a halt.
>
>  On the other hand if rather than make a long lazy seq, I do it
> implicitly in the doseq itself  (see FAST snippet below), the
> performance is great. Is there anyway to get good performance using a
> single lazy seq?  Relevant snippets below.
>
> Thanks, Aria
>
> (defn lines
>  "get lines from gz file"
>  [#^String path]
>  (-> path
>      java.io.FileInputStream.
>      java.util.zip.GZIPInputStream.
>      java.io.InputStreamReader.
>      java.io.BufferedReader.
>      line-seq))
>
> ; the tree-from-str does some processing, but doesn't have state
> (def trees (for [l (lines "/usr/local/corpora//NANC/003.gz")
>                 :when (not (empty? l))
>                 :let [[t _] (tree/tree-from-str l)]]
>             t))
>
> ; SLOW: hits memory limit and becomes slow b/c of constant
> ; GC hits
> (doseq [t trees]
>  (println (str t)))
>
> ; FAST: low memory
> (doseq [l (lines "/usr/local/corpora//NANC/003.gz")
>                 :when (not (empty? l))
>                 :let [[t _] (tree/tree-from-str l)]]
>             (println (str t)))
>
> --
> 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 
> first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
>
> To unsubscribe from this group, send email to 
> clojure+unsubscribegooglegroups.com or reply to this email with the words 
> "REMOVE ME" as the subject.
>

-- 
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 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

To unsubscribe from this group, send email to 
clojure+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.


Re: Help optimizing array-to-integer operation?

2010-03-23 Thread Per Vognsen
Interesting. It's Clojure 1.2.0-master-SNAPSHOT as of last week:

Clojure 1.2.0-master-SNAPSHOT
user=> 0xff
255
user=> (byte 0xff)
java.lang.IllegalArgumentException: Value out of range for byte: 255
(NO_SOURCE_FILE:0)

So, this looks like a new issue. Rich?

-Per

On Tue, Mar 23, 2010 at 8:39 PM, Mark J. Reed  wrote:
> On Tue, Mar 23, 2010 at 8:40 AM, Per Vognsen  wrote:
>> Sorry, I didn't put that right. 0xFF would only be -1 as a signed
>> byte. What I'm saying is that the interaction between the type system
>> of integers and the reader's hexadecimal notation is pretty surprising
>> to me. In particular, (byte 0xFF) throws an error.
>
> What version?  It works here:
>
> Clojure 1.1.0
> user=> (byte 0xff)
> -1
>
> In fact, it seems that (byte) doesn't check the range at all:
>
> user=> (byte -129)
> 127
>
> --
> Mark J. Reed 
>
> --
> 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 
> first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
>
> To unsubscribe from this group, send email to 
> clojure+unsubscribegooglegroups.com or reply to this email with the words 
> "REMOVE ME" as the subject.
>

-- 
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 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

To unsubscribe from this group, send email to 
clojure+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.


Accidentally Retaining Head?

2010-03-23 Thread aria42
Hi,
  I was experimenting with some code and I had an largish sequence I
did  a doseq over. The memory hit the ceiling, which you expect since
even though the head isn't retained GC doesn't happen until you hit
your memory limit (is there a way to change that). Once it hit the
memory limit, 1.2 gigs in this case,   the doseq slows to a halt.

 On the other hand if rather than make a long lazy seq, I do it
implicitly in the doseq itself  (see FAST snippet below), the
performance is great. Is there anyway to get good performance using a
single lazy seq?  Relevant snippets below.

Thanks, Aria

(defn lines
  "get lines from gz file"
  [#^String path]
  (-> path
  java.io.FileInputStream.
  java.util.zip.GZIPInputStream.
  java.io.InputStreamReader.
  java.io.BufferedReader.
  line-seq))

; the tree-from-str does some processing, but doesn't have state
(def trees (for [l (lines "/usr/local/corpora//NANC/003.gz")
 :when (not (empty? l))
 :let [[t _] (tree/tree-from-str l)]]
 t))

; SLOW: hits memory limit and becomes slow b/c of constant
; GC hits
(doseq [t trees]
  (println (str t)))

; FAST: low memory
(doseq [l (lines "/usr/local/corpora//NANC/003.gz")
 :when (not (empty? l))
 :let [[t _] (tree/tree-from-str l)]]
 (println (str t)))

-- 
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 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

To unsubscribe from this group, send email to 
clojure+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.


Re: ANN: labrepl, making Clojure more accessible

2010-03-23 Thread Stuart Halloway

GIt just needed a little push. It's there now. Thanks Rich!


On Mar 23, 2010, at 10:13 AM, Stuart Halloway wrote:

The labrepl project (http://github.com/relevance/labrepl) is a  
tutorial environment for learning Clojure. It is open source under  
the same license as Clojure. Whether you are learning Clojure on  
your own, or teaching or learning in a classroom environment, I  
want labrepl to be useful to you.


Features:

* A compojure-based application that delivers step-by-step  
instructions for writing Clojure code
* lab instructions, solutions, and tests (currently enough for 3-4  
days of instructor-led training, YMMV)

* IDE integration (ish, see below)

Help wanted:

As the creator of labrepl, I intend to keep it up to date. I will  
be adding new labs, adding new features, and making sure that the  
labs all work with whatever new hotness appears in the Clojure  
language. But I need your help. Specifically, I would like  
volunteers to sign up for the following tasks:


(1) NetBeans integration: Test the instructions in the README and  
make sure that they work, and show off NetBeans/Enclojure in its  
best light. Bonus credit for writing a lab specifically on using  
Enclojure.


I don't see any instructions for Netbeans+ Enclojure

(2) CounterClockwise integration: Ditto above but for Eclipse/ 
Counterclockwise.

(3) IDEA integration: Ditto but for IDEA/La Clojure.
(4) Maven integration. The instruction use leiningen and  
project.clj, but the maven pom.xml is checked in. For Java folks,  
it might be easier to have instructions that just use maven and  
skip leiningen.


I don't see pom.xml

Rich


--
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 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

To unsubscribe from this group, send email to clojure+unsubscribegooglegroups.com or 
reply to this email with the words "REMOVE ME" as the subject.


Re: Help optimizing array-to-integer operation?

2010-03-23 Thread Mark J. Reed
On Tue, Mar 23, 2010 at 8:40 AM, Per Vognsen  wrote:
> Sorry, I didn't put that right. 0xFF would only be -1 as a signed
> byte. What I'm saying is that the interaction between the type system
> of integers and the reader's hexadecimal notation is pretty surprising
> to me. In particular, (byte 0xFF) throws an error.

What version?  It works here:

Clojure 1.1.0
user=> (byte 0xff)
-1

In fact, it seems that (byte) doesn't check the range at all:

user=> (byte -129)
127

-- 
Mark J. Reed 

-- 
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 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

To unsubscribe from this group, send email to 
clojure+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.


Re: ANN: labrepl, making Clojure more accessible

2010-03-23 Thread Rich Hickey


On Mar 23, 2010, at 10:13 AM, Stuart Halloway wrote:

The labrepl project (http://github.com/relevance/labrepl) is a  
tutorial environment for learning Clojure. It is open source under  
the same license as Clojure. Whether you are learning Clojure on  
your own, or teaching or learning in a classroom environment, I want  
labrepl to be useful to you.


Features:

* A compojure-based application that delivers step-by-step  
instructions for writing Clojure code
* lab instructions, solutions, and tests (currently enough for 3-4  
days of instructor-led training, YMMV)

* IDE integration (ish, see below)

Help wanted:

As the creator of labrepl, I intend to keep it up to date. I will be  
adding new labs, adding new features, and making sure that the labs  
all work with whatever new hotness appears in the Clojure language.  
But I need your help. Specifically, I would like volunteers to sign  
up for the following tasks:


(1) NetBeans integration: Test the instructions in the README and  
make sure that they work, and show off NetBeans/Enclojure in its  
best light. Bonus credit for writing a lab specifically on using  
Enclojure.


I don't see any instructions for Netbeans+ Enclojure

(2) CounterClockwise integration: Ditto above but for Eclipse/ 
Counterclockwise.

(3) IDEA integration: Ditto but for IDEA/La Clojure.
(4) Maven integration. The instruction use leiningen and  
project.clj, but the maven pom.xml is checked in. For Java folks, it  
might be easier to have instructions that just use maven and skip  
leiningen.


I don't see pom.xml

Rich

--
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 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

To unsubscribe from this group, send email to clojure+unsubscribegooglegroups.com or 
reply to this email with the words "REMOVE ME" as the subject.


Re: ANN: labrepl, making Clojure more accessible

2010-03-23 Thread Michael Kohl
First off, great work on labrepl! I told people about it last night at
our functional programming user group and they seemed to like the
concept a lot :-)

On Tue, Mar 23, 2010 at 3:13 PM, Stuart Halloway
 wrote:

> (5) Out-of-box experience audit. Is the leiningen-based setup easy enough?

IMHO it's perfect since it's simple, well documented and also
introduces new Clojurians to Leiningen right away.

Tonight I'll hopefully have some time to go through the labs and fix
some more minor formatting issues and typos :-)

Michael

-- 
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 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

To unsubscribe from this group, send email to 
clojure+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.


ANN: labrepl, making Clojure more accessible

2010-03-23 Thread Stuart Halloway
The labrepl project (http://github.com/relevance/labrepl) is a  
tutorial environment for learning Clojure. It is open source under the  
same license as Clojure. Whether you are learning Clojure on your own,  
or teaching or learning in a classroom environment, I want labrepl to  
be useful to you.


Features:

* A compojure-based application that delivers step-by-step  
instructions for writing Clojure code
* lab instructions, solutions, and tests (currently enough for 3-4  
days of instructor-led training, YMMV)

* IDE integration (ish, see below)

Help wanted:

As the creator of labrepl, I intend to keep it up to date. I will be  
adding new labs, adding new features, and making sure that the labs  
all work with whatever new hotness appears in the Clojure language.  
But I need your help. Specifically, I would like volunteers to sign up  
for the following tasks:


(1) NetBeans integration: Test the instructions in the README and make  
sure that they work, and show off NetBeans/Enclojure in its best  
light. Bonus credit for writing a lab specifically on using Enclojure.
(2) CounterClockwise integration: Ditto above but for Eclipse/ 
Counterclockwise.

(3) IDEA integration: Ditto but for IDEA/La Clojure.
(4) Maven integration. The instruction use leiningen and project.clj,  
but the maven pom.xml is checked in. For Java folks, it might be  
easier to have instructions that just use maven and skip leiningen.
(5) Out-of-box experience audit. Is the leiningen-based setup easy  
enough? If not, please make something simpler (maybe shell scripts  
that pull the libs from a download site?)

(6) Better windows instructions/integration.

Let's make getting started with Clojure easier!

Stu

--
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 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

To unsubscribe from this group, send email to clojure+unsubscribegooglegroups.com or 
reply to this email with the words "REMOVE ME" as the subject.


Re: Nubie Question

2010-03-23 Thread Per Vognsen
By definition, persistent data structures are never mutable. But there
are various kinds of mutable references (vars, refs, atoms, agents)
that can _refer_ to persistent (hence unchanging) data structures.

While David has given you an answer to your immediate query, I would
ask you to step back and consider whether you're sure you really need
references. You haven't supplied enough context for us to make that
call.

-Per

On Tue, Mar 23, 2010 at 8:35 PM, WoodHacker  wrote:
> I understand how conj works.    But how do you add a value to a
> persistent vector?    You have to add the new item to the vector with
> (conj vector item), but how do you assign the return value to the
> persistent vector.   So far I have it working with a def  -- (def
> vector (conj vector item)) -- but I'm not sure this is 'pure'
> Clojure.    Is there a better way, functionally, or am I there?
> Functional programming is the best way to go, but very few programs
> can exist without mutable persistent data.
>
> Bill
>
> --
> 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 
> first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
>
> To unsubscribe from this group, send email to 
> clojure+unsubscribegooglegroups.com or reply to this email with the words 
> "REMOVE ME" as the subject.
>

-- 
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 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

To unsubscribe from this group, send email to 
clojure+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.


Re: clojure and clojure-contrib jars built with the 1.5 jdk

2010-03-23 Thread Stuart Sierra
On Mar 23, 9:43 am, Stuart Sierra  wrote:
> If the JAR manifest is the problem, the following pom.xml lines will
> change it:

Yet another option is to supply a completely custom manifest file that
omits the Build-Jdk line altogether.

But I still think the correct solution is to install JDK 1.5 on
build.clojure.org.
-SS

-- 
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 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

To unsubscribe from this group, send email to 
clojure+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.


Re: Nubie Question

2010-03-23 Thread David Nolen
On Tue, Mar 23, 2010 at 9:35 AM, WoodHacker  wrote:

> I understand how conj works.But how do you add a value to a
> persistent vector?You have to add the new item to the vector with
> (conj vector item), but how do you assign the return value to the
> persistent vector.   So far I have it working with a def  -- (def
> vector (conj vector item)) -- but I'm not sure this is 'pure'
> Clojure.Is there a better way, functionally, or am I there?
> Functional programming is the best way to go, but very few programs
> can exist without mutable persistent data.
>
> Bill
>

conj _does_ let you add a value to a persistent vector. The question is how
do you save this value for future use. Don't use def. Use a mutable
reference type. One way:

(def my-vector (atom []))
(swap! my-vector conj 'foo)
@my-vector ; [foo]

Depending on your use case agents or refs might be better suited.

David

-- 
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 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

To unsubscribe from this group, send email to 
clojure+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.


Re: clojure and clojure-contrib jars built with the 1.5 jdk

2010-03-23 Thread Stuart Sierra
On Mar 23, 9:08 am, Eric Thorsen  wrote:
> The above returns the running jvm version.  I was looking at the jar
> manifest to see what it was built with which is where I saw the 1.6
> reference for clojure-contrib.

If the JAR manifest is the problem, the following pom.xml lines will
change it:

  
org.apache.maven.plugins
maven-jar-plugin

  

  1.5.0

  

  

But that makes me slightly nervous, because it's a lie.  We didn't
REALLY build contrib with JDK 1.5, we just changed the manifest.

-SS

-- 
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 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

To unsubscribe from this group, send email to 
clojure+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.


Nubie Question

2010-03-23 Thread WoodHacker
I understand how conj works.But how do you add a value to a
persistent vector?You have to add the new item to the vector with
(conj vector item), but how do you assign the return value to the
persistent vector.   So far I have it working with a def  -- (def
vector (conj vector item)) -- but I'm not sure this is 'pure'
Clojure.Is there a better way, functionally, or am I there?
Functional programming is the best way to go, but very few programs
can exist without mutable persistent data.

Bill

-- 
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 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

To unsubscribe from this group, send email to 
clojure+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.


Re: clojure.contrib.json.write.print-json type coverage

2010-03-23 Thread Stuart Sierra
Current version of clojure.contrib.json on the github master branch
uses protocols, and should have better type coverage.

-SS



On Mar 22, 2:24 pm, Jieren Chen  wrote:
> Hey everyone
>
> I've come across a few situations where the print-json multi-method
> does not cover certain types that may be desirable to have (ex.
> java.math.BigDecimal and java.util.Date)
>
> It's really easy to hack your way around this, but I was just
> wondering if there's any demand for a change to the actual
> clojure.contrib.json multimethod to account for these types
>
> If you have any examples of additional types that the multi-method
> doesn't cover, I'd be interested to know those too.
>
> Thanks!
> Jieren

-- 
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 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

To unsubscribe from this group, send email to 
clojure+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.


Re: clojure and clojure-contrib jars built with the 1.5 jdk

2010-03-23 Thread Stuart Sierra
On Mar 23, 9:08 am, Eric Thorsen  wrote:
> The above returns the running jvm version.  I was looking at the jar
> manifest to see what it was built with which is where I saw the 1.6
> reference for clojure-contrib.

Oh, it's the JAR manifest that's the problem?  Maybe this will help:
http://maven.apache.org/guides/mini/guide-manifest.html

-SS

-- 
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 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

To unsubscribe from this group, send email to 
clojure+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.


Re: clojure and clojure-contrib jars built with the 1.5 jdk

2010-03-23 Thread Stuart Sierra
On Mar 23, 9:08 am, Eric Thorsen  wrote:
> Having the target=1.5 property set for the clojure-contrib build might
> get me where I need to be.  I just have not had a chance to try it
> yet.

The clojure-contrib build does not call javac, so it shouldn't matter.

-SS

-- 
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 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

To unsubscribe from this group, send email to 
clojure+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.


Re: Introduction + question re. diff between 'Programming Clojure'

2010-03-23 Thread Meikel Brandmeyer
Hi,

On Mar 23, 2:18 pm, Stuart Halloway  wrote:

> I am pretty sure the book uses the idiomatic Java interop forms except  
> where specifically demonstrating the other forms exist. If that is not  
> true it is an erratum, please let me know.

Uh. Sorry. I was told in the book the old form was used. If this is
not true this was a misinformation on my side. I apologise.

Sincerely
Meikel

-- 
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 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

To unsubscribe from this group, send email to 
clojure+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.


Re: Introduction + question re. diff between 'Programming Clojure'

2010-03-23 Thread Stuart Halloway
I am pretty sure the book uses the idiomatic Java interop forms except  
where specifically demonstrating the other forms exist. If that is not  
true it is an erratum, please let me know.


Stu


Hi,

one difference which shows up everywhere, is the method and
constructor notation. While in the book the old is used - (. obj
(method args ...)) - one should stick to the new one - (.method obj
args ...). Similar for Contructors. (note trailing dot) and Static/
methodCalls.

Since I haven't read the book, yet, I can't say for other differences.

Sincerely
Meikel

--
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 first post.

To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

To unsubscribe from this group, send email to clojure 
+unsubscribegooglegroups.com or reply to this email with the words  
"REMOVE ME" as the subject.


--
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 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

To unsubscribe from this group, send email to clojure+unsubscribegooglegroups.com or 
reply to this email with the words "REMOVE ME" as the subject.


Re: Counting vowels, take II.

2010-03-23 Thread Per Vognsen
Remember the one-liner I gave you last time?

(defn indexed-pred [pred coll]
  (map #(if (pred %1) [%2 %1] [%1]) coll (reductions + 0 (map #(if
(pred %) 1 0) coll

Here's how little it has to change:

(defn funkymonkey [pred src coll]
  (map #(if (pred %1) [(first %2) %1] [%1]) coll (reductions #(if
(pred %2) (rest %1) %1) src coll)))

-Per

On Tue, Mar 23, 2010 at 6:53 PM, Douglas Philips  wrote:
> Last week, Per Vognsen answered my first version of this question, how can I
> number just the vowels in a string:
> http://groups.google.com/group/clojure/msg/22186113b36041f1?hl=en
>
> But that got me thinking that "numbering" was just an instance of consuming
> from the (iterate inc 0) sequence.
> As I am fleshing out more of my program, I find it appealing to abstract out
> this pattern of using
> a predict on one sequence to control the consumption of and combination with
> another sequence.
>
> Here is my more general version (in the API sense) of that concept.
> Names are hard and I don't particularly like semi-map but I like it better
> than all the other names I've come up with so far. Hopefully this message
> will be sent/read with a fixed-width font. Any and all criticisms,
> suggestions, improvements welcome. (I'm happy to use this as is, but as in
> my first message, I have this nagging feeling that it could be simpler or
> more idiomatic)
>
> Thanks,
>        -Doug
>
>
>
> (defn semi-map
>  "Lazy sequence of seq1, optionally combined with seq2.
>   When (pred (first seq1)) item is true, yield (fun (first seq1) (first
> seq2))
>   otherwise yield (first seq1) without advancing seq2.
>   Example:
>      (semi-map vowel? list \"Hellow Word\" (iterate inc 1))
>   -> (\\H (\\e 1) \\l \\l (\\o 2) \\w \\space \\W (\\o 3) \\r \\d)"
>  [pred fun seq1 seq2]
>  (if (seq seq1)
>      (lazy-seq
>        (let [[s1 & s1tail]   seq1
>              pred?           (pred s1)
>              [news1 newseq2] (if pred? [(fun s1 (first seq2)) (rest seq2)]
>                                        [s1 seq2])]
>          (cons news1 (xyzzy pred fun s1tail newseq2))
>
> --
> 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
> first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
>
> To unsubscribe from this group, send email to
> clojure+unsubscribegooglegroups.com or reply to this email with the words
> "REMOVE ME" as the subject.
>

-- 
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 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

To unsubscribe from this group, send email to 
clojure+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.


Re: Why I have chosen not to employ clojure

2010-03-23 Thread Sean Devlin
On Mar 22, 9:40 pm, Michael Richter  wrote:
> On 23 March 2010 00:13, Luc Préfontaine  wrote:
>
> >  I looked at these videos and they are a very good starting point.
> > Then do we have a communication problem getting these things known ?
> > Are these videos listed on the "Getting started" page ?
>
> Let's see if I can get this across without profanity.
>
> *VIDEOS ARE NOT DOCUMENTATION!*
>
> Yeah.  That gets my most of my utter contempt of this recent trend of using
> videos to document software across without the profanity. If you want the
> full deal, throw the f-bomb in between each word and append a piece of
> profanity that ends with "suckers".

You're right, videos aren't documentation.  Thanks for volunteering to
fill this gap.  Let me know when you're ready, and I'll give you make
time to review/beta test any installation documentation you provide.

Sean

>
> --
> "Perhaps people don't believe this, but throughout all of the discussions of
> entering China our focus has really been what's best for the Chinese people.
> It's not been about our revenue or profit or whatnot."
> --Sergey Brin, demonstrating the emptiness of the "don't be evil" mantra.

-- 
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 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

To unsubscribe from this group, send email to 
clojure+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.


Re: clojure and clojure-contrib jars built with the 1.5 jdk

2010-03-23 Thread Eric Thorsen
I was grabbing the snapshots of clojure and clojure-contrib and using
them in a Netbeans plugin (which needs 1.5. Netbeans just crashes in
an RT call).

(System/getProperty "java.vm.version")
The above returns the running jvm version.  I was looking at the jar
manifest to see what it was built with which is where I saw the 1.6
reference for clojure-contrib.
Having the target=1.5 property set for the clojure-contrib build might
get me where I need to be.  I just have not had a chance to try it
yet.

Thanks,
Eric


On Mar 23, 8:06 am, Alex Osborne  wrote:
> Hi Eric,
>
> Eric Thorsen  writes:
> > This is more of a maven question probably, but I have an app that
> > needs versions of the jars built with jdk 1.5 and I'm using the
> >http://build.clojure.org/snapshotsrepo where they appear to be built
> > with 1.6.  Are there versions (or plans to support 1.5 versions) in a
> > maven repo somewhere?
>
> Have you actually tested them?  Which jars in particular are you talking
> about?
>
> The 1.2.0-master jars are working fine here with 1.5:
>
> $ wgethttp://build.clojure.org/snapshots/org/clojure/clojure/1.2.0-master-S...
> $ wgethttp://build.clojure.org/snapshots/org/clojure/clojure-contrib/1.2.0-...
> $ java -cp 
> clojure-1.2.0-master-20100319.170114-16.jar:clojure-contrib-1.2.0-master-20 
> 100122.191106-1.jar clojure.main
> Clojure 1.2.0-master-SNAPSHOT
> user=> (require 'clojure.contrib.seq-utils)
> nil
> user=> (System/getProperty "java.vm.version")
> "1.5.0_12-b04"
> user=>
>
> Also even 1.5.0_01 and an older snapshot from January:
>
> $ /opt/java/jdk1.5.0_01/bin/java -jar 
> clojure-1.2.0-master-20100111.160127-1.jar
> Clojure 1.2.0-master-SNAPSHOT
> user=>
>
> Obviously 1.4 doesn't work but I couldn't trigger any problems with
> 1.5.
>
> Is there something in particular you were doing?
>
> Cheers,
>
> Alex

-- 
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 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

To unsubscribe from this group, send email to 
clojure+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.


Re: Help optimizing array-to-integer operation?

2010-03-23 Thread Per Vognsen
Sorry, I didn't put that right. 0xFF would only be -1 as a signed
byte. What I'm saying is that the interaction between the type system
of integers and the reader's hexadecimal notation is pretty surprising
to me. In particular, (byte 0xFF) throws an error.

-Per

On Tue, Mar 23, 2010 at 7:35 PM, Per Vognsen  wrote:
> In addition, right now his Clojure code isn't directly analogous to
> his Java code. If he used an array of bytes instead of integers, he
> wouldn't need the bit-masking.
>
> Getting this to work revealed a big surprise to me. Java has only
> signed integer types: byte, short, int and long. Clojure reads 0xFF as
> the _signed_ integer 255. I would expect it to be -1. For example,
> (every? #(= % (bit-and -1 %)) (range -128 128)) evaluates to true.
> This looks like a genuine bug.
>
> -Per
>
> On Tue, Mar 23, 2010 at 7:08 PM, Konrad Hinsen
>  wrote:
>> On 23.03.2010, at 08:55, Raph wrote:
>>
>>> I have tried various hinting methods, but I cannot increase the speed.
>>> What can I do to make the clojure operations as fast as the native
>>> Java operations?
>>
>> Get rid of the reduce and unroll the bit-or computations instead:
>>
>> (defn arr-to-int [#^ints x]
>>  (bit-or (bit-shift-left (bit-and 0xFF (aget x 0)) 24)
>>         (bit-or (bit-shift-left (bit-and 0xFF (aget x 1)) 16)
>>                 (bit-or (bit-shift-left (bit-and 0xFF (aget x 2)) 8)
>>                         (bit-and 0xFF (aget x 3))
>>
>> That makes for a factor 3.3 on my machine.
>>
>> Konrad.
>>
>> --
>> 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 
>> first post.
>> To unsubscribe from this group, send email to
>> clojure+unsubscr...@googlegroups.com
>> For more options, visit this group at
>> http://groups.google.com/group/clojure?hl=en
>>
>> To unsubscribe from this group, send email to 
>> clojure+unsubscribegooglegroups.com or reply to this email with the words 
>> "REMOVE ME" as the subject.
>>
>

-- 
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 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

To unsubscribe from this group, send email to 
clojure+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.


Re: Help optimizing array-to-integer operation?

2010-03-23 Thread Per Vognsen
In addition, right now his Clojure code isn't directly analogous to
his Java code. If he used an array of bytes instead of integers, he
wouldn't need the bit-masking.

Getting this to work revealed a big surprise to me. Java has only
signed integer types: byte, short, int and long. Clojure reads 0xFF as
the _signed_ integer 255. I would expect it to be -1. For example,
(every? #(= % (bit-and -1 %)) (range -128 128)) evaluates to true.
This looks like a genuine bug.

-Per

On Tue, Mar 23, 2010 at 7:08 PM, Konrad Hinsen
 wrote:
> On 23.03.2010, at 08:55, Raph wrote:
>
>> I have tried various hinting methods, but I cannot increase the speed.
>> What can I do to make the clojure operations as fast as the native
>> Java operations?
>
> Get rid of the reduce and unroll the bit-or computations instead:
>
> (defn arr-to-int [#^ints x]
>  (bit-or (bit-shift-left (bit-and 0xFF (aget x 0)) 24)
>         (bit-or (bit-shift-left (bit-and 0xFF (aget x 1)) 16)
>                 (bit-or (bit-shift-left (bit-and 0xFF (aget x 2)) 8)
>                         (bit-and 0xFF (aget x 3))
>
> That makes for a factor 3.3 on my machine.
>
> Konrad.
>
> --
> 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 
> first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
>
> To unsubscribe from this group, send email to 
> clojure+unsubscribegooglegroups.com or reply to this email with the words 
> "REMOVE ME" as the subject.
>

-- 
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 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

To unsubscribe from this group, send email to 
clojure+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.


Re: Introduction + question re. diff between 'Programming Clojure'

2010-03-23 Thread Meikel Brandmeyer
Hi,

one difference which shows up everywhere, is the method and
constructor notation. While in the book the old is used - (. obj
(method args ...)) - one should stick to the new one - (.method obj
args ...). Similar for Contructors. (note trailing dot) and Static/
methodCalls.

Since I haven't read the book, yet, I can't say for other differences.

Sincerely
Meikel

-- 
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 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

To unsubscribe from this group, send email to 
clojure+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.


Re: Introduction + question re. diff between 'Programming Clojure'

2010-03-23 Thread Alex Osborne
Hi Thomas,

Thomas Kjeldahl Nilsson  writes:

> Question: I'm in the very first pages of the 'Programming Clojure'
> book. I understand that the language is still young and evolving, and
> thus a moving target. What's the best way of getting up to speed? Can
> I just go through the book as-is, or should I first be aware of major
> changes (since the book was published)? If so, how do you recommend
> that a beginner like myself learn current idioms and state of the
> language in general?

The book is still very relevant.  The book targets something very close
to Clojure 1.0, while the current release is 1.1.  The differences are
listed here:

http://github.com/richhickey/clojure/blob/68aa96d832703f98f80b18cecc877e3b93bc5d26/changes.txt

It might seem there are a lot of language additions there but they're
mostly optimisations (transients and chunked seqs), two new
concurrency primitives (futures and promises) and a bunch of new minor
convenience functions.

As a beginner I don't think you should need to worry too much about any
of those changes, as there's not much that has been "outdated", it's
mostly new additions which you can always learn at a later stage.  So I
suggest you go ahead and read the book as-is.

Cheers,

Alex

-- 
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 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

To unsubscribe from this group, send email to 
clojure+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.


Re: Counting vowels, take II.

2010-03-23 Thread Meikel Brandmeyer
Hi,

here some notes:

On Mar 23, 12:53 pm, Douglas Philips  wrote:

>        (semi-map vowel? list \"Hellow Word\" (iterate inc 1))
>     -> (\\H (\\e 1) \\l \\l (\\o 2) \\w \\space \\W (\\o 3) \\r \\d)"

I would use vector instead of list in the example since vector is more
idiomatic in Clojure.

>    (if (seq seq1)
>        (lazy-seq

Use when-let (more idiomatic) and move lazy-seq outside to achieve
full laziness. Otherwise realisation of the seq is always one step
ahead.

>          (let [[s1 & s1tail]   seq1

Don't use this destructuring in this case, because it forces again the
realisation of the seq one step ahead.

So here is my try:

(defn semi-map
   "Lazy sequence of seq1, optionally combined with seq2.
When (pred (first seq1)) item is true, yield
(fun (first seq1) (first seq2)) otherwise yield (first seq1)
without advancing seq2.
Example:
   (semi-map vowel? vector \"Hellow Word\" (iterate inc 1))
-> (\\H [\\e 1] \\l \\l [\\o 2] \\w \\space \\W [\\o 3] \\r \\d)"
   [pred f seq1 seq2]
   (lazy-seq
 (when-let [seq1 (seq seq1)]
   (let [fst1 (first seq1)]
 (if (pred fst1)
   (cons (f fst1 (first seq2))
 (semi-map pred f (rest seq1) (rest seq2)))
   (cons fst1 (semi-map pred f (rest seq1) seq2)))

Sincerely
Meikel

-- 
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 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

To unsubscribe from this group, send email to 
clojure+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.


Re: clojure and clojure-contrib jars built with the 1.5 jdk

2010-03-23 Thread Alex Osborne
Hi Eric,

Eric Thorsen  writes:

> This is more of a maven question probably, but I have an app that
> needs versions of the jars built with jdk 1.5 and I'm using the
> http://build.clojure.org/snapshots repo where they appear to be built
> with 1.6.  Are there versions (or plans to support 1.5 versions) in a
> maven repo somewhere?

Have you actually tested them?  Which jars in particular are you talking
about?

The 1.2.0-master jars are working fine here with 1.5:

$ wget 
http://build.clojure.org/snapshots/org/clojure/clojure/1.2.0-master-SNAPSHOT/clojure-1.2.0-master-20100319.170114-16.jar
$ wget 
http://build.clojure.org/snapshots/org/clojure/clojure-contrib/1.2.0-master-SNAPSHOT/clojure-contrib-1.2.0-master-20100122.191106-1.jar
$ java -cp 
clojure-1.2.0-master-20100319.170114-16.jar:clojure-contrib-1.2.0-master-20100122.191106-1.jar
 clojure.main
Clojure 1.2.0-master-SNAPSHOT
user=> (require 'clojure.contrib.seq-utils)
nil
user=> (System/getProperty "java.vm.version")
"1.5.0_12-b04"
user=>

Also even 1.5.0_01 and an older snapshot from January:

$ /opt/java/jdk1.5.0_01/bin/java -jar clojure-1.2.0-master-20100111.160127-1.jar
Clojure 1.2.0-master-SNAPSHOT
user=>

Obviously 1.4 doesn't work but I couldn't trigger any problems with
1.5.

Is there something in particular you were doing?

Cheers,

Alex

-- 
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 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

To unsubscribe from this group, send email to 
clojure+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.


Re: Help optimizing array-to-integer operation?

2010-03-23 Thread Konrad Hinsen
On 23.03.2010, at 08:55, Raph wrote:

> I have tried various hinting methods, but I cannot increase the speed.
> What can I do to make the clojure operations as fast as the native
> Java operations?

Get rid of the reduce and unroll the bit-or computations instead:

(defn arr-to-int [#^ints x]
 (bit-or (bit-shift-left (bit-and 0xFF (aget x 0)) 24)
 (bit-or (bit-shift-left (bit-and 0xFF (aget x 1)) 16)
 (bit-or (bit-shift-left (bit-and 0xFF (aget x 2)) 8)
 (bit-and 0xFF (aget x 3))

That makes for a factor 3.3 on my machine.

Konrad.

-- 
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 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

To unsubscribe from this group, send email to 
clojure+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.


Counting vowels, take II.

2010-03-23 Thread Douglas Philips
Last week, Per Vognsen answered my first version of this question, how  
can I number just the vowels in a string: http://groups.google.com/group/clojure/msg/22186113b36041f1?hl=en


But that got me thinking that "numbering" was just an instance of  
consuming from the (iterate inc 0) sequence.
As I am fleshing out more of my program, I find it appealing to  
abstract out this pattern of using
a predict on one sequence to control the consumption of and  
combination with another sequence.


Here is my more general version (in the API sense) of that concept.
Names are hard and I don't particularly like semi-map but I like it  
better than all the other names I've come up with so far. Hopefully  
this message will be sent/read with a fixed-width font. Any and all  
criticisms, suggestions, improvements welcome. (I'm happy to use this  
as is, but as in my first message, I have this nagging feeling that it  
could be simpler or more idiomatic)


Thanks,
-Doug



(defn semi-map
  "Lazy sequence of seq1, optionally combined with seq2.
   When (pred (first seq1)) item is true, yield (fun (first seq1)  
(first seq2))

   otherwise yield (first seq1) without advancing seq2.
   Example:
  (semi-map vowel? list \"Hellow Word\" (iterate inc 1))
   -> (\\H (\\e 1) \\l \\l (\\o 2) \\w \\space \\W (\\o 3) \\r \\d)"
  [pred fun seq1 seq2]
  (if (seq seq1)
  (lazy-seq
(let [[s1 & s1tail]   seq1
  pred?   (pred s1)
  [news1 newseq2] (if pred? [(fun s1 (first seq2)) (rest  
seq2)]

[s1 seq2])]
  (cons news1 (xyzzy pred fun s1tail newseq2))

--
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 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

To unsubscribe from this group, send email to clojure+unsubscribegooglegroups.com or 
reply to this email with the words "REMOVE ME" as the subject.


Introduction + question re. diff between 'Programming Clojure'

2010-03-23 Thread Thomas Kjeldahl Nilsson
Hello,

my name's Thomas and I'm a Clojure newbie. :) My background consists
of plenty of enterprise Java, a whole lot of JavaScript, some Ruby,
plus some Scheme (The Little Schemer). I'm finally getting off my butt
and looking at Clojure - looking forward to it. The community looks
really nice from what little I've read of the mail archive!

Question: I'm in the very first pages of the 'Programming Clojure'
book. I understand that the language is still young and evolving, and
thus a moving target. What's the best way of getting up to speed? Can
I just go through the book as-is, or should I first be aware of major
changes (since the book was published)? If so, how do you recommend
that a beginner like myself learn current idioms and state of the
language in general?


--
Regards,
Thomas Kjeldahl Nilsson
http://kjeldahlnilsson.net

-- 
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 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

To unsubscribe from this group, send email to 
clojure+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.


  1   2   >