On Tue, Mar 24, 2009 at 5:37 PM, Meikel Brandmeyer wrote:
> Hi,
>
> Am 24.03.2009 um 22:36 schrieb mikel:
>
> CLOS says that if two matches are otherwise equally specific, the one
>> on the left wins. Similarly, it says that if two classes define slots
>> with the same name, the one farthest fro
On Tue, Mar 24, 2009 at 10:19 PM, e wrote:
> I'm interested to know what the process/priority is on bubbling things up
> from contrib into the core. Is a discussion under way about going through
> it all?
>
> I also think it's good to have cross-language conventions sometimes unless
> there are
On Mar 24, 5:37 pm, Meikel Brandmeyer wrote:
> Hi,
>
> Am 24.03.2009 um 22:36 schrieb mikel:
>
> > CLOS says that if two matches are otherwise equally specific, the one
> > on the left wins. Similarly, it says that if two classes define slots
> > with the same name, the one farthest from the ro
I'm interested to know what the process/priority is on bubbling things up
from contrib into the core. Is a discussion under way about going through
it all?
I also think it's good to have cross-language conventions sometimes unless
there are compelling reasons.
For example, "slurp" is, perhaps, m
It'd be nice to have a macro that worked more like the first example -
"spit" is great for one-liners, but the fact that it opens and closes the
file each time you call it seems a bit painful for anything more complex.
Something that ends up working like:
(with-out-as "test.txt"
(println "hello
Awesome. Thanks Konrad.
On Mar 23, 4:11 am, Konrad Hinsen wrote:
> On 22.03.2009, at 21:10, Jon Nadal wrote:
>
>
>
> > I often need to map a function over the values of a map while
> > preserving keys--something like:
> ...
> > Is there a more concise way to do this in Clojure? If not, is this
Hi,
I would generally agree with Stuart that wrapping Java functions is
not a good idea.
However, string functions come up so often that I think that this is
one area where the rule should be broken, if only for readablility.
Making str-utils kick-ass is a great idea.
pc
On Mar 24, 7:05 pm,
Okay, I've made some changes to my proposed str-utils. I've also got
a few answers to some of the issues Stuart raised.
New Changes
1. re-strip is now lazy
I re-wrote this method to used the re-partition method in str-utils.
This enables the laziness, and helped be consolidate my Java
interacti
On Mar 24, 11:53 pm, e wrote:
> does anyone else think that should be more fundamental like the python
> example? imagine saying that out loud to your friend who asks . . . and the
> amount of noise, visually:
>
> "use clojure dot contrib dot duck dash streams".
>
> perhaps it is already the h
Hi,
Is there any way to get a "dynamic" member-symbol for use in the (.)
special form?
For example, I get the following exception:
user=> (def obj (Object.))
#'user/obj
user=> (. obj (symbol "f"))
java.lang.IllegalArgumentException: No matching method found: symbol
for class java.lang.Object
I
On Tue, Mar 24, 2009 at 11:40 PM, Howard Lewis Ship wrote:
>
> A relevant question is: what is the relative cost of locking and
> blocking (in the pure Java approach) vs. the cost of retrying (in the
> Clojure/STM approach).
I can't think, off the top of my head, of a fair way to compare the
two
>
> I don't want to go out on a limb, having not looked at the Clojure STM
> implementation. However, I would bet that the costs are roughly equal.
> Even if Clojure was 50% slower, or 100% slower, the knowlege that you
> can spin up a large number of threads and not worry about deadlocks is
> ulti
Thanks all,
microbenchmarking shows that a simple
(time (doseq [[a b] (map vector list-a list-b)]))
is ~50% faster on my system than
(def par-doseq-fn (comp dorun map))
(defmacro par-doseq [bindings & body]
(let [bindings (partition 2 bindings)]
`(par-doseq-fn (fn ~(vec (map first b
A relevant question is: what is the relative cost of locking and
blocking (in the pure Java approach) vs. the cost of retrying (in the
Clojure/STM approach).
I don't want to go out on a limb, having not looked at the Clojure STM
implementation. However, I would bet that the costs are roughly equa
Hi,
Am 24.03.2009 um 22:36 schrieb mikel:
CLOS says that if two matches are otherwise equally specific, the one
on the left wins. Similarly, it says that if two classes define slots
with the same name, the one farthest from the root of the class
heterarchy (as defined by a standard traversal al
I think I figured it out.
If I install clojure.jar into /Library/Java/Extensions/ (the ext
directory on Macs) then it won't work. Even if I use java -cp ... to
point to a different clojure.jar. Simply having the jar in that folder
breaks things.
Once I deleted it from /Library/Java/Extensions, I
I think Cliff may mean that each STM-participating memory access is 3x
slower, but in Clojure, because of immutability, a very small
proportion of accesses are Ref accesses, whereas in C/C++ *all* memory
accesses would be.
I agree that there's lots of room for adding instrumentation to
Clojure's
i guess another way to say this is that I can see both sides of the argument
... on one side, it shouldn't be a priority to resolve problems that java
already provides when there are probably other more pressing issues. And
it's part of the design decision to allow users to leverage java libraries
On Mon, 23 Mar 2009 19:41:07 -0700
Mark Engelberg wrote:
>
> On Mon, Mar 23, 2009 at 7:31 PM, Vincent Foley
> wrote:
> > More generally, is it possible that I'm just doing this whole thing
> > wrong? That using vectors to represent binary fields and records
> > in a declarative is just a bad i
On Mar 24, 3:39 pm, Meikel Brandmeyer wrote:
> Hi,
>
> Am 24.03.2009 um 18:51 schrieb mikel:
>
> >>> (define-method add [x y] ...)
> >>> (define-method add [[x java.lang.Integer] y] ...)
> >>> (define-method add [x [y java.lang.Integer]] ...)
>
> >>> and call (add 3 3). Whi
Hi,
Am 24.03.2009 um 20:08 schrieb Howard Lewis Ship:
Using regular and proper formatting assists in submitting patches.
hahaha! If someone submitting a patch ever adhered to a coding
convention of any sort.
A little Javadoc would be nice as well.
Yes. That would definitively be a good a
Hi,
Am 24.03.2009 um 18:51 schrieb mikel:
(define-method add [x y] ...)
(define-method add [[x java.lang.Integer] y] ...)
(define-method add [x [y java.lang.Integer]] ...)
and call (add 3 3). Which of the methods is chosen?
Isn't it the second, which is the most specific
Hi,
Am 24.03.2009 um 16:00 schrieb Mark Volkmann:
Thanks! It looks like I don't need the let now.
But there are reasons to keep it! Eg. returning the expression
result!
(defmacro dump
[expr]
`(let [value# ~expr]
(println (pr-str (quote ~expr)) "=" (pr-str value#))
value#))
The
Another link that gives an easy understandable intro into
gradual typing:
http://ece-www.colorado.edu/~siek/gradualtyping.html
By adding local and global switches this behaviour could
be made completely optional, allowing everyone to have
as much typing as one wants to have in the code.
Btw, is
+1
Using regular and proper formatting assists in submitting patches.
A little Javadoc would be nice as well.
On Tue, Mar 24, 2009 at 4:46 AM, Mark Volkmann
wrote:
>
> +1 for running all the code under src/jvm through some code formatter
> that uses something at least similar to the Sun Java c
does anyone else think that should be more fundamental like the python
example? imagine saying that out loud to your friend who asks . . . and the
amount of noise, visually:
"use clojure dot contrib dot duck dash streams".
perhaps it is already the hope that it will "spit" will eventually sit ne
*bump*
Just letting people know that this is still an important and
unresolved issue for me.
Calling super multi-methods?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To post to this group, send
On Mar 24, 12:58 pm, Raoul Duke wrote:
> question: what do people think about the general topic of inheritance?
> my take on it so far is that inheritance apparently sounds like a good
> idea at first to some folks, but quickly turns into something of a
> nightmare if one is actually concerned
On Mar 24, 5:56 am, cliffc wrote:
> Some generic STM bits of wisdom:
>
> - STMs in "standard" languages (e.g. C, C++) suffer from having to
> track all memory references. THis overhead means the STM code
> typically starts 3x to 10x slower than non-STM code, which is a pretty
> stiff penalty t
On Mar 24, 7:46 am, Mark Volkmann wrote:
> +1 for running all the code under src/jvm through some code formatter
> that uses something at least similar to the Sun Java conventions.
>
> On Mon, Mar 23, 2009 at 11:59 PM, BerlinBrown wrote:
>
> > I was curious about how some of the clojure code wor
On Mar 23, 9:46 pm, Sean wrote:
> http://github.com/francoisdevlin/clojure-str-utils-proposal/tree/master
>
> I'm not sure what the directory structure should be for everything
> still. Perhaps somebody can point out how it should be done.
>
> I'll put the original post in the README
>
> Long st
On Mon, Mar 23, 2009 at 6:49 PM, Laurent PETIT wrote:
> Hello,
>
> there has been plenty of time to speak about that in the previous thread on
> the subject, and it's a shame these interesting proposals had to wait for
> the release of the functionality to pop up :-).
>
> But I think it's my faul
On Mar 24, 12:42 pm, Parth Malwankar
wrote:
> user=> (with-open [f (writer (file "test.txt"))]
> (binding [*out* f]
> (println "hello world !!!")))
Or even more simply:
(use 'clojure.contrib.duck-streams)
(spit "test.txt" "Hello, world!\n")
-Stuart Sierra
--~--~-~
question: what do people think about the general topic of inheritance?
my take on it so far is that inheritance apparently sounds like a good
idea at first to some folks, but quickly turns into something of a
nightmare if one is actually concerned with keeping a coherent
semantics (so that (a) peo
On Mar 24, 7:59 am, Laurent PETIT wrote:
> 2009/3/24 Konrad Hinsen
>
>
>
>
>
>
>
> > On Mar 24, 2009, at 11:19, mikel wrote:
>
> > > Dispatch is wholly deterministic; you never need prefer-method. There
>
> > Then what is the rule for choosing one method when there are several
> > that match t
On Mar 24, 2009, at 1:01 PM, Tom Emerson wrote:
Hi all,
I'm getting an error I don't quite understand. Starting Clojure
(r1329) and entering
user> (ns foo (:use [clojure.contrib.zip-filter :as zf]))
Because you've used ":use", you are referring all of
clojure.contrib.zip-filter into foo.
The doc doesn't claim that :as works with use.
But it works well with require :
user> (ns foo (:require [clojure.contrib.zip-filter :as zf]))
HTH,
--
Laurent
2009/3/24 Tom Emerson
>
> Hi all,
>
> I'm getting an error I don't quite understand. Starting Clojure
> (r1329) and entering
>
> user>
Hi all,
I'm getting an error I don't quite understand. Starting Clojure
(r1329) and entering
user> (ns foo (:use [clojure.contrib.zip-filter :as zf]))
I get an exception,
java.lang.IllegalStateException: descendants already refers to:
#'clojure.core/descendants in namespace: foo (NO_SOURCE_FIL
Hello!
Yes, you are right, "sorted-set-by" is missing. Good news is - it is
on the way :-)
See issue 76:
http://code.google.com/p/clojure/issues/detail?id=76
Frantisek
On Mar 24, 5:35 am, hjlee wrote:
> Hi, all.
> I don't know why my previous posts ignored.
> spam filtering? so i changed titl
For reference, here's a version I wrote while I was working on cl-
format and the pretty printer:
(defn prerr [& args]
"Println to *err*"
(binding [*out* *err*]
(apply println args)))
(defmacro prlabel [prefix arg & more-args]
"Print args to *err* in name = value format"
(cons 'prerr
e wrote:
> is there something as simple as this in clojure?
>
> whole python program:
>
> of = open(filename,"w")
> of.write("hello")
> of.close()
>
> I checked the api and looked around the wiki and google quickly and saw how
> to use java's stuff to do it ... but, welll...
>
There
Hello,
try
(with-open [of (java.io.FileWriter. "/path/to/your/file")]
(.write of "coucou"))
As far as java libraries are concerned, and answer commonly seen in this ml
is : "use apache commons io". And indeed it does the job well, but, yes,
it's then another dependency to your project, for wha
>> (defn par-doseq-fn [fn& seqs]
>> (loop [rests seqs]
>>(when (every? identity (map seq rests))
>> (apply fn (map first rests))
>> (recur (map rest rests)
>>
>>
> It should of course be like this :
>
> (defn par-doseq-fn [fn& seqs]
> (loop [rests se
is there something as simple as this in clojure?
whole python program:
of = open(filename,"w")
of.write("hello")
of.close()
I checked the api and looked around the wiki and google quickly and saw how
to use java's stuff to do it ... but, welll...
I noticed "slurp" in the api for rea
On Mar 24, 10:19 am, Sean wrote:
> Some working code would make it a lot easier to understand *exactly*
> what you're looking for. Do you think you could post a few quick
> methods on github?
No need for gist, this will do as an example:
(ns some.namespace
(:gen-class
:methods [^#{:annota
> (defn par-doseq-fn [fn& seqs]
> (loop [rests seqs]
> (when (every? identity (map seq rests))
> (apply fn (map first rests))
> (recur (map rest rests)
>
It should of course be like this :
(defn par-doseq-fn [fn & seqs]
(loop [rests seqs]
(when (every?
On 24/03/2009 15:10, Rowdy Rednose wrote:
> Thanks guys, these solutions look much better already.
>
> But do I always have to have these 2 steps
> * merge collection
> * split collection
>
> It feels a bit inefficient, I don't know if it actually is, though.
Allright let's see what we can do :
m
Eric Rochester has a debug macro, together with a walkthrough of how he
built it, here
http://writingcoding.blogspot.com/2008/09/stemming-part-19-debugging.html
Joshua
On Tue, Mar 24, 2009 at 4:43 PM, Mark Volkmann wrote:
>
> I want to write a function or macro that allows me to output the value
On Mar 24, 2009, at 10:49 AM, Mark Volkmann wrote:
On Tue, Mar 24, 2009 at 9:44 AM, Stephen C. Gilardi
wrote:
One thing to note is that namespace names should always have at
least one
period in them. I believe this is due to a rule regarding Java
packages. At
some point the "clojure" name
On Mar 24, 2009, at 16:00, Mark Volkmann wrote:
> Thanks! It looks like I don't need the let now.
Indeed.
> Does a macro have to evaluate to one form? For example, this works,
> but it seems I can't
> drop the do.
Yes, a macro has to evaluate to one form. This is actually not so
much a con
2009/3/24 Mark Volkmann :
>
> Thanks! It looks like I don't need the let now. Does a macro have to
> evaluate to one form? For example, this works, but it seems I can't
> drop the do.
>
> (defmacro dump [expr]
> `(do
> (print (quote ~expr))
> (println " =" ~expr)))
How about:
(defmacro
On Tue, Mar 24, 2009 at 9:55 AM, Konrad Hinsen
wrote:
>
> On Mar 24, 2009, at 15:44, Mark Volkmann wrote:
>
>> I'm wondering if there is a way to avoid that using a macro. The hard
>> part is printing the expression. The following doesn't work. It
>> outputs "3 = 3".
>>
>> (defmacro dump2 [expr]
On Mar 24, 2009, at 15:44, Mark Volkmann wrote:
> I'm wondering if there is a way to avoid that using a macro. The hard
> part is printing the expression. The following doesn't work. It
> outputs "3 = 3".
>
> (defmacro dump2 [expr]
> `(let [value# ~expr]
> (pr ~expr)
> (println " =" v
On Tue, Mar 24, 2009 at 9:44 AM, Stephen C. Gilardi wrote:
>
> One thing to note is that namespace names should always have at least one
> period in them. I believe this is due to a rule regarding Java packages. At
> some point the "clojure" namespace became "clojure.core" for this reason. I
> ha
On Tue, Mar 24, 2009 at 9:44 AM, Stephen C. Gilardi wrote:
>
> One thing to note is that namespace names should always have at least one
> period in them. I believe this is due to a rule regarding Java packages. At
> some point the "clojure" namespace became "clojure.core" for this reason. I
> ha
On Mar 24, 2009, at 5:03 AM, Rich wrote:
Has anyone gotten 20090320 to work on a new MacBook Pro running
Leopard?
I tried it just now and it worked for me. Here's the test I did:
- Download 20090320 zip file
- Expand it into dir
- create a file in dir called Structure.clj wi
I want to write a function or macro that allows me to output the value
of an expression without repeating it. For example, I want something
like (dump (+ 1 2)) to output "(+ 1 2) = 3".
This works.
(defn dump1 [string]
(println string "=" (load-string string)))
(dump1 "(+ 1 2)")
Note how I had
I want to write a function or macro that allows me to output the value
of an expression without repeating it. For example, I want something
like (dump (+ 1 2)) to output "(+ 1 2) = 3".
This works.
(defn dump1 [string]
(println string "=" (load-string string)))
(dump1 "(+ 1 2)")
Note how I had
@Rowdy
Take the time to do the interleave example by hand. You'll it does
exactly what you want in one pass.
On Mar 24, 10:10 am, Rowdy Rednose wrote:
> Thanks guys, these solutions look much better already.
>
> But do I always have to have these 2 steps
> * merge collection
> * split collecti
You could define a helper function, zip (as in Haskell) :
(def zip (partial map list))
and then use as showed above:
(doseq [[x y] (zip [:a :b] [1 2])] (println "x: " x ", y:" y))
2009/3/24 Rowdy Rednose
>
> Thanks guys, these solutions look much better already.
>
> But do I always have to
Some working code would make it a lot easier to understand *exactly*
what you're looking for. Do you think you could post a few quick
methods on github? If memory serves, the reflections package should
be a good place to start.
However, you'd need to ask *why* you need this.
If the answer is "
Thanks guys, these solutions look much better already.
But do I always have to have these 2 steps
* merge collection
* split collection
It feels a bit inefficient, I don't know if it actually is, though.
On Mar 24, 8:05 pm, Phlex wrote:
> On 24/03/2009 1:06, pmf wrote:
>
> > On Mar 24, 12:01 a
Support for using JVM annotations with Clojure code has come up
several times before,
I'd like a feature request issue to be created and to start discussing
the implementation.
It seems that an "annotations" metadata tag could contain all
annotations for an object,
and any annotations that
Hi, all.
I don't know why my previous posts ignored.
spam filtering? so i changed title.
I'm experimenting clojure.
Some code, I needed something like "sorted-set-by", but no such
thing.
So i used "sorted-map-by" ignoring value part.
Is it deliberate for some reason?
Or just not there?
--~--~--
Hi all.
I'm experimenting cljoure.
some code, i needed something like "sorted-set-by". but, no such
thing, so I emulated that using "sorted-map-by".
Is it deliberate for some reason?
or just not there?
--~--~-~--~~~---~--~~
You received this message because you ar
Hi, all.
I'm experimenting clojure.
Some code, I needed something like "sorted-set-by", but no such
thing.
So i used "sorted-map-by" ignoring value part.
Is it deliberate for some reason?
Or just not there?
--~--~-~--~~~---~--~~
You received this message because
You mean by Sun Norvig conventions right ? ;)
http://code.google.com/p/clojure/issues/detail?id=16&q=pretty&colspec=ID%20Type%20Status%20Priority%20Reporter%20Owner%20Summary
On Mar 24, 1:46 am, Mark Volkmann wrote:
> +1 for running all the code under src/jvm through some code formatter
> that
Hi, all.
I'm experimenting clojure.
Some code, I needed something like "sorted-set-by", but no such
thing.
So i used "sorted-map-by" ignoring value part.
Is it deliberate for some reason?
Or just not there?
--~--~-~--~~~---~--~~
You received this message because
Even though I don't really care for the indentation style used, it is
(unlike most projects) consistent and clear.
Joshua
On Mar 24, 8:40 am, David Nolen wrote:
> Javadoc would be nice, but I do note that Rich's Java code is pretty darn
> clear ;)
> I also note the indentation style is similar
2009/3/24 Konrad Hinsen
>
> On Mar 24, 2009, at 11:19, mikel wrote:
>
> > Dispatch is wholly deterministic; you never need prefer-method. There
>
> Then what is the rule for choosing one method when there are several
> that match the arguments?
>
> > In the scope in which a generic function is ap
Some generic STM bits of wisdom:
- STMs in "standard" languages (e.g. C, C++) suffer from having to
track all memory references. THis overhead means the STM code
typically starts 3x to 10x slower than non-STM code, which is a pretty
stiff penalty to recover from. If you're only getting a 3x spe
Javadoc would be nice, but I do note that Rich's Java code is pretty darn
clear ;)
I also note the indentation style is similar to Whitesmith's according to
Wikipedia http://en.wikipedia.org/wiki/Indent_style. I've always preferred
the BSD curly brace level matching convention over the K&R derivat
The latest version of Clojure incorporated lazy sequences which broke many
libraries early on. Most of these problems have been worked out. In my
experience you should use the cutting edge version of everything including
SLIME. I clone everything from GitHub (clojure, clojure-contrib,
swank-cloju
Why you guys want to suppress all the fun from clojure ? ;-) :-p
2009/3/24 Mark Volkmann
>
> +1 for running all the code under src/jvm through some code formatter
> that uses something at least similar to the Sun Java conventions.
>
> On Mon, Mar 23, 2009 at 11:59 PM, BerlinBrown
> wrote:
> >
+1 for running all the code under src/jvm through some code formatter
that uses something at least similar to the Sun Java conventions.
On Mon, Mar 23, 2009 at 11:59 PM, BerlinBrown wrote:
>
> I was curious about how some of the clojure code worked and observed
> that the coding style is a littl
As was described in a "Software Engineering Radio" podcast on
transactional memory, there are many parallels between garbage
collection and transactional memory. Some parallels that aren't in
place yet though include:
1) There are tools to measure the impact of GC on runs of an
application, but w
On 24/03/2009 1:06, pmf wrote:
> On Mar 24, 12:01 am, Rowdy Rednose wrote:
>
>> Hi group,
>>
>> say I have 2 sequences
>>
>> (def seq-a '("a1" "a2" "a3"))
>> (def seq-b '("b1" "b2" "b3"))
>>
>> and want to iterate over them in parallel, like this
>>
>> (par-doseq [a seq-a b seq-b] (prn a b))
On Mar 24, 2009, at 11:19, mikel wrote:
> Dispatch is wholly deterministic; you never need prefer-method. There
Then what is the rule for choosing one method when there are several
that match the arguments?
> In the scope in which a generic function is applied, next-method is
> always bound t
News for the handful of people interested in gfs.
Below is a sample trace of the gf implementation.
Dispatch is wholly deterministic; you never need prefer-method. There
is no need to specify a dispatch function, though dispatch
customization is available if you want it. The default dispatch
fun
On Mar 23, 2009, at 23:11, Meikel Brandmeyer wrote:
> This is not correct. defmulti may take any of Clojure's
> reference types containing the hierarchy. So it doesn't
> need to be a Var. A Ref, an Atom or an Agent are also
> possible.
Thanks for pointing this out. Here comes a corrected patch!
On Mar 23, 2009, at 10:36 PM, Paul Drummond wrote:
>
> 2009/3/24 Joshua Fox :
>>> Why "presumably with side effects?"
>> Otherwise you would use repeat. A pure function returns the same
>> value
>> every time, so there is no reason to call it repeatedly.
>
> Yup, that makes sense.
>
> Random
Has anyone gotten 20090320 to work on a new MacBook Pro running
Leopard?
With further investigation, it looks like any call to (use...) either
explicitly or as part of an (ns...) function call causes clojure to
crash since the upgrade. I've fiddled around with the class path, and
nothing seems to
2009/3/24 Joshua Fox :
>> Why "presumably with side effects?"
> Otherwise you would use repeat. A pure function returns the same value
> every time, so there is no reason to call it repeatedly.
Yup, that makes sense.
Random numbers are side-effecting (is that the right term?) and I was
trying t
> Why "presumably with side effects?"Otherwise you would use repeat. A pure
function returns the same value every time, so there is no reason to call
it repeatedly.
Joshua
On Tue, Mar 24, 2009 at 10:04 AM, Paul Drummond wrote:
>
> 2009/3/23 Krešimir Šojat :
> > (rand-int 49) will produce one in
2009/3/23 Krešimir Šojat :
> (rand-int 49) will produce one integer, and repeat will repeat it 10
> times, that is why you see same number repeated.
How embarrassing!
As soon as I switched my machine off last night I realised rand-int
was only being called once - of course it was!
I did consid
85 matches
Mail list logo