On Mon, Oct 27, 2008 at 10:06 PM, Stuart Halloway
<[EMAIL PROTECTED]> wrote:
>
> The code below implements a Monte Carlo simulation to estimate the
> value of pi. It works, and it was easy to reuse the original single-
> threaded approach across multiple agents.
>
> How idiomatic is this use of ag
I used Stuart Sierra's 'fcase' contrib today to good effect. Nice job,
Stuart!
I have an idea for another fcase variant that I think is useful:
(defmacro pred-case
"Case where test values are predicates to be applied to the test
value."
[test-value & clauses]
`(fcase (fn [pred# value
Hi all,
The code below implements a Monte Carlo simulation to estimate the
value of pi. It works, and it was easy to reuse the original single-
threaded approach across multiple agents.
How idiomatic is this use of agents? Other than bringing in ForkJoin,
are there other idiomatic ways to p
On Mon, Oct 27, 2008 at 4:06 PM, Rich Hickey <[EMAIL PROTECTED]> wrote:
>
>
>
> On Oct 27, 3:15 pm, "Bill Clementson" <[EMAIL PROTECTED]> wrote:
>> On Mon, Oct 27, 2008 at 11:31 AM, Rich Hickey <[EMAIL PROTECTED]> wrote:
>>
>> > On Oct 27, 12:04 pm, "Bill Clementson" <[EMAIL PROTECTED]> wrote:
>>
On Oct 27, 3:15 pm, "Bill Clementson" <[EMAIL PROTECTED]> wrote:
> On Mon, Oct 27, 2008 at 11:31 AM, Rich Hickey <[EMAIL PROTECTED]> wrote:
>
> > On Oct 27, 12:04 pm, "Bill Clementson" <[EMAIL PROTECTED]> wrote:
> >> Hi Chouser
>
> >> On Mon, Oct 27, 2008 at 8:46 AM, Chouser <[EMAIL PROTECTED]>
well :title and :visible are not the only ones i want to support, i
would like something that would work with any keyword and convert it
to the right setter.
you are right about the need for a let. i've been away from lisp for a
while, and i forgot about this sort of thing. but will a let fix my
Okay... here's my first attempt at Clojure code: make "units" that
know how to draw themselves:
(defmulti poly :Unit)
(defn unit [name x y] {:Unit :Piece :name name :x x :y y})
(defmethod poly :Piece [p]
(let [x (:x p)
y (:y p)]
(list x,y (+ x 200),y (+ x 200),(+ y 200) x,(+ y
Hi,
On 27 Okt., 21:08, Matt Moriarity <[EMAIL PROTECTED]> wrote:
> I am trying to write a macro to rewrite something like this:
>
> (set-props my-jframe :title "blah" :visible true)
>
> Into calls to the setter methods. I finally settled on this:
>
> (defmacro set-props [obj & props]
> (l
On Oct 27, 12:04 pm, "Bill Clementson" <[EMAIL PROTECTED]> wrote:
> Hi Chouser
>
> On Mon, Oct 27, 2008 at 8:46 AM, Chouser <[EMAIL PROTECTED]> wrote:
>
> > I think it's generally better to use = instead of .equals for
> > equality, unless you have a specific reason to not use = (which I
> > don
I was in the process of porting our clojure code base to work with SVN
head when I came across the following behavior. It turns out that the
upgrade to head broke our user.clj. If user.clj is broken, and you
invoke clojure.lang.Script from the command line (or from an ant build
process, or you res
On Oct 25, 10:27 am, "V.Quixote" <[EMAIL PROTECTED]> wrote:
> I'd like some version of doto that works on bare Classes
(defmacro sdoto
"Version of doto for use with static methods"
[x & methods]
`(do
~@(map (fn [m] (list '. x m))
methods)
~x))
Here you go. sdoto for
I'd like to suggest that clojure no longer look for a user.clj in the
default package (/user.clj). The user.clj file is a handy hook for
init-time code, but it's position causes the NetBeans application
framework (by default) to not load it at all, and to emit a pretty
ugly stack trace (which I'v
I am trying to write a macro to rewrite something like this:
(set-props my-jframe :title "blah" :visible true)
Into calls to the setter methods. I finally settled on this:
(defmacro set-props [obj & props]
(let [prop-map (apply hash-map props)]
`(do
~(for [[key val] prop-
On Mon, Oct 27, 2008 at 11:31 AM, Rich Hickey <[EMAIL PROTECTED]> wrote:
>
>
>
> On Oct 27, 12:04 pm, "Bill Clementson" <[EMAIL PROTECTED]> wrote:
>> Hi Chouser
>>
>> On Mon, Oct 27, 2008 at 8:46 AM, Chouser <[EMAIL PROTECTED]> wrote:
>>
>> > I think it's generally better to use = instead of .equa
On Mon, Oct 27, 2008 at 07:58:09AM -0700, Tayssir John Gabbour wrote:
> Pretty cool; this means that special operators just shadow my attempts
> to redefine them. For example:
>
> user> (defn quote [a b]
> (+ a b))
> #'user/quote
> user> (quote 1 2) ;; Quote ignores args after the first..
On Oct 27, 12:50 pm, Rich Hickey <[EMAIL PROTECTED]> wrote:
> A var's root has volatile (overwrite, last one in wins) semantics.
> That means that anyone can change it and everyone will see the
> changes. You *can* re-def a fn being used by a long running loop:
Thanks for the clarification, Ric
Meikel Brandmeyer wrote:
> Am 25.10.2008 um 15:49 schrieb Phil Jordan:
>> I tried both the release jar and building my own from hg (by the way,
>> your Makefile fails on GNU Make on Linux, as far as I can tell it's
>> because you're using .for) and they suffer from the same problem.
> Obviously th
On Mon, Oct 27, 2008 at 12:25 PM, Stuart Halloway
<[EMAIL PROTECTED]> wrote:
>
> I think I am missing something here, can you elaborate?
>
>> By the way, difference is eager, so I'm not sure there's much point in
>> using lazy-cat. :-)
>
> I am using lazy-cat *because* difference is eager. Is that
Chouser,
I think I am missing something here, can you elaborate?
> By the way, difference is eager, so I'm not sure there's much point in
> using lazy-cat. :-)
I am using lazy-cat *because* difference is eager. Is that mistaken?
For example, the first expression below returns immediately, and
Hi Chouser
On Mon, Oct 27, 2008 at 8:46 AM, Chouser <[EMAIL PROTECTED]> wrote:
>
> I think it's generally better to use = instead of .equals for
> equality, unless you have a specific reason to not use = (which I
> don't think is the case here).
Only that it allowed me to talk about Java interop
I think it's generally better to use = instead of .equals for
equality, unless you have a specific reason to not use = (which I
don't think is the case here).
On Mon, Oct 27, 2008 at 11:12 AM, Stuart Halloway
<[EMAIL PROTECTED]> wrote:
>
> You could do something like this:
>
> (defn seq-xor-2-seq
I installed Java 1.6 and the 3D library.
This code runs-- nifty!
I tried running interactively like you say below, but entering (clean)
at the REPL crashes it.
Wait... tried it again and it worked fine.
This is really cool! (Brings back memories of my Atari 800.)
Timothy Pratley wrote:
> sou
Hi Stuart,
Thanks, that's a nice alternative approach!
Bill
On Mon, Oct 27, 2008 at 8:12 AM, Stuart Halloway
<[EMAIL PROTECTED]> wrote:
>
> Hi Bill,
>
> You could do something like this:
>
> (defn seq-xor-2-seqs
> "Returns the unique values that are in one sequence but not the
> other."
> [
Hi Bill,
You could do something like this:
(defn seq-xor-2-seqs
"Returns the unique values that are in one sequence but not the
other."
[x y]
(let [x (into #{} x)
y (into #{} y)]
(lazy-cat (clojure.set/difference x y)
(clojure.set/difference y x
Not sur
Stephen C. Gilardi wrote:
> Yes, that's one of the things that's special about them. They are
> resolved as special forms independent of the current namespace.
>
> I'm not sure if it's essential or a design choice that they have no
> namespace of their own.
Pretty cool; this means that special op
Hello all,
I am new to this group, so forgive me if this is an old question.
Is anyone working on a Clojure plugin for IntelliJ?
Thanks
Peter
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To pos
Hi all,
I've put on my blog (http://bc.tech.coop/blog/081027.html) a post
about some Clojure language features. In the post, I point out the
features in a couple of functions that I wrote (which do an "exclusive
or (XOR)" on sequences). Since I'm new to Clojure and still learning
how to do things
Hi Bill,
Agreed, at least in part. I think that a good test suite for a
language like Clojure should include both fixed values and generated
ones. I just wanted both APIs to be available at the beginning so that
volunteers could pick the most appropriate choice for a particular test.
Stuar
On Oct 27, 2008, at 10:15 AM, Tayssir John Gabbour wrote:
> Hi,
>
> I've noticed that symbols naming special forms don't belong to a
> namespace. For example:
>
> user> (map #'namespace [`def `do `if `quote `assoc])
> (nil nil nil nil "clojure")
>
> Is this expected?
Yes, that's one of the thing
Hi,
I've noticed that symbols naming special forms don't belong to a
namespace. For example:
user> (map #'namespace [`def `do `if `quote `assoc])
(nil nil nil nil "clojure")
Is this expected?
Thanks!
Tayssir
--~--~-~--~~~---~--~~
You received this message beca
notallama wrote:
> this may be more of a java question than a clojure question. i dunno.
>
> how do i use a java class from clojure?
>
> it's easy enough if it's one of the default java libraries, but so far
> all i have managed with classes i wrote is "unable to resolve to
> classname"
>
> i t
Hi Rich,
Thanks for the quick reply! I'm probably just being slow here, for which
I apologise, but some questions remain:
Rich Hickey wrote:
> On Oct 26, 3:49 pm, Phil Jordan <[EMAIL PROTECTED]> wrote:
>> First of all, is the breakage intentional?
>
> Yes. You can no longer embed unreadable obj
On Oct 26, 11:16 am, James Reeves <[EMAIL PROTECTED]> wrote:
> When you build Clojure from SVN using the ant file, it defaults to
> compiling the class files for the highest version of Java available on
> your system. So if you have Java 1.6, the clojure.jar file you make
> will be inaccessible
On Oct 26, 10:37 am, Krukow <[EMAIL PROTECTED]> wrote:
> On Oct 26, 1:48 pm, "Matti Jagula" <[EMAIL PROTECTED]> wrote:
>
> > On Sat, Oct 25, 2008 at 3:19 PM, Krukow <[EMAIL PROTECTED]> wrote:
> > > I am kind of embarrassed to ask this, but is there a "correct way" to
> > > do this . Do you simpl
this may be more of a java question than a clojure question. i dunno.
how do i use a java class from clojure?
it's easy enough if it's one of the default java libraries, but so far
all i have managed with classes i wrote is "unable to resolve to
classname"
i tried running the repl from the dire
Hi again,
I answer myself as this is explained in that very paper:
...
3.1 Search for a key
...
A small, but important implementation consideration is the
identification of sub-
tries or key/value nodes by a bit flag in the data structure. Using C+
+ the bit
uses the least significant bit of the
36 matches
Mail list logo