Thanks for the response everyone! I was able to get it working. If I
understand what everyone is saying, the following statement is true:
In Clojure, laziness is the rule not the exception.
Rather than that, I'd say that you are thinking about map wrong (hope
that doesn't come across as
Is there a safe way to keep the data in a Clojure ref and the data in
a table in an external (e.g. mysql) database in sync, given concurrent
creates/updates/deletes from within Clojure?
I can't do a DB update from within a dosync because of retries. If I
send-off an agent for the DB update from
Perhaps you could do the db update as an agent action and then the ref
update within the agent action if it is successful - see
http://groups.google.co.za/group/clojure/browse_thread/thread/d645d77a8b51f01/667e833c1ea381d7
Regards, Adrian.
On Fri, Apr 3, 2009 at 11:02 AM, Brian Carper
I'm currently working on a research project which involves the
implementation of several new programming languages in a variety of
paradigms. Our current work in being done in PLT Scheme. However, we
have several other requirements which suggest that Clojure might be a
better choice: support for
Laziness is the rule only on sequence operations.
On Apr 2, 11:34 pm, Sean francoisdev...@gmail.com wrote:
Thanks for the response everyone! I was able to get it working. If I
understand what everyone is saying, the following statement is true:
In Clojure, laziness is the rule not the
Sean wrote:
I'm working with AWT, and there is a method that requires a float[]
(The java.awt.BasicStroke constructor). Is it possible to directly
create an array of primitives directly in Clojure, or do I need to
create a utility class in Java?
See:
(doc make-array)
(doc into-array)
The Clojure bit functions do not currently provide a way to query the
count of set bits in a number. Attached is a small patch to implement
this feature. I've found it useful for implementing an immutable bit
array in Clojure.
I sent my CA in earlier this week.
I'd be interested in seeing the ivy+ant solution. We use maven2 at
work and there are obvious pros and cons. With clojure, part of the
pain is initial setup and config. Maven2/ant+ivy might really help
that. Post when you get a chance...am very interested.
Thanks,
jason
On Apr 2, 8:56 pm,
Thanks for the links, Stuart, although I managed to figure out what I
was doing wrong: I didn't realize that the Java vararg type Object...
mapped to a sequence in Clojure, so I wasn't properly calling 'invoke'
in java.lang.reflect.Method.
Again, thanks for the links. I'm sure they'll be helpful
In case you haven't seen this thread:
http://groups.google.com/group/clojure/browse_frm/thread/aa22a709501a64ac/79b1c858c6d50497?lnk=gstq=transaction+database#79b1c858c6d50497
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google
Hi,
Am 03.04.2009 um 06:04 schrieb Sean:
I'm working with AWT, and there is a method that requires a float[]
(The java.awt.BasicStroke constructor). Is it possible to directly
create an array of primitives directly in Clojure, or do I need to
create a utility class in Java?
find-doc might
Someone correct me if I go wrong here. But, from my understanding,
every defined function in Clojure is an implementation of a thread?
What is the goal in implementing in this fashion? For example, if I
am writing in imperative style:
(println First line)
(println Second line)
(println Third
On Apr 3, 8:18 am, Jason Warner jasoncwar...@gmail.com wrote:
I'd be interested in seeing the ivy+ant solution. We use maven2 at
work and there are obvious pros and cons. With clojure, part of the
pain is initial setup and config. Maven2/ant+ivy might really help
that. Post when you get a
The operations will happen synchronously. Clojure will not add threading to
your code without you asking it to, but when you want to add threading there
are lots of great tools built-in to make it Easy On You (TM).
Paul
On Fri, Apr 3, 2009 at 9:36 AM, BerlinBrown berlin.br...@gmail.com wrote:
Implementing Runnable does not mean they will be called via an intermediate
thread.
I remember having seen it's there for efficiency reasons when one wants to
provide a function in lieu of where the java method expects a Runnable : so
clojure does not have to wrap the function call with another
On Apr 3, 2009, at 9:36 AM, BerlinBrown wrote:
Someone correct me if I go wrong here. But, from my understanding,
every defined function in Clojure is an implementation of a thread?
The example you gave would all happen on one thread. Perhaps what
you're thinking of is that every Clojure
2009/4/3 Berlin Brown berlin.br...@gmail.com
I cringe and throw up a little inside everytime I hear maven.
It's so easy to bash something ...
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
Clojure group.
To post
I'll just throw this out there. It may not be exactly what you're looking
for, but you could use a Terracotta cluster. Terracotta will persist the
cluster to disk. If you have an existing database that you are working with,
then this may not help, but if you are starting from scratch you may not
No threads:
(ancestors (class (fn[])))
- #{java.lang.Runnable java.io.Serializable clojure.lang.AFn
clojure.lang.Obj java.lang.Object clojure.lang.Fn
clojure.lang.AFunction clojure.lang.IObj clojure.lang.IFn
java.util.concurrent.Callable clojure.lang.IMeta java.util.Comparator}
What you
Hi all,
I would like to pull together functions that help with Java interop
and place them in a new contrib: java-utils. Some examples:
(1) Pull out SteveG's properties fn, currently hidden in the internals
of clojure.contrib.sql
(2) reflective helpers for accessing private and protected
Since I can't find the way to solve this issue, let's tackle it at a
more fundamental level.
First, I need to make sure I can print to standard output without
using *out*, so I can later, temporarily bind *out* to something else.
Also, I don't want to print directly to System/out. Later, I'll
On Fri, 3 Apr 2009 07:20:39 -0700 (PDT)
Daniel Jomphe danieljom...@gmail.com wrote:
Since I can't find the way to solve this issue, let's tackle it at a
more fundamental level.
First, I need to make sure I can print to standard output without
using *out*, so I can later, temporarily bind
The following works - note ActionListener is fully qualified:
-
user= (.addActionListener (javax.swing.JButton.)
(proxy [java.awt.event.ActionListener] []
(actionPerformed [evt]
(println button press
nil
Oh, somehow, auto-flushing doesn't work, and that's why I wasn't
seeing anything else than nil:
user= (def w (PrintWriter. (PrintStream. System/out) true))
#'user/w
user= (.print w bonjour)
nil
user= (.flush w)
bonjournil
So although I asked for auto-flushing, I need to do so
Kyle Schaffrick wrote:
Could you just make a new Var (like *always-stdout* or something) and
assign *out* to it at program start? This way the dynamic bindings on
*out* don't affect your new Var and you can continue using it to access
the real stdout.
As long as I'm willing to lose the
On Apr 3, 2009, at 10:17 AM, Stuart Halloway wrote:
If this is interesting to others (or at least inoffensive) I will move
forward with it.
I'm in favor.
I'd also like to get your latest thinking on your suggestions from
some time ago about clojure.contrib.lazy-seqs. If they can be
Does anybody know if there's a way to coerce gen-class into creating a
static block in the generated class?
thanks,
Greg
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
Clojure group.
To post to this group, send
On Apr 3, 3:29 am, Eric Tschetter eched...@gmail.com wrote:
That is, map is more geared towards type conversion of the
elements in a collection, but it is only converting the elements in
the collection, not the collection itself.
(some ellided text here...)
Reduce (also known as fold left)
When I have been experimenting on the REPL, I sometimes want to save my
work. Is there a way of serializing an image of the REPL into Clojure
sourcecode?
Joshua
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
Now that I know for sure how to bind *out* to something else over
System/out, it's time to bring back my encoding issues into scope:
(import '(java.io PrintWriter PrintStream))
(defmacro with-out-encoded
[encoding body]
`(binding [*out* (java.io.PrintWriter. (java.io.PrintStream.
Works For Me (TM).
user= (def s québécois français)
#'user/s
user= (print s)
québécois françaisnil
Are you running on Windows, Mac, or Linux? Using the Sun JVM? Which revision
of Clojure?
p...@pstadig-laptop:~$ lsb_release -a
No LSB modules are available.
Distributor ID:Ubuntu
Description:
Sorry for all these posts.
I pasted my last post's code into a fresh repl (not in my IDE), and
here's what I got (cleaned up):
#'user/s
québécois françaisnil
qu?b?cois fran?aisnil
#'user/snc
québécois françaisnil
qu?b?cois fran?aisnil
I'm not sure what to make out of it.
My
Could Clojure have something similar to CL's 'defconstant'?
http://gigamonkeys.com/book/variables.html
On Apr 2, 4:09 pm, Bradbev brad.beveri...@gmail.com wrote:
It seems to me that the real solution is that the Clojure compiler
needs to support global constants. You could probably emulate
I'm running on Mac.
In IDE (IntelliJ):
Java: Apple's 1.6
Clojure: LaClojure's version (I don't know)
In Terminal:
Java: Apple's 1.5.0_16
Clojure: 1338, 2009-04-01
Paul Stadig wrote:
Works For Me (TM).
user= (def s québécois français)
#'user/s
user= (print s)
québécois françaisnil
Are
On Fri, 3 Apr 2009 10:17:33 -0400
Stuart Halloway stuart.hallo...@gmail.com wrote:
Hi all,
I would like to pull together functions that help with Java interop
and place them in a new contrib: java-utils. Some examples:
[...]
If this is interesting to others (or at least
I tried under eclipse.
Default console encoding configuration (MacRoman):
#'user/s
quÔøΩbÔøΩcois franÔøΩaisnil
qu?b?cois fran?aisnil
#'user/snc
qu?b?cois fran?aisnil
qu?b?cois fran?aisnil
Console configured to print using ISO-8859-1:
#'user/s
qu�b�cois fran�aisnil
this one is nice too:
(defn draw-line [#^Graphics g y]
(let [dy (- 1.25 (* y height-factor))]
(doseq [x (range 0 width)]
(let [dx (- (* x width-factor) 2.0)]
(let [value (check-bounds dx dy)
scaled (Math/round (* value color-scale))
Daniel Jomphe danieljom...@gmail.com writes:
-- Emacs --
No more works since I've pulled emacs-starter-kit's latest changes. 'M-
x slime' doesn't fire up clojure anymore; slime no more exists, in
fact. The last commit actually removed clojure-mode.el. Maybe they're
in the middle of
Sean francoisdev...@gmail.com writes:
And now everything works great. What I don't understand is why the
doseq macro is required instead of the mapping operation. Could
somebody explain why Clojure has this different form for functions
that have side effects?
My take on this is that map
Brian, I imagine you are asking this in relation to your blog engine?
I came up with solution, that is, if you don't mind writing the
persistent data fresh every time.
http://paste.lisp.org/display/77987
Basically, I added a watch to the *comment* ref, which set the *db*
ref to the new state
I made some progress.
[By the way, NetBean's console displays *everything* 100% fine.
I decided to use one of the worst repl consoles: that of IntelliJ.
I want to make sure I really understand what's the point behind all
this.]
(import '(java.io PrintWriter PrintStream FileInputStream)
On Apr 3, 10:33 am, Paul Drummond paul.drumm...@iode.co.uk wrote:
The following works - note ActionListener is fully qualified:
-
user= (.addActionListener (javax.swing.JButton.)
(proxy [java.awt.event.ActionListener] []
(actionPerformed [evt]
Sorry, missed the crucial point :) The maven *repository* I have no
problems with! Even Maven itself, in appropriate environments. I just
think the set of appropriate is much smaller than Maven fans seem to think
it is!
- Korny
On Fri, Apr 3, 2009 at 2:48 PM, dysinger dysin...@gmail.com
On Apr 1, 6:21 pm, christ...@mvonessen.de wrote:
What nailgun has (beside the way cooler name) is the ability to
map *err* to stderr and *out* to stdout, which are just merged
into one datastream in my code.
OTOH, my code is written in Clojure, so it wins by default :P
This is done as of
Hi all,
I'm trying to get started with an OpenGL (JOGL) application in
Clojure, and one of the first orders of business is establishing a
thread that repeatedly calls the display function - the game loop. I'm
not sure what the idiomatic way to do this in Clojure is.
The below code works, but is
I wish I could do this:
(code...
Long error string that doesn't fit within 80 characters but is
descriptive, \
which is good, right?
...more code...)
(The string above would say, Long error string that doesn't fit
within 80 characters but is descriptive, which is good, right?)
This is how java strings work (including their workaround involving
StringBuilder objects), so I guess it's no worse than that. But I
tried adding it, and it seems like this can be implemented by adding a
single case statement to LispReader.java with no other problems.
Something like
case '\n':
The only thing I might change is the way you are incrementing the counter:
(defn counter-animation [running counter]
(when running
(send-off *agent* counter-animation (+ counter 1)))
(println counter)
(. Thread sleep 500)
running)
(defn start-animation []
(send animator (fn [x]
48 matches
Mail list logo