Hello,
On Thu, Oct 29, 2009 at 2:24 PM, Meikel Brandmeyer m...@kotka.de wrote:
On Oct 29, 1:15 pm, Miron Brezuleanu mbr...@gmail.com wrote:
Cons: I'm afraid of getting the SQL generating syntax wrong and making
the data structures used for generation ugly. But I guess that can be
fixed by
Awesome! Thanks a lot. I've been needing this.
-Jeff
P.S. Maven is annoying.
On Oct 18, 6:53 pm, David Powell djpow...@djpowell.net wrote:
Hi,
I just posted a project at http://github.com/djpowell/liverepl.
It uses the Java Attach API to let you connect a Clojure REPL to any running
2009/10/18 David Powell djpow...@djpowell.net:
Hi,
I just posted a project at http://github.com/djpowell/liverepl.
It uses the Java Attach API to let you connect a Clojure REPL to any running
Java or Clojure process, without them requiring any special startup.
This is really cool and
Hi Julien.
On Thursday 29 October 2009 bal...@gmail.com wrote:
Hello,
Next is my question: can I run common lisp programs on the jvm using
clojure? I was thinking specifically to Maxima - (the formal calculus
program)?
Clojure is not source compatible to Common Lisp (and not intended to
Hi,
I'm getting some strange errors when trying to make a POST request
using the Clojure contrib http-agent library (http://
richhickey.github.com/clojure-contrib/http.agent-api.html).
When I run:
(use 'clojure.contrib.http.agent)
(println (string (http-agent http://www.google.com; :method
What is a good and simple way to run periodic tasks in Clojure? I need
to run a simple function every couple of minutes. And make sure that
if it throws an exception that it won't kill the periodic task.
I come from a Spring world where XML, Timers, Jobs and Quartz rule the
world, so am
Hello,
I've been wondering if there was a way to specify the Java and C# wrapper
classes/interfaces to wrap Clojure code in Clojure, and then writing out
them to a file so that they can ge compiled by their respective compilers.
I'm asking this because in my work, I need to support these two
On Wed, Oct 28, 2009 at 12:21 AM, Alex Osborne a...@meshy.org wrote:
Jeff Brown wrote:
I can invoke a function using Java code that looks something like this...
Reader reader = new FileReader(clj/demo.clj);
Compiler.load(reader);
Var var = RT.var(demo, add_numbers);
Object result =
On Thu, Oct 29, 2009 at 11:57 AM, Jamie jsmo...@gmail.com wrote:
First, thank you Rich Co for doing Clojure.
We've been using Clojure for a real-world project, and I thought I'd
share some observations.
Thanks - these kinds of experience reports are very useful.
Rich
On Thu, Oct 29, 2009 at 1:38 PM, Meikel Brandmeyer m...@kotka.de wrote:
All good here, but, if I do the eval variation,
user= (eval (list (symbol .setFileSelectionMode) jfc 1))
Another example which shows that eval is not worth the trouble. It is
better to use reflection. You cannot embed
Can someone suggest how to make the packets received on a socket into
a lazy sequence?
The application I'm making is a log file parser. A (Java) program is
producing log output using log4j, the output can go to file(s) or be
sent to a socket. So, the program has this outline:
(defn fileLines
Daniel Simms daniel.si...@gmail.com writes:
On Thu, Oct 29, 2009 at 4:34 PM, Rayne disciplera...@gmail.com wrote:
but I would highly recommend that you just pull it from the github
repository.
Especially if you're going to use clojure-contrib ...or is there some
release of contrib synch'd
timc wrote:
I think I know how to do fileLines, but not socketLines. (Each
received packet should contain one line as it would have been written
to a file, I think).
Something like this?
(use 'clojure.contrib.duck-streams)
(read-lines (.getInputStream socket))
My problem is not how to
On Fri, Oct 30, 2009 at 12:05 AM, Stefan Arentz ste...@arentz.ca wrote:
What is a good and simple way to run periodic tasks in Clojure? I need
to run a simple function every couple of minutes. And make sure that
if it throws an exception that it won't kill the periodic task.
I come from a
On Oct 30, 6:18 am, John Ky newho...@gmail.com wrote:
I've been wondering if there was a way to specify the Java and C# wrapper
classes/interfaces to wrap Clojure code in Clojure, and then writing out
them to a file so that they can ge compiled by their respective compilers.
I'm not sure I
Hi,
if you have a stream, you can basically do:
(defn stream-seq
[stream]
(take-while #(= 0 %) (repeatedly #(.read stream
This will give a character at a time. From there you can build the
lines and turn it into a seq of lines. Or can you can to the lower
level and use lazy-seq
Hi,
when I run a Clojure script Clojure ends directly when the script is
finished.
I would like an option to keep the Clojure REPL open when the script has
finished. Is this possible somehow?
Currently I use something like this (in WinXP):
set jar1=C:\Clojure\clojure.jar
set
How about:
(import '(java.util.concurrent Executors TimeUnit))
(let [s (Executors/newSingleThreadScheduledExecutor)]
(.scheduleAtFixedRate s
#(try
(println I did it again)
(catch Exception e
(.printStackTrace e)))
(long 0)
(long 1)
TimeUnit/SECONDS))
What's up with this?
(defn zipmap
Returns a map with the keys mapped to the corresponding vals.
[keys vals]
(loop [map {}
ks (seq keys)
vs (seq vals)]
(if (and ks vs)
(recur (assoc map (first ks) (first vs))
(next ks)
(next
John Harrop wrote:
Was something wrong with this?:
(defn my-zipmap
Returns a map with the keys mapped to the corresponding vals.
[keys vals]
(into {} (map vec (partition 2 (interleave keys vals)
:)
One reason might be that the original zipmap is 5-10 times faster for
large
On Fri, Oct 30, 2009 at 11:30 AM, Alex Osborne a...@meshy.org wrote:
John Harrop wrote:
Was something wrong with this?:
(defn my-zipmap
Returns a map with the keys mapped to the corresponding vals.
[keys vals]
(into {} (map vec (partition 2 (interleave keys vals)
:)
One
On Fri, Oct 30, 2009 at 11:37 AM, Chouser chou...@gmail.com wrote:
On Fri, Oct 30, 2009 at 11:30 AM, Alex Osborne a...@meshy.org wrote:
John Harrop wrote:
Was something wrong with this?:
(defn my-zipmap
Returns a map with the keys mapped to the corresponding vals.
[keys vals]
On Fri, Oct 30, 2009 at 11:44 AM, John Harrop jharrop...@gmail.com wrote:
On Fri, Oct 30, 2009 at 11:37 AM, Chouser chou...@gmail.com wrote:
On Fri, Oct 30, 2009 at 11:30 AM, Alex Osborne a...@meshy.org wrote:
John Harrop wrote:
Was something wrong with this?:
(defn my-zipmap
Chouser wrote:
On Fri, Oct 30, 2009 at 11:30 AM, Alex Osborne a...@meshy.org wrote:
John Harrop wrote:
Was something wrong with this?:
(defn my-zipmap
Returns a map with the keys mapped to the corresponding vals.
[keys vals]
(into {} (map vec (partition 2 (interleave keys vals)
user= (def x (int-array 3))
#'user/x
user= x
[0, 0, 0]
user= (def y (seq x))
#'user/y
user= (first y)
0
user= (aset x 1 3)
3
user= x
[0, 3, 0]
user= (second y)
3
user= (aset x 0 2)
2
user= x
[2, 3, 0]
user= (first y)
2
Here, (first y) returned first 0, then 2 without y being rebound in between.
Thanks for the help.
On Oct 30, 1:23 pm, Meikel Brandmeyer m...@kotka.de wrote:
Hi,
if you have a stream, you can basically do:
(defn stream-seq
[stream]
(take-while #(= 0 %) (repeatedly #(.read stream
This will give a character at a time. From there you can build the
lines and
No, I didn't.
On Oct 30, 8:28 am, Tassilo Horn tass...@member.fsf.org wrote:
Daniel Simms daniel.si...@gmail.com writes:
On Thu, Oct 29, 2009 at 4:34 PM, Rayne disciplera...@gmail.com wrote:
but I would highly recommend that you just pull it from the github
repository.
Especially if
On Fri, Oct 30, 2009 at 10:23 AM, Arie van Wingerden xapw...@gmail.com wrote:
Hi,
when I run a Clojure script Clojure ends directly when the script is
finished.
I would like an option to keep the Clojure REPL open when the script has
finished. Is this possible somehow?
Currently I use
eval calls read for somethings.
2009/10/30 Tiago Antão tiagoan...@gmail.com:
On Thu, Oct 29, 2009 at 1:38 PM, Meikel Brandmeyer m...@kotka.de wrote:
All good here, but, if I do the eval variation,
user= (eval (list (symbol .setFileSelectionMode) jfc 1))
Another example which shows that
I was working with a large data set earlier today, and I had written a
loop/recur where I was passing in a huge seq to the first iteration,
and I was surprised when I ran out of heap space, because I was very
careful not to hold on to the head of the seq, and I though that loop
ended up rebinding
On Oct 29, 9:57 am, Jamie jsmo...@gmail.com wrote:
5. The functionality of the docs hasn't kept up with Clojure. We
often resorted to text searches of the various sources. Need links
and see-also's. Clojure has grown/matured so much that it needs a doc
system of some sort.
I recently
On 30 Oct, 16:18, Albert Cardona sapri...@gmail.com wrote:
How about:
(import '(java.util.concurrent Executors TimeUnit))
...snip...
Admittedly very java-ish.
Personally, I think Java-ish is the way to go here. John's actor lib
is pretty nifty, but it is relying on implementation details
Clojure is actually an entirely different language in the Lisp family
of languages. In addition to ABCL (Common Lisp on the JVM), there are
also 2 or 3 Scheme implementations on the JVM.
On Oct 29, 8:09 am, bal...@gmail.com bal...@gmail.com wrote:
Hello,
First let me congratulate the clojure
When someone knowingly dips into arrays, though, aren't doing so because
they require java's semantics? For speed, interop, or whatever?
We want to champion functional programming, but on the other hand we want to
preserve the smooth java-interop use-cases. Not an easy balancing act, I
suppose.
On Thu, Oct 29, 2009 at 5:18 PM, Alex Osborne a...@meshy.org wrote:
There's a 1.0 compatible branch on github. [...]
Thanks, I missed that branch.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Groups Clojure group.
To
Alex alexspurl...@gmail.com writes:
Hi,
I'm getting some strange errors when trying to make a POST request
using the Clojure contrib http-agent library (http://
richhickey.github.com/clojure-contrib/http.agent-api.html).
When I run:
(use 'clojure.contrib.http.agent)
(println (string
5. The functionality of the docs hasn't kept up with Clojure. We
often resorted to text searches of the various sources. Need links
and see-also's. Clojure has grown/matured so much that it needs a doc
system of some sort.
This has been recognized for awhile now. I have promised to
One thing to keep in mind, when using sockets, is that TCP does not
guarantee to keep packetization across the network. That is, just
because you're writing lines, doesn't mean that read will return
lines. TCP can put writes together or break them into parts or some
combination of both.
So if
Is everything in Clojure immutable? For example, w/ this code-snippet
(let [x nil]
;; do something and modify 'x'
)
how does one modify the value of 'x' ?
(let [x nil] (def x true))
this doesn't work. the def' interns and defines a (dynamic) root-
On Oct 30, 1:37 pm, Chouser chou...@gmail.com wrote:
On Fri, Oct 30, 2009 at 10:23 AM, Arie van Wingerden xapw...@gmail.com
wrote:
Hi,
when I run a Clojure script Clojure ends directly when the script is
finished.
java -cp ~/build/clojure/clojure.jar clojure.main -i
How do I make this code faster? And leaner, i.e., use less memory ?
It's a simple function to generate NUMKEYS strings of length
KEYLENGTH,
store them in a Java array then store them in a HashMapString,Object
hash-map. [it doesn't store them in the hash-map yet; but it
allocates it]
(set!
On Fri, Oct 30, 2009 at 4:42 PM, Chick Corea chick.zco...@gmail.com wrote:
Is everything in Clojure immutable? For example, w/ this code-snippet
(let [x nil]
;; do something and modify 'x'
)
how does one modify the value of 'x' ?
(let [x nil] (def
When I first looked at Clojure, I didn't get it (I scanned the docs
for 10 - 15 minutes). A few month later, Stu Halloway said to give it
a second look and boy am I glad I did. Go read Stu's book, or at least
the first couple of chapters online at Manning. Digest for a bit.
It'll be an eye
On Fri, Oct 30, 2009 at 4:44 PM, Chick Corea chick.zco...@gmail.com wrote:
Where are those and other CLI options documented? I have not found
them.
A usage or help message could help w/ this, too.
java -cp clojure.jar clojure.main --help
--Chouser
The better question to ask is this real code you intend on using? Are you
really going to generate 100,000 random keys of 1024 chars each all at once
in a real running program?
(def *valid-chars* [\a \b \c \d \e \f \g \h \i \j \k \l \m
\n \o \p \q \r \s \t \u \v \w \x \u \z
\0 \1 \2 \3 \4
On Fri, Oct 30, 2009 at 12:40 PM, John Harrop jharrop...@gmail.com wrote:
(defn lazy-array-seq
([arr]
(lazy-array-seq arr 0))
([arr from-idx]
(lazy-array-seq arr 0 (count arr)))
([arr from-idx end-idx]
(if-not (= from-idx end-idx)
(lazy-seq (aget arr from-idx)
On Fri, Oct 30, 2009 at 3:15 PM, Paul Mooser taron...@gmail.com wrote:
Is this behavior due to some artifact of destructuring I'm not aware
of (or something else I'm missing), or is there a bug? If it sounds
like a bug, can anyone else reproduce?
Thanks!
I vaguely remember something like
Chick Corea wrote:
The corresponding Java code (w/ the hash-insert omitted in the clojure
version)
runs in 5.5sec and uses 290MB.
This code runs (which omits the hash-insert) runs in 17.8sec and uses
353MB.
I thought that I added all of the casts and warn-on-reflections that
would
During the Boston Lisp Users meeting last November (?) I asked Rich
about whether seq's on mutable java.util.Collections were really
immutable if the underlying object (the Collection) was mutable. He
emphatically said that no, the seq is still immutable, and that it
caches values as it sees
Although I suppose this isn't too surprising:
user (second y)
-- ConcurrentModificationException
--josh
On Oct 30, 9:31 pm, Josh Daghlian daghl...@gmail.com wrote:
During the Boston Lisp Users meeting last November (?) I asked Rich
about whether seq's on mutable java.util.Collections were
On Fri, Oct 30, 2009 at 9:31 PM, Josh Daghlian daghl...@gmail.com wrote:
During the Boston Lisp Users meeting last November (?) I asked Rich
about whether seq's on mutable java.util.Collections were really
immutable if the underlying object (the Collection) was mutable. He
emphatically said
On Fri, Oct 30, 2009 at 9:36 PM, Josh Daghlian daghl...@gmail.com wrote:
Although I suppose this isn't too surprising:
user (second y)
-- ConcurrentModificationException
Eeeuw. Guess it uses an Iterator to generate the elements for the lazy seq.
For ArrayList, walking it by index would
Try this:
(def *valid-chars* [ \a \b \c \d \e \f \g \h \i \j \k \l \m
\n \o \p \q \r \s \t \u \v \w \x \u \z
\0 \1 \2 \3 \4 \5 \6 \7 \8 \9 ] )
(defn generate-key [keylength]
(for [x (range keylength)] (nth *valid-chars* (rand-int (count *valid-
This is some of my first Clojure code so it might not be the
greatest ... yet!
Here is an improved memoize function that also takes a time-to-live
argument. Useful when you want to expire results from the cache.
I'm using it to cache query results from a database. This probably
breaks
(let [x nil]
;; do something and modify 'x'
)
how does one modify the value of 'x' ?
Hi Chick, there's nothing stopping you re-binding x within the let
construct, eg;
(defn myfn [x]
(let [x (if (or (nil? x) ( x 0.2)) 0.0 x)
x (if (= x 0.8) 1.0 x)]
55 matches
Mail list logo