Hi Laurent,
On Aug 5, 4:05 pm, Laurent PETIT wrote:
> My point was that by providing different interfaces/protocols to different
> "users", it's more an implementation detail than anything else if they have
> the same object or not.
> I don't expect my users to program on types, but on protocols
Thanks Nikita, I really appreciate your help. -Dave
On Aug 5, 5:53 pm, Nikita Beloglazov wrote:
> See my variant of your
> application:https://gist.github.com/efdb66487e899446332f
> I don't know if it works, because I can't test :(
>
> My thoughts about your example
> You shouldn't think about t
2010/8/6 Kyle Schaffrick
> On Fri, 6 Aug 2010 00:04:08 +0200
> Laurent PETIT wrote:
> >
> > No offense, but ... are you serious ?
>
> So my off-the-cuff, wrote-it-in-5 minutes code is laughable? If you
> mean no offense then why say this at all?
>
I regret having written this. I was upset by a
On Fri, 6 Aug 2010 00:04:08 +0200
Laurent PETIT wrote:
>
> No offense, but ... are you serious ?
So my off-the-cuff, wrote-it-in-5 minutes code is laughable? If you
mean no offense then why say this at all?
:(
>
> I still prefer my own version, repeated here for the record :
>
> (ns delay.ut
2010/8/5 Kyle Schaffrick
> On Thu, 5 Aug 2010 16:05:07 +0200
> Laurent PETIT wrote:
> >
> > My point was that by providing different interfaces/protocols to
> > different "users", it's more an implementation detail than anything
> > else if they have the same object or not. I don't expect my us
On Aug 3, 5:28 pm, Jeff Palmucci wrote:
> See my library athttp://github.com/jpalmucci/clj-yield, which makes
> this trivial.
This looks really nice, Jeff. Thanks. Exactly what I was looking
for.
I notice that the garbage-monitor deftype yields a classname error in
IBM Java6. I renamed it to
See my variant of your application:
https://gist.github.com/efdb66487e899446332f
I don't know if it works, because I can't test :(
My thoughts about your example
You shouldn't think about this procedure as about procedure where you use
loop, like in other imperative languages with mutable data. As
Thanks for the extra parentheses catch. I just noticed that while
working on a different function (after hours of trying to figure it
out).
The program is reading in a pdb file line-by-line. I only want the
xyz-coordinates of carbon atoms, avoiding any repeats when the
coordinate of an atom is u
can you compile the groovy script to .class via groovyc? then you can
use the groovy code within clojure via java interop.
On Thu, Aug 5, 2010 at 2:33 PM, Chris Goellner wrote:
> Hello all, long time listener first time caller.
>
> I've got a situation where I'm trying to apply some Groovy code
>
On Thu, 5 Aug 2010 16:05:07 +0200
Laurent PETIT wrote:
>
> My point was that by providing different interfaces/protocols to
> different "users", it's more an implementation detail than anything
> else if they have the same object or not. I don't expect my users to
> program on types, but on proto
If you're in the Seattle area and interested in Clojure, come on by tonight!
We are generally discussion- and code-centric rather than having
presentations. All experience levels welcome, even if you're just curious.
We are meeting at University Zoka at 7pm:
http://maps.google.com/maps?f=q&source
Hello all, long time listener first time caller.
I've got a situation where I'm trying to apply some Groovy code
against a clojure hashmap.
I've got:
(ns neat
(:import (java.sql Timestamp)
(groovy.lang Binding GroovyShell)
(oracle.sql TIMESTAMP Datum)
(java.uti
Thanks for all the answers. It is a little bit embarrassing, but Paul
Stadig seems to be totally right, it is already implemented.
I don't know how I could have overlooked that - sorry. I guess it is
not that bad of an idea after all then ;-)
I'll be a little more thorough next time I post.
Kind
Hi
I am having trouble with converting this cave generator to clojure.
Basically how would you implement the generateCave method with pop and
push in a functional style?
Here is a description to the algorithm:
http://properundead.com/2009/03/cave-generator.html
And here you can download the AS3 s
On Fri, Aug 6, 2010 at 12:31 AM, Tim Daly wrote:
>
> Measure your OODA loop in all the languages you know.
> See which one cycles fastest. I'd bet that's your favorite language.
Excellent observation! Definitely explains why, for all its lack of
performance and minor quirks, ruby is still my favo
faenvie wrote:
That is the most unsubstantiated, moronic piece of writing I've ever read in my
life. I can't really tell what he's attacking, he's just
swinging some dick-shaped sword around trying to hit stuff.
i do not agree ... its clear that the article is
a rant, does not go deep
Hi, Dave
Why do you use 2 parenthesis before "with-open" in the first variant?
And, as I know, it's not good practice to use def inside functions. Use let
instead.
I also advice you to split your program to smaller functions.
Can you describe, what your program must do? Because don't understand :(
Check us out here:
http://www.workatruna.com/
--
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 with your
first post.
To u
Steve Yegge is badly mis-informed. Large real programs have
been written entirely in lisp.
I am the lead developer on Axiom which is a very large lisp
project (about 1 million things of code) to do computer algebra.
The help system and graphics were implemented in C but browsers
did not exist at
Hi,
I don't understand why this doesn't work:
(ns dpa
(:gen-class)
(:use [incanter.core :only ( matrix )]
[clojure.core :only ( defn doseq line-seq println with-open )]
[clojure.contrib.string :only ( blank? substring? )]
(:import (java.io BufferedReader FileReader)))
(defn
On 5 August 2010 15:52, Stuart Halloway wrote:
> If records implemented IFn, you could treat them as collections, which they
> are not.
Lists are collections, yet they are not IFns. Same goes for Java
collections. As for records, the implementation seems to be in two
minds about their status:
us
Ok, this question is not about clojure itself, just a doubt I have.
Clojure uses the ASM library to compile code to jvm bytecode.
Let's suppose I created the foo.clj and bar.clj source files.
The ns foo in foo.clj depends on the functions of bar in bar.clj.
How the compiler manages file dependencie
>> the entire sequence being in memory. However, if you retain the head
>> of the sequence elsewhere, you will see the same effect.
>
> I don't think my function retains the head? Please correct me if I am
> wrong.
Not that I can see but I don't have the full context. I tried
reproducing just now
Adding to what Meikel said:
A warning sign that the latter version is incorrect is the double open parens:
"((ref-set ..." Double open parens are fairly rare in Clojure code.
Stu
> Hi,
>
> On Aug 5, 4:18 pm, michele wrote:
>> ORIGINAL
>>
>> (defn update-positions [snake apple]
>> (dosync
>
2010/8/5 michele
>
> ORIGINAL
>
> (defn update-positions [snake apple]
> (dosync
>(if (eats? @snake @apple)
> (do (ref-set apple (create-apple))
>(alter snake move :grow))
> (alter snake move)))
> nil)
>
>
> WITHOUT do
>
> (defn update-positions [snake apple]
> (dosync
>
In a word, no. :-)
Records and maps share an API. Maps can be used as anonymous records. Records
generally should not be used as maps.
My address information is a record (whether you bother to create "Address" or
just throw it into a plain ol' map). Everyone's address information keyed by
SSN
I believe the code already does what you are asking about.
Are you talking about something like this?
http://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/APersistentMap.java#L57
this?
http://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/APersistentSet.java#L58
and th
> ORIGINAL
>
> (defn update-positions [snake apple]
> (dosync
> (if (eats? @snake @apple)
> (do (ref-set apple (create-apple))
> (alter snake move :grow))
> (alter snake move)))
> nil)
>
>
> WITHOUT do
>
> (defn update-positions [snake apple]
> (dosync
> (if (eats? @snake @a
Hi,
On Aug 5, 4:18 pm, michele wrote:
> ORIGINAL
>
> (defn update-positions [snake apple]
> (dosync
> (if (eats? @snake @apple)
> (do (ref-set apple (create-apple))
> (alter snake move :grow))
> (alter snake move)))
> nil)
>
> WITHOUT do
>
> (defn update-positions [snake
Maybe I"m just getting stuck on semantics, but I'm confused. If maps are
collections, and records function as maps, aren't records also collections?
Steve
On Thu, Aug 5, 2010 at 8:52 AM, Stuart Halloway
wrote:
> If records implemented IFn, you could treat them as collections, which they
> are n
ORIGINAL
(defn update-positions [snake apple]
(dosync
(if (eats? @snake @apple)
(do (ref-set apple (create-apple))
(alter snake move :grow))
(alter snake move)))
nil)
WITHOUT do
(defn update-positions [snake apple]
(dosync
(if (eats? @snake @apple)
((ref-se
2010/8/5 Meikel Brandmeyer
> Hi,
>
> On Aug 5, 2:47 pm, Laurent PETIT wrote:
>
> > Yes, maybe I'm putting too much ... will need to think about it again
>
> I don't want to talk you into something. I just have a different view.
>
> > But I don't understand your usage of the expression "side-effe
2010/8/5 Stuart Halloway
> If records implemented IFn, you could treat them as collections, which they
> are not.
>
Isn't the fact of making records associative for easing the use of treating
them as collections ?
user=> (assoc (user.R. 1) :b 2)
#:user.R{:a 1, :b 2}
user=> (seq (user.R. 1))
([:
Woops.
> It's just in so far dependent, that it should parse the code
> again, when this was already triggered by a consumer.
I mean't: it should *not* parse the code again ...
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, s
If records implemented IFn, you could treat them as collections, which they are
not. There is an asymmetry here: Maps can be used as (impoverished but easy)
records, but the reverse is not true:
(:foo x); x is logically a record (though might be a map for
simplicity).
(x :foo)
Hi,
On Aug 5, 2:47 pm, Laurent PETIT wrote:
> Yes, maybe I'm putting too much ... will need to think about it again
I don't want to talk you into something. I just have a different view.
> But I don't understand your usage of the expression "side-effect".
Ok. Why do I think that the future st
> > That is the most unsubstantiated, moronic piece of writing I've ever read
> > in my life. I can't really tell what he's attacking, he's just
> > swinging some dick-shaped sword around trying to hit stuff.
i do not agree ... its clear that the article is
a rant, does not go deep and misses im
2010/8/5 Laurent PETIT
>
>
> 2010/8/5 Meikel Brandmeyer
>
>> Hi,
>>
>>
>> On Aug 5, 2:14 pm, Laurent PETIT wrote:
>>
>> > (ns delay.util)
>> >
>> > (defprotocol Cancellable (isCancelled [this]) (cancel [this]))
>> >
>> > (defn timed-delay [pause fun]
>> > (let [d (delay (fun))
>> > f
Here's a nice commentary by fogus on Yegge's piece:
http://blog.fogus.me/2009/02/06/yegge-clojure-arc-and-lolita-or-days-of-future-past/
"For all intents and purposes, Clojure’s creator Rich Hickey is Arc’s
Torvalds quipped on by Mr. Yegge. "
On Aug 5, 8:08 am, faenvie wrote:
> >http://steve-yeg
2010/8/5 Meikel Brandmeyer
> Hi,
>
> On Aug 5, 2:14 pm, Laurent PETIT wrote:
>
> > (ns delay.util)
> >
> > (defprotocol Cancellable (isCancelled [this]) (cancel [this]))
> >
> > (defn timed-delay [pause fun]
> > (let [d (delay (fun))
> > f (future (Thread/sleep pause) @d)]
> > (rei
Just a quick follow-up.
This is a big plus when you know (from meta reasons) that most
successful equality tests will come from the identical? part of the
test.
Then you have most of the fail in O(1) by hashing and most of the
successes in O(1) with identical?. While still being correct and
comple
Hi,
On Aug 5, 2:14 pm, Laurent PETIT wrote:
> (ns delay.util)
>
> (defprotocol Cancellable (isCancelled [this]) (cancel [this]))
>
> (defn timed-delay [pause fun]
> (let [d (delay (fun))
> f (future (Thread/sleep pause) @d)]
> (reify
> clojure.lang.IDeref
> (deref [_]
2010/8/5 abhinav sarkar
> If two objects are equal, they must have same hash code. But it does not
> imply the other way too. Two objects having the same hash code may be not
> equal (see, hash collision). So this approach may give false positives.
>
No, you didn't read the thread carefully enou
2010/8/5 Meikel Brandmeyer
> Hi,
>
> On Aug 5, 11:34 am, Laurent PETIT wrote:
>
> > Now one more question please: your solution looks also slightly more
> complex
> > from the user's perspective: he has to deal with the *parser* object and
> the
> > future object (returned by schedule-parse).
>
2010/8/5 Laurent PETIT
> Hello,
>
> My "problem": the user types in the ccw's editor.
> Each time she types, there's an opportunity to reparse the editor's
> content.
> But the reparse is not always necessary, especially when the types a
> symbol.
>
> So I could use a delay to only force the repa
> http://steve-yegge.blogspot.com/2006/04/lisp-is-not-acceptable-lisp.html
a prophetic writing ... great !
thank you mike.
--
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
If two objects are equal, they must have same hash code. But it does not
imply the other way too. Two objects having the same hash code may be not
equal (see, hash collision). So this approach may give false positives.
-
Abhinav
On Thu, Aug 5, 2010 at 1:45 PM, Nicolas Oury wrote:
> That's might
Hi,
On Aug 5, 11:34 am, Laurent PETIT wrote:
> Now one more question please: your solution looks also slightly more complex
> from the user's perspective: he has to deal with the *parser* object and the
> future object (returned by schedule-parse).
>
> So the question is: what does your solution
Functions are fist-class-objects in Clojure. You can pass them around
just like every other object. You can even create anonymous functions
and pass them to a function. (The function for anonymous functions is
called "fn")
On Thu, Aug 5, 2010 at 7:10 AM, foop1 wrote:
> Hmm interesting , Thank you
ok.
Now one more question please: your solution looks also slightly more complex
from the user's perspective: he has to deal with the *parser* object and the
future object (returned by schedule-parse).
So the question is: what does your solution provide that the sketch of my
solution does not ? D
Hi Laurent,
On Aug 5, 11:07 am, Laurent PETIT wrote:
> Looks complex.
Hmm.. Maybe we can save the agent and use an atom? (For some reason, I
thought, it wouldn't work with an atom...)
(def *parser* (atom nil))
(defn schedule-parse
[]
(reset! *parser* (delay (parse-stuff
(defn trigger
2010/8/5 Meikel Brandmeyer
> Hi Laurent,
>
> On Aug 5, 9:41 am, Laurent PETIT wrote:
>
> > Here is what I've come up in my head :
> > * create a datastructure with 2 fields, one holding a future, one
> holding a
> > delay. the future will "wait" for n millisecs, and then force the delay.
> > *
Hmm... Beware of dead-lock? Maybe one should use send-off in a future
combined with a promise? futures use the same thread pool as agents. A
carefully crafted program (read: the real world) could use all threads
for futures waiting for the sends to execute which might never happen.
Would send-off s
Hi Laurent,
On Aug 5, 9:41 am, Laurent PETIT wrote:
> Here is what I've come up in my head :
> * create a datastructure with 2 fields, one holding a future, one holding a
> delay. the future will "wait" for n millisecs, and then force the delay.
> * The datastructure will accept the future API
That's might be an interesting trade-of to try.
It is really good when big data structures are nearly equal. The
comparison is linear but the comparaison once you know the hash is
O(1) with a high probability.
It is bad on very different structure, if you force a hash.
Ideally, the equals method co
Hello,
My "problem": the user types in the ccw's editor.
Each time she types, there's an opportunity to reparse the editor's content.
But the reparse is not always necessary, especially when the types a symbol.
So I could use a delay to only force the repase "on-demand".
On the other end, when th
56 matches
Mail list logo