Re: {ANN} clojure-control 0.4.1 released.

2012-07-18 Thread dennis zhuang
I see,thanks. Pallet is more powerful than clojure-control.It seems that it contains many features for cloud service rather than just a deployment tool. And clojure-control is just a deployment tool like fabric in python for many machines using SSH,it can reuse tasks and clusters,and have a simpl

Re: atom and lock

2012-07-18 Thread Ulises
Please excuse my ignorance and my late comment, but can you make your 1hr operation shorter? The general advice I've always been given has been "whenever you need to use a resource that might cause contention do it quickly, in and out in a blink". I know that the argument then would be "why do I

Re: Idea around SCMs and Clojure

2012-07-18 Thread Mark Derricutt
On 17/07/12 10:27 PM, N8Dawgrr wrote: In a nutshell its about why use files for source in Clojure, can we do better? Almost sounds like you're wanting the Smalltalk "image" along with something like Monticello - the smalltalk distributed version control system ( versioning at the function l

why does Clojure need to cache keywords?

2012-07-18 Thread jaime
Hello, When I read the source code keyword, say, Keyword.java (V1.3), I found that when we "intern" a keyword, (if I understand it correctly) it uses a cache for keywords: = public static Keyword intern(Symbol sym) { if (sym.meta() != null) sym = (S

Re: why does Clojure need to cache keywords?

2012-07-18 Thread dennis zhuang
Compare keywords can be very fast. 在 2012-7-18 PM4:51,"jaime" 写道: > Hello, > > When I read the source code keyword, say, Keyword.java (V1.3), I found > that when we "intern" a keyword, (if I understand it correctly) it uses > a cache for keywords: > =

Re: why does Clojure need to cache keywords?

2012-07-18 Thread jaime
I doubt because keyword will use its internal Symbol object to compare with each other (or other objects), it means it's Symbol's interned strings(ns & name) make the comparison fast but not this caching stuff. I found a "find()" method in source code but not sure if the cache is relevant to th

Re: community interest in machine learning (?)

2012-07-18 Thread Maik Schünemann
I'm interested too and I am glad to here that the community shares the interest! Clojure seems like an ideal AI and ML language for me because of its lisp heritage and because it is running on the jvm and can use all java and jvm language libraries and vice versa On Wed, Jul 18, 2012 at 3:58 AM, m

Re: atom and lock

2012-07-18 Thread Andrew Rafas
On Wednesday, July 18, 2012 1:20:03 AM UTC+1, Warren Lynn wrote: > > The "making progress" seems an illusion here to me. Sure, you can make > progress in one thread while another thread is taking one hour to finish > its part. But the cost is the "long" thread finally found out "oops, I have >

Re: why does Clojure need to cache keywords?

2012-07-18 Thread dennis zhuang
I think this cache is just the same with String.intern method in java,it just want to reduce the cost (memory & cpu) of producing keywords frequently especial when using them with map structure. 2012/7/18 jaime > I doubt because keyword will use its internal Symbol object to compare > with each

Re: why does Clojure need to cache keywords?

2012-07-18 Thread jaime
make senseI just came up with this similar answer on my way home...Thanks. 在 2012年7月18日星期三UTC+8下午6时56分42秒,dennis写道: > > I think this cache is just the same with String.intern method in java,it > just want to reduce the cost (memory & cpu) of producing keywords > frequently especial when usi

Re: atom and lock

2012-07-18 Thread Timothy Baldridge
>> Being lockless seems useful for certain cases (like real-time system as >> mentioned in the Wikipedia article). But I still could not grasp the idea >> how it can increase *real* work throughput, as the problem itself mandates a >> part of the work can only be done in serial. Well first of all

Re: atom and lock

2012-07-18 Thread Brian Hurt
Accesses to atoms are just wrappers around atomic compare and swap instructions at the hardware level. Locking an object also uses an atomic compare and swap, but piles other stuff on top of it, making it more expensive. So atoms are useful in situations where there is likely not going to be much

how do I get primitive typ hints to appear in the output of a macro?

2012-07-18 Thread john
Hello, how do I get primitive typ hints to appear in the output of a macro? like : (defmacro aTest [] `(~'defn ~'aFun [^long ~'b ] (meta ~'b) )) (macroexpand-1 '(aTest)) yields : (aFun 7) (macroexpand-1 '(aTest)) yields : (defn aFun [b] (clojure.core/meta b)) but I wold like it to be : (

Re: atom and lock

2012-07-18 Thread Marshall T. Vandegrift
Warren Lynn writes: > I have a hard time understanding why there is a need to retry when > doing "swap!" on an atom. Why does not Clojure just lock the atom > up-front and do the update? This is just my two cents, but I think the/one big reason is that Clojure atoms just *are* non-locking STM-ba

Re: atom and lock

2012-07-18 Thread Meikel Brandmeyer (kotarak)
Hi, Am Mittwoch, 18. Juli 2012 00:57:13 UTC+2 schrieb Warren Lynn: > > I have a hard time understanding why there is a need to retry when doing > "swap!" on an atom. Why does not Clojure just lock the atom up-front and do > the update? I have this question because I don't see any benefit of the

Re: how do I get primitive typ hints to appear in the output of a macro?

2012-07-18 Thread Ambrose Bonnaire-Sergeant
Hi John, The type hint ^long expands to ^{:tag long}. So something like this should do the trick (untested). (defmacro aTest [] `(~'defn ~'aFun [^{:tag '~'long ~'b ] (meta ~'b) )) Thanks, Ambrose On Wed, Jul 18, 2012 at 7:55 PM, john wrote: > Hello, > how do I get primitive typ hints to a

Re: community interest in machine learning (?)

2012-07-18 Thread Joshua Bowles
I've written to Coursera to request a course in "Artificial Intelligence with Clojure"; they offer about 8 courses related to Artificial Intelligence. One of the latest course offerings is "Functional Programming Principles in Scala" taught by the language's creator Martin Odersky. If you would li

Re: how do I get primitive typ hints to appear in the output of a macro?

2012-07-18 Thread john
Hi Ambrose, I liked your core.logic video very much! But no the code doeen't seem to work: (defmacro aTest [] `(~'defn ~'aFun [^{:tag ~'long} ~'b ] (meta ~'b) )) and I also tried: (defmacro aTest [] (list 'defn 'aFun (vector (with-meta 'b {:tag long})) '(meta b))) before (aFun 8) yields

Re: how do I get primitive typ hints to appear in the output of a macro?

2012-07-18 Thread Ambrose Bonnaire-Sergeant
:-) Sorry, it has me stumped too. Hopefully someone can clarify. Ambrose On Wed, Jul 18, 2012 at 8:28 PM, john wrote: > Hi Ambrose, > I liked your core.logic video very much! > But no the code doeen't seem to work: > > (defmacro aTest [] > `(~'defn ~'aFun [^{:tag ~'long} ~'b ] (meta ~'b) ))

Re: how do I get primitive typ hints to appear in the output of a macro?

2012-07-18 Thread Meikel Brandmeyer (kotarak)
Hi, the correct syntax is (defmacro aTest [] `(defn ~'aFun [~(with-meta 'b {:tag 'long})])) ; (meta (first (nth (macroexpand-1 '(aTest)) 2))) => {:tag long} The 'long might also be a `long. I'm not sure about that one. Kind regards Meikel PS: Shameless self-promotion: http://kotka.de/blo

Re: Idea around SCMs and Clojure

2012-07-18 Thread Nahuel Greco
What about storing the vars definitions in Datomic? Maybe augmented with semantic information ("added defmethod", "redefined function", etc). Saludos, Nahuel Greco. On Wed, Jul 18, 2012 at 5:19 AM, Mark Derricutt wrote: > On 17/07/12 10:27 PM, N8Dawgrr wrote: > > > In a nutshell its about why u

Expanding the Community Through Online Courses

2012-07-18 Thread Harrison Maseko
Hi All, Massive Open Online Courses (MOOC) such as the ones offered by Udacity , Coursera , and soon edXwill eventually become platforms from which a language can be showcased and exposed to a very wide audience. Here a

Re: Idea around SCMs and Clojure

2012-07-18 Thread Nathan Matthews
Hi Nahuel, I think from a technical perspective something like Datomic would be a good fit, I think it has the right ingredients. If Git allows access to the lower layers, that may also be a good fit. One of my frustrations with source control systems is the way you end up repeating information

Re: Expanding the Community Through Online Courses

2012-07-18 Thread Yann Schwartz
On Wed, Jul 18, 2012 at 3:01 PM, Harrison Maseko wrote: > Hi All, > Massive Open Online Courses (MOOC) such as the ones offered by > Udacity > , Coursera , and soon > edXwill eventually become platforms from which a >

Re: Idea around SCMs and Clojure

2012-07-18 Thread Leonardo Borges
I haven't been following this discussion that closely so far but I'd like to comment on this bit: > One of my frustrations with source control systems is the way you end up > repeating information, e.g. Modified function X, Refactored function Y. > > Added defmethod etc… This information is alre

Re: Idea around SCMs and Clojure

2012-07-18 Thread Chris Ford
I really hope that refactoring-aware diffs are on their way. They'll allow for a whole class of merge conflicts to be resolved automatically. Chris On 18 July 2012 14:19, Leonardo Borges wrote: > I haven't been following this discussion that closely so far but I'd > like to comment on this bit:

Re: Expanding the Community Through Online Courses

2012-07-18 Thread Harrison Maseko
Hi Yann, I agree that Udacity is more approachable in this regard than Coursera. But imagine the publicity the language would get if such a massive audience were given exposure to Clojure and Clojurescript. I have always believed that a subset of Clojure (or any Lisp) could be taught even to pro

[ANN] jenkins-leiningen

2012-07-18 Thread Pierre-Yves Ritschard
Hi guys, I wanted this for a while so here goes: https://github.com/pyr/jenkins-leiningen. It is very simplistic and inspired from the sbt one. I posted a small blurb about it here as well: http://spootnik.org/entries/2012/07/18_a-leiningen-plugin-for-jenkins.html Cheers, - pyr -- You recei

Re: Expanding the Community Through Online Courses

2012-07-18 Thread Joshua Bowles
Yes! Just this morning (before reading this thread) I emailed Coursera to request a course like "Artificial Intelligence in Clojure". I posted on a separate thread here ("community interest in machine learning(?)") that I had made the request and provided a link for anyone else who wanted to make a

Re: Expanding the Community Through Online Courses

2012-07-18 Thread Harrison Maseko
That sounds like a good move, if a professor at some at one of those Coursera linked universities would be willing to do that. However, can the same request be sent to Udacity? Also, is AI the only practical course to suggest? I would like to suggest to Udacity, "Introduction to Functional Prog

Re: Expanding the Community Through Online Courses

2012-07-18 Thread Joshua Bowles
I agree. My thinking with an AI class is that as LISP used to be taught for AI in school, and most programs offer Java classes, there's got to be a few Professors out there who really dig Clojure and have a good chance teaching it. I didn't propose a "functional programming" course because they alr

Re: Expanding the Community Through Online Courses

2012-07-18 Thread Joshua Bowles
Peter Norvig's response: Possible ... Udacity would be more likely -- they seem to be more skill-based whereas Coursera is more academic-based. On Wed, Jul 18, 2012 at 10:16 AM, Joshua Bowles wrote: > I agree. My thinking with an AI class is that as LISP used to be taught > for AI in school, and

Re: Expanding the Community Through Online Courses

2012-07-18 Thread Joshua Bowles
I've made a request to Udacity and forwarded Harrison Maseko's suggestions in my request. I'm sure if enough people get behind this... On Wed, Jul 18, 2012 at 10:33 AM, Joshua Bowles wrote: > Peter Norvig's response: > > Possible ... Udacity would be more likely -- they seem to be more > skill-b

Re: Idea around SCMs and Clojure

2012-07-18 Thread Softaddicts
I come from a world were we would write assembler code directly in hexadecimal using the debugger and decipher the memory dump to write back the source code. You learned to be very fluent in hexadecimal :))) Luc P. > > I don't think so. After some practice you can read patches as if they > >

Re: Expanding the Community Through Online Courses

2012-07-18 Thread Eduardo Bellani
Great idea and great effort. I would be awesome if Norvig gave a class based on his PAIP book, using clojure or any other lisp beast. On Wed, Jul 18, 2012 at 1:38 PM, Joshua Bowles wrote: > I've made a request to Udacity and forwarded Harrison Maseko's suggestions > in my request. > > I'm sure if

Re: Expanding the Community Through Online Courses

2012-07-18 Thread Erlis Vidal
Great idea! But even the community could create the space to learn clojure a la UDacity. Something like Khan Academy but for clojure, where people can choose a topic, maybe even a function and instead of having text as documentation, we could have videos, with advises and real life examples on how

Re: atom and lock

2012-07-18 Thread Alan Malloy
Sorta off-topic from the main discussion, but in reference to the error you pointed out, one clever fix for this is to add a delay around the future: (defn cache-image [icache url] (let [task (delay (future (download-image url)))] (doto (swap! icache update-in [url] #(or % task)) (->

Re: Expanding the Community Through Online Courses

2012-07-18 Thread Harrison Maseko
That's true. This reminds me of Pascal Chatterjee's Talking to Machines. It should be possible to fork it and embed it in videos? That is if we take the route suggested by Erlis Vidal. What else would that kind of work need? -h On Wednesday, July 18, 2012 7:55:14 P

Re: atom and lock

2012-07-18 Thread Warren Lynn
Thanks for the discussion This is not a reply to any particular post. Here is my thinking on the various points raised. 1. The length of the critical section is irrelevant in this discussion. Even with locks, people agree that the critical section should be as short as possible. So the limiting

Re: Expanding the Community Through Online Courses

2012-07-18 Thread Harrison Maseko
Thanks, Joshua. On Wednesday, July 18, 2012 6:38:10 PM UTC+2, Joshua Bowles wrote: > > I've made a request to Udacity and forwarded Harrison Maseko's suggestions > in my request. > > I'm sure if enough people get behind this... > > On Wed, Jul 18, 2012 at 10:33 AM, Joshua Bowles wrote: > >> Peter

Re: atom and lock

2012-07-18 Thread Timothy Baldridge
>> But consider swap! is already doing some kind of internal locking at commit >> time as I mentioned before >> I assume even with STM style atom, some kind of lock is happening >> internally, for the final commit, because when committing, >> you still need to coordinate the access to some state

Re: atom and lock

2012-07-18 Thread Timothy Baldridge
> It's not. Locks are created by using CAS, not the other way around. > On a x86 machine the swap basically compiles down to a single assembly > code instruction: > Eh, let me clarify thatlocks do exist on x86, it's just that they only lock a single assembly instruction. The complete list of i

Re: Expanding the Community Through Online Courses

2012-07-18 Thread mnicky
Another one that comes into mind is SICP course [1] in Clojure. Given Clojure's similarity to Scheme it should be doable. Also, because the SICP book is now licensed under CC-BY-SA, there shouldn't be any copyright problems etc. IMO [1] http://groups.csail.mit.edu/mac/classes/6.001/abelson

Re: atom and lock

2012-07-18 Thread Warren Lynn
It's not. Locks are created by using CAS, not the other way around. > On a x86 machine the swap basically compiles down to a single assembly > code instruction: > > http://jsimlo.sk/docs/cpu/index.php/cmpxchg.html > > On a normal x86 machine, every lock in the system will boil down to > usin

Re: atom and lock

2012-07-18 Thread Timothy Baldridge
> Now I got a broader question, why CAS is hardware supported, but lock is not > (i.e., why it is not the other way around)? I used to work on some firmware, > and we have hardware mutex. Why this is not generally the case for general > purpose CPUs? There's several issues at work here, I'll try t

Re: atom and lock

2012-07-18 Thread Softaddicts
With multiple CPUs, for costs and design complexity reasons, coordination uses test and set instructions in shared memory. When the bit is set, other contenders can either try latter or enter a spin loop (spin lock) retrying the operation until it succeeds. Implementing complex hardware atomic i

Can you make Amotoen faster?

2012-07-18 Thread Richard Lyman
All, There's not much code, and (sadly) not much documentation, but what's there needs some performance love. https://github.com/richard-lyman/amotoen Notes: - jvisualvm doesn't like me this week so help there might be enough (I can't see anything other than clojure classes - I'd love to only s

Re: how do I get primitive typ hints to appear in the output of a macro?

2012-07-18 Thread dgrnbrg
I don't think that the type hint will appear in the printed output. It is metadata, so it won't be shown by the printer. If you try (let [[_ _ [b] (macroexpand-1 '(aTest))] (meta b)) you should see {:tag long}. On Wednesday, July 18, 2012 7:55:31 AM UTC-4, john wrote: > > Hello, > how do I get p

Re: how do I get primitive typ hints to appear in the output of a macro?

2012-07-18 Thread john
yes that's the reason thank you very much! Meikel also pointed me in that direction with ; (meta (first (nth (macroexpand-1 '(aTest)) 2))) => {:tag long} and on ihis blog *http://kotka.de/blog/2009/12/with-meta_and_the_reader.html* which