My 'requirements' were not so much for any particular need, but to try
to think up a logical and complete API for dealing with multisets. I
agree that there should be an actual collection type for multisets
(implemented as an underlying map of values to frequencies I presume);
but you might as wel
I don't see why you couldn't simply check to make sure that there are
no arguments without either default or supplied values. As I wrote
above, "If you left the arguments incomplete and unkeyworded it would
apply what you put preferentially to the first arguments in the list
without a default valu
Hi all,
Just ran into a small gotcha: I had an atom which contained a lazyseq
(e.g. (filter males world)). Later on I would be repeatedly calling
random elements from this atom, using clojure contrib rand-elt. That
was surprisingly slow. I figured out that count was the culprit.
Apparently, the la
I should also add something I alluded to in another discussion (under
'positions'); this is the idea of making \any parameter into a rest
parameter. For instance, if you had
(defnsk add [addend augend] ...)
you could call it like (add :addend 1 2 3 :augend 1 2) or (add [1 2 3]
[1 2 3 4]).
Must
This would solve the "holding to the head" problem.
Many times, lazy-seq would be used without the need to get the same
cell twice.
In this case, avoiding cashing would both enhance performance and more
importantly would avoid OutOfMemoryError Exceptions like in:
(def r (repeatedly #(rand)))
(last
If you think about it, the tower of sequence types is like this:
seq
|
gathered seq
/\
multiset permutation
\ /
set
The way to do the various options I pointed out is to mix types: the
k
On Nov 19, 11:52 am, Gabi wrote:
> This would solve the "holding to the head" problem.
> Many times, lazy-seq would be used without the need to get the same
> cell twice.
> In this case, avoiding cashing would both enhance performance and more
> importantly would avoid OutOfMemoryError Exceptions
On Nov 20, 8:33 am, nchubrich wrote:
> I guess this is getting to be a pretty epic macro! I figured it was
> worth inviting boos and/or cheers and suggestions before setting out...
Far be it from me to discourage making function invocation semantics
more flexible! Just one thing: you've been cal
On Wed, Nov 18, 2009 at 2:29 AM, Phil Hagelberg wrote:
>
> With Leiningen, your build is described using Clojure. You can put any
> code you like in your project.clj file; the only requirement is that
> it includes a call to defproject. You can define your own tasks in
> there if you need to, but
The Incanter guys put something up:
http://incanter-blog.org/2009/11/20/leiningen-clojars/
On Nov 20, 11:06 am, Graham Fawcett wrote:
> On Wed, Nov 18, 2009 at 2:29 AM, Phil Hagelberg wrote:
>
> > With Leiningen, your build is described using Clojure. You can put any
> > code you like in your p
On Fri, Nov 20, 2009 at 11:11 AM, Sean Devlin wrote:
> The Incanter guys put something up:
>
> http://incanter-blog.org/2009/11/20/leiningen-clojars/
Excellent, thanks!
Leiningen + Clojars is a game-changer for Clojure. I'm very excited.
Will-need-to-practice-spelling-leiningen'ly yours,
Graham
Something tells me we'll just be calling it 'lein'. Is that okay
Phil?
Sean
On Nov 20, 11:21 am, Graham Fawcett wrote:
> On Fri, Nov 20, 2009 at 11:11 AM, Sean Devlin
> wrote:
> > The Incanter guys put something up:
>
> >http://incanter-blog.org/2009/11/20/leiningen-clojars/
>
> Excellent, th
FYI: http://www.infoq.com/news/2009/11/clojars-leiningen-clojure
2009/11/20 Sean Devlin :
> Something tells me we'll just be calling it 'lein'. Is that okay
> Phil?
>
> Sean
>
> On Nov 20, 11:21 am, Graham Fawcett wrote:
>> On Fri, Nov 20, 2009 at 11:11 AM, Sean Devlin
>> wrote:
>> > The Incan
FYI: http://www.infoq.com/news/2009/11/clojars-leiningen-clojure
2009/11/19 Alex Osborne :
> Laurent PETIT wrote:
>> Hello,
>>
>> Just an idea out of my head : could it be possible for the pom.xml to be
>> included in the jar, in the META-INF/ directory ?
>>
>> This would even further simplify the
No, I'd rather not, but I have to take this in bite-size pieces. I'm
still a bit of a noob at writing macros. I want to make it so that
the user does not have to do anything aside from deal with the
argument lists directly, so that means writing different macros for
defn, letfn, defmethod, etc.
Without knowing of Niels Mayer's work (until just now) I wrote an
implementation of the Java Scripting API for Clojure --and even named
it the same. Indeed great minds think alike. Though I didn't think of
isolating the runtime in different instances of the engine.
The distribution ZIP file has th
as an aside, sometimes you want the rng to be truly pure so you can
easily recreate situations. take a look at randomness in haskell for
fun. :-)
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups
Hi folks,
This is somewhat a Java question, but it's in the context of Clojure,
so here goes. Playing with Leiningen got me thinking about bundling a
Clojure application as a JAR, which might include a host of classes
that are loaded but never used. Is it possible to "tree-shake" such a
jarfile, a
Hi Graham
2009/11/20 Graham Fawcett :
> Hi folks,
>
> This is somewhat a Java question, but it's in the context of Clojure,
> so here goes. Playing with Leiningen got me thinking about bundling a
> Clojure application as a JAR, which might include a host of classes
> that are loaded but never used
Sean Devlin writes:
> Something tells me we'll just be calling it 'lein'. Is that okay
> Phil?
Yeah, there's a reason the bin script is called "lein"... I was
misspelling it myself for the first few days of working on it. =)
-Phil
--
You received this message because you are subscribed to th
Alex Osborne writes:
> I looks like Maven does this, it puts two files in the jar:
>
> META-INF/maven/$groupId/$artifactId/pom.xml
> META-INF/maven/$groupId/$artifactId/pom.properties
>
> So it looks like you can use that to figure out what version a library
> is just using the java properties s
On Fri, Nov 20, 2009 at 1:37 PM, Jim Downing wrote:
> Hi Graham
>
> 2009/11/20 Graham Fawcett :
>> Hi folks,
>>
>> This is somewhat a Java question, but it's in the context of Clojure,
>> so here goes. Playing with Leiningen got me thinking about bundling a
>> Clojure application as a JAR, which m
> But I should be able to know, through class inspection, whether my
> 'main' program depends on a class which uses, say, the clojure.zip
> namespace, and decide whether or not to include it. Or so I am
> wondering.
There are impediments to that, too -- your namespace might require
another, and
On Fri, Nov 20, 2009 at 2:28 PM, Richard Newman wrote:
>> I suppose a better question might be: would a tree-shaker have a
>> reasonable chance of shaking a typical Clojure jar, or are there too
>> many dynamic obstacles to a good analysis.
>
> I'm not sure it's worth solving this through low-leve
On Thu, Nov 19, 2009 at 12:39 PM, Krukow wrote:
> On Nov 19, 12:01 am, samppi wrote:
>> Question: are the general mechanisms for accessing and setting fields
>> their keywords and assoc respectively:
>> (deftype Bar [a b c d e])
>> (def b (Bar 1 2 3 4 5))
>> (:c b)
>> (def c (assoc b :e 2
On Nov 20, 8:51 pm, Chouser wrote:
> On Thu, Nov 19, 2009 at 12:39 PM, Krukow wrote:
[snip]
> > I guess I am just asking if the performance guarantees are those I
> > would expect of Clojure (i.e., "too fast" ;-))
>
> This is definitely still too fast. In fact, it keeps getting worse.
>
> --Ch
> Try with a 1.6 JVM...
wow. it actually got worse than when i was using 1.5. ... so much for
hallowed write-once-run-the-same-anywhere-ish of the jvm, d'oh.
Clojure 1.1.0-alpha-SNAPSHOT
user=> (load-file "/tmp/test.clj")
#'user/vrange2
user=> (. System getProperty "java.version")
"1.6.0_15"
user
> user=> (time (def v (vrange 100)))
> --- never came back, i had to ^C^C (in emacs buffer)!!
p.s. so at least the transient version never did that ;-)
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@g
The sequence returned from the filter would need to be rescanned to
get the nth element, but the filtering itself should only need to
happen when the "next" element in the sequence is sought.
For cases such as the one you describe, I think it's common to fully
realize the sequence into a vector, e
Dear Clojurians,
I am very happy to announce Clojuratica version 2.
Clojuratica now offers the **syntactic** integration of Clojure and
Mathematica.
What does this mean? It means you can write Clojure code that looks like
this:
=> (FactorInteger 12345)
[[3 1] [5 1] [823 1]]
You guessed it. Fac
P.S. I have been told that Clojuratica works with the free Mathematica
Player. I haven't tried this myself.
On Fri, Nov 20, 2009 at 5:57 PM, Garth Sheldon-Coulson wrote:
> Dear Clojurians,
>
> I am very happy to announce Clojuratica version 2.
>
> Clojuratica now offers the **syntactic** integra
Hi.
I can't find the answer to this anywhere. (It seems it should be
posted somewhere already ...)
This works:
(. System getProperty "java.version")
-> "1.6.0_15"
This does not work:
(. (identity System) getProperty "java.version")
-> java.lang.IllegalArgumentException: No matching method fo
It's the . special form that makes the difference. In (. System
(getProperty)), the dot interprets System as a class and looks for a static
method (at read/compile time). With (identity System), System resolves to a
value, a Class object, returned by identity, then your outside dot looks for
a ge
Matt Brown wrote:
> Why does (. System getProperty "java.version") work when
> (. (identity System) getProperty "java.version") does not work, given
> that
> (identity System) should be the same as System ?
It's because the . special form treats class names specially. In Java
there's unfortunat
On Fri, Nov 20, 2009 at 2:28 PM, Richard Newman wrote:
> > But I should be able to know, through class inspection, whether my
> > 'main' program depends on a class which uses, say, the clojure.zip
> > namespace, and decide whether or not to include it. Or so I am
> > wondering.
>
> There are impe
On Fri, Nov 20, 2009 at 5:16 PM, Raoul Duke wrote:
> > Try with a 1.6 JVM...
>
> wow. it actually got worse than when i was using 1.5. ... so much for
> hallowed write-once-run-the-same-anywhere-ish of the jvm, d'oh.
>
> Clojure 1.1.0-alpha-SNAPSHOT
> user=> (load-file "/tmp/test.clj")
> #'user/v
Even though I have used Clojure, I hadn't looked at the scoping rules
in detail. I am getting more confused as I read the documentations. I
made a small test to try out the scoping resolutions and am apalled at
the complexity. Could somebody explain the intent and various rules
that Clojure uses?
Conceptually, the best way to think about it is that your binding sets
the global x to 100 and restores the global x to 1 when exiting the
scope of the binding construct. It has no effect on your local x.
Dynamic binding is confusing, and should be used with care. If you
stick with the lexical s
On Fri, Nov 20, 2009 at 8:02 PM, Mark Engelberg
wrote:
> Dynamic binding is confusing, and should be used with care.
Elaborating on my previous point: it's especially confusing because
dynamic binding interacts poorly with lazy data structures, which is
predominantly what you deal with in Clojure
I'm writing a maybe/state monad using clojure.contrib.monads. I've
gotten by fine with using just (state-t maybe-m), but now I need
different behavior:
I need a monad that behaves precisely like (state-t maybe-m), except
that when a monadic value mv is called on a state s and fails, (mv s)
return
40 matches
Mail list logo