Phil,
> Would be even better if it were implemented in Clojure though. =)
That's on the anvil. I will do it when I get some time. For now, we will
have to do with Python :)
Regards,
BG
--
Baishampayan Ghose
oCricket.com
--
You received this message because you are subscribed to the Google
Hi,
Am 30.12.2009 um 00:19 schrieb Rob Lachlan:
> (deftype B
>[#^A Avalue])
>
> So how would I define a type that includes another type?
Did you try: (deftype B [#^::A Avalue])?
I don't know whether this works, but it's the obvious idea.
Sincerely
Meikel
--
You received this message bec
Personally, I prefer to use multple "prototypes":
(defn bla
([aaa bbb ccc] )
([bbb cc] (bla 0 bbb cc)))
etc.
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from n
Personally, I prefer to use multiple implementations, like:
(defn aaa
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient wit
Hi, just to warn that there's a small problem with sets documentation
in the data structures page of Clojure's website. The hyperlinks to
set operations and pseudo-relational algebra are broken as they
haven't followed the move to the new clojure.set namespace.
- budu
--
You received this messag
hi,
> So how would I define a type that includes another type?
my guess: type hints take java types, and you are giving a clojure
type. the docs for deftype say you can get a java type for the deftype
if you compile. ?
When AOT compiling, generates compiled bytecode for a class with the
give
I'm also looking for some help on deftype, and rather than start
another thread, I thought I'd toss it in here. Basically, how do I
type hint for a deftype. For example, suppose I want a nested type,
something that looks like this:
(deftype A
[#^somePrimitive someField])
(deftype B
[#^
On Tue, Dec 29, 2009 at 01:58:45PM -0500, Rich Hickey wrote:
>(type (Small))
>:user/Small
>
>You can use this keyword type tag for multimethod dispatch.
I did eventually figure this out.
>I am a bit confused as to why you would want to reify a deftype. You
>can reify protocols, however.
I need
> On Sat, Dec 19, 2009 at 3:58 PM, Stuart Halloway
> wrote:
>> In Clojure it is idiomatic to have optional args at the front of the
>> signature. This makes it easy to define convenient caller APIs, but
>> it
>> leads to bulky let forms like this one (from clojure.core/defmulti)
There's clojure
hi,
http://docs.google.com/View?id=dfkgssz7_22rrrjznc2
it is a work in progress. i'd appreciate any feedback or whacks over
the head with a zen-clue-stick.
sincerely.
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email
On the counterclockwise main page :
http://code.google.com/p/counterclockwise/ ,
There's a right box named "Groups" where you'll find the user & developers
group.
For your particular problem, you can also check the ccw documentation wiki
page, and especially the section related to creating "Fat e
p.s. extend seems to work
(extend ::T P {:foo (fn [x] (println x))})
(foo (T))
On Tue, Dec 29, 2009 at 12:08 PM, Raoul Duke wrote:
> i haven't been able to figure out what i'm doing wrong yet. the error
> message isn't super helpful :-}
>
> Clojure 1.1.0-alpha-SNAPSHOT
> user=> (defprotocol P (
>> This seems like a bug to me. Is it?
> As we discussed in #clojure IRC, conj for deftypes does not yet
> support all the flexibility of conj for e.g. hash-maps, in particular,
> the conjing of another map. It does support vectors and map entries.
i'm hoping the "yet" part means it is slated to
> The Assembla wiki is the one:
ah, thanks, got it. i think i was thrown off by (doc reify) not
working, making me think reify was gone and thus the Assembla stuff
was out of date.
(i really don't understand / i do find it really confusing that
there's clojure.org with its own wiki vs. whatever t
On Tue, Dec 29, 2009 at 8:54 AM, tetraourogallus
wrote:
> Hello,
>
> I tried to call an agent inside a dosync and wait on a Java semaphore
> for its completion.
> [I tried clojure's await but that gave nasty exceptions]
> Can anyone explain, why wait-for-agent works as I expected while the
> code
On Mon, Dec 28, 2009 at 9:39 PM, Timothy Pratley
wrote:
> I find this quite interesting because Meikel has effectively created a
> faster version of reductions:
>
> (defn cumulative
> ([accum-fn s]
> (rest (cumulative accum-fn 0 s)))
> ([accum-fn accum s]
> (lazy-seq
> (when-let [[f & r]
On Mon, Dec 28, 2009 at 10:37 PM, Allen Rohner wrote:
> I tried to call merge on a deftype implementing IPersistentMap, and
> got an exception:
>
> user> (deftype Foo [a b] clojure.lang.IPersistentMap)
> #'user/Foo
>
> user> (Foo 1 2)
> #:Foo{:a 1, :b 2}
> user> (merge (Foo 1 2) {:a 3})
> ; Evalua
On Wed, Dec 23, 2009 at 5:03 PM, Mark Derricutt wrote:
> 'lo,
>
> I was reading http://blog.fogus.me/2009/12/21/clojures-pre-and-post/
> on the new pre and post conditions and seeing that they throw
> java.lang.Exception kinda struck me as a bad smell, esp. when
> integrating with other systems wr
On Tue, Dec 29, 2009 at 2:09 PM, Raoul Duke wrote:
>> http://groups.google.com/groups/search?safe=off&q=data+types+protocols+group:clojure&sa=X&oi=spell&spell=1
>
> thanks! that sorta matched what i've already stumbled across in my googling
> :-)
>
> concrete question 1: where is refiy? (doc reif
i haven't been able to figure out what i'm doing wrong yet. the error
message isn't super helpful :-}
Clojure 1.1.0-alpha-SNAPSHOT
user=> (defprotocol P (foo [x]))
P
user=> (deftype T [f] [P] (foo [x] x))
java.lang.ClassCastException: clojure.lang.Var cannot be cast to
java.lang.Class (NO_SOURCE_F
> http://groups.google.com/groups/search?safe=off&q=data+types+protocols+group:clojure&sa=X&oi=spell&spell=1
thanks! that sorta matched what i've already stumbled across in my googling :-)
concrete question 1: where is refiy? (doc reify) doesn't work, but
(reify) does do something.
concrete ques
On Thu, Dec 24, 2009 at 2:51 AM, David Brown wrote:
> The following generates an NPE during compilation:
>
> (deftype Small [])
> (defn wrap []
> (reify Small))
>
> Obviously, my real use has more interfaces I implement, but this shows
> the problem.
>
> My problem is that I need to overri
Hmmm... if we take a look at the first arglist...
[name doc-string? attr-map? [params*] body]
Each of this expects a different type of object right?
name - clojure.lang.Symbol
doc-string? - java.lang.String
attr-map? clojure.lang.IPeristentMap
params* - IPeristentVector
body - IPerisistentSeq
On Sat, Dec 19, 2009 at 3:58 PM, Stuart Halloway
wrote:
> In Clojure it is idiomatic to have optional args at the front of the
> signature. This makes it easy to define convenient caller APIs, but it
> leads to bulky let forms like this one (from clojure.core/defmulti)
>
> (let [docstring (if
Big thanks to everyone, the suggestions given are all very welcome,
even if I didn't really needed a better version as my use of mappad is
really simple for now. It was just curiosity on my part.
The lazy version by Heinz could be quite useful in other situations,
I've added it to my toolbox. Usin
Hello,
I tried to call an agent inside a dosync and wait on a Java semaphore
for its completion.
[I tried clojure's await but that gave nasty exceptions]
Can anyone explain, why wait-for-agent works as I expected while the
code in wait-for-agent/dosync seems to block ?
Regards
(defn awake [_ sem
>
> (defn left-total [lst]
> (reverse (first (reduce (fn [[acc tot] cur]
> [(cons [cur tot] acc) (+ tot cur)])
> [nil 0]
> lst
(defn left-total [s]
(reverse (reduce (fn [y x] (cons (list x (reduce + (first y)))
On 28 дек, 05:36, Conrad wrote:
> I've been writing Clojure code today and have noticed the same pattern
> show up multiple times, but can't find an elegant way to code it in
> idiomatic Clojure. I feel like I'm missing an obvious solution...
> anyone else see something I don't? Thanks in advanc
Sean, thanks.
--
Chouser. Thank you very much. Vestigial, I suppose means: surpassed or
left behind as you explained below. Thanks for your deep insights.
On Dec 27, 8:21 pm, Chouser wrote:
> On Sun, Dec 27, 2009 at 3:29 PM, Liam wrote:
> > In the clojure source, on the JVM side, under "lang/
Thanks for the encouragement! Where can I join the list?
2009/12/28 Laurent PETIT :
> OK I think I understand.
>
> As an open source project written on free-time, ccw is open to any
> contribution.
> Especially, newcomers to Java (and presumably Eclipse) such as you, which
> will find "big wholes"
I've been using a number of similar functions in my own coding. This
was my approach.
(defn seq2map
"Constructs a map from a sequence by applying keyvalfn to each
element of the sequence. keyvalfn should return a pair [key val]
to be added to the map for each input sequence element."
[
Nothing new has been invented in software for the last 40 years...
Mostly recycling of existing concepts with (sometimes) improvements.
Since most people are not reading about the history of computers and
software they are under the impression that the stuff they deal with
is brand new.
Of co
Baishampayan Ghose writes:
> Introducting, Planet Clojure :) Clojure is growing very fast and there
> are a lot of people who write about Clojure. It was time we had our own
> Planet. So here you go -
>
> http://planet.clojure.in/
Nicely done!
I started work on something like this in May, but
On Saturday 28 November 2009 17:25:58 Daniel Simms wrote:
> Also, I wanted to chime in with something like "we already have
> closures: use Clojure! or Jython, or... So how about TCO?"
Amen, brother.
PS: And value types. ;-)
--
Dr Jon Harrop, Flying Frog Consultancy Ltd.
http://www.ffconsultanc
On Saturday 28 November 2009 20:58:54 eyeris wrote:
> It's also important to get features into Java if you want real
> substantial JVM performance tuning for them.
Not if they're anything like Microsoft: F#'s closures are much faster
than .NET's closures...
--
Dr Jon Harrop, Flying Frog Consult
That's fair, except that it's a little disappointing that I can't
reference nested structures from Clojure in the natural way, akin to
Java. In Java, if I had imported NestedStatics, I could reference
NestedStatics.LevelOne without bringing LevelOne into my namespace
(and possibly into conflict wi
On 29 Dec 2009, at 04:14, jim wrote:
> Had an interesting conversation with a programmer friend of mine. He's
> skeptical of my Lisp leanings and mostly sticks to the 'normal'
> languages; C++, Java, etc.
>
> I made that comment that pretty much all the languages derived from
> Algol like the C
When I was trying to interoperate with Java libraries, I really missed
annotations. Not that Lisp really needs annotations. But to
interoperate with Java, you do sometimes.
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send em
38 matches
Mail list logo