Re: ANN: clj-schema, Schemas For Clojure Maps

2012-12-11 Thread Alex Baranosky
Christophe, one thing I've wondered about the design of clj-schema is whether the schema is even the right place for determining looseness or strictness. In some sense that is a property of the validation process. It sometimes makes sense to use the same schema, but in some cases validate it

Re: Clojure contrib datalog

2012-12-11 Thread Shantanu Kumar
Thanks, Alexander and Bronsa! Shantanu On Monday, 10 December 2012 21:13:37 UTC+5:30, Bronsa wrote: There's also https://github.com/fogus/bacwn 2012/12/10 Alexander Solovyov alex...@solovyov.net javascript: Hi, I don't think it's maintained somewhere (at least I haven't seen anything),

Re: ANN: clj-schema, Schemas For Clojure Maps

2012-12-11 Thread Laurent PETIT
2012/12/11 Alex Baranosky alexander.barano...@gmail.com Christophe, one thing I've wondered about the design of clj-schema is whether the schema is even the right place for determining looseness or strictness. In some sense that is a property of the validation process. It sometimes makes

Re: abysmal multicore performance, especially on AMD processors

2012-12-11 Thread Marshall Bockrath-Vandegrift
nicolas.o...@gmail.com nicolas.o...@gmail.com writes: What happens if your run it a third time at the end?  (The question is related to the fact that there appears to be transition states between monomorphic and megamorphic call sites,  which might lead to an explanation.) Same results, but

Re: ANN: clj-schema, Schemas For Clojure Maps

2012-12-11 Thread Alex Baranosky
Hi Laurent, I've committed some refactoring that implements defschema in terms of def-loose-schema. I also added a note to the readme explaining that :clj-schema.schema/strict true metadata is required to make a schema strict. As for the beginning part of your message, I have to mull the ideas

Re: ANN: clj-schema, Schemas For Clojure Maps

2012-12-11 Thread Christophe Grand
On Tue, Dec 11, 2012 at 9:30 AM, Alex Baranosky alexander.barano...@gmail.com wrote: Christophe, one thing I've wondered about the design of clj-schema is whether the schema is even the right place for determining looseness or strictness. In some sense that is a property of the validation

Re: STM - a request for war stories

2012-12-11 Thread Marko Topolnik
To give the full story, I should add that atoms are very natural to use and many concurrent use cases are covered by them alone. The combination of atom and immutable vector/map goes a long way and they are also useful even with mutable data, such as lazy-initialized singletons, resources that

Re: How things are going about expansion, class creation and loading of procedures

2012-12-11 Thread Yoshinori Kohyama
Mr. @athos0220 gave me a great help via twitter. https://twitter.com/athos0220/status/278439357126418432 (in Japanese) http://ideone.com/8mBm5N https://gist.github.com/4255602 Now I can write macros without class files. Thank you. With regards, Yoshinori Kohyama -- You received this message

Re: Interop question concerning optional args

2012-12-11 Thread Vladimir Tsichevski
I found this (mis)feature quite annoying too. I think, we all shall ask the language authors to fix it. On Tuesday, December 11, 2012 10:44:34 AM UTC+4, Andy Fingerhut wrote: You can pass in a length 0 array of java.nio.file.attribute.FileAttribute's like so:

Re: Meaning of =

2012-12-11 Thread Jim foo.bar
I disagree... One of the nice things about clojrue is that, at tis hear, lies the 'equiv' operator which is basically the 'egal' fn as defined by Baker [1993] [Equal rights for functional objects or the mroe things change the more they stay the same]. When using '=' with data-structures you

Re: Meaning of =

2012-12-11 Thread Jim foo.bar
From the docs: Equality. Returns true if x equals y, false if not. Same as Java x.equals(y) except it also works for nil, and compares numbers and collections in a type-independent manner. Clojure's immutable data structures define equals() (and thus =) as a value,*not an identity*,

Re: Meaning of =

2012-12-11 Thread Jim foo.bar
If you're looking for some truly unintuitive equality behavior check this out: user= (def pred (Boolean. false)) ;;not a primitive but an object #'user/pred user= (= pred false) true user= (when pred (println I really shouldn't print)) I really shouldn't print nil Jim On 11/12/12 13:19,

Re: Meaning of =

2012-12-11 Thread Jim foo.bar
Apologies...I did not realise this had already been answered... oops! :-) On 11/12/12 13:32, Jim foo.bar wrote: If you're looking for some truly unintuitive equality behavior check this out: user= (def pred (Boolean. false)) ;;not a primitive but an object #'user/pred user= (= pred false)

Re: Meaning of =

2012-12-11 Thread Nathan Matthews
For more surprising behaviour: (= #.* #.*) Sent from my iPhone On 11 Dec 2012, at 13:32, Jim foo.bar jimpil1...@gmail.com wrote: If you're looking for some truly unintuitive equality behavior check this out: user= (def pred (Boolean. false)) ;;not a primitive but an object

Re: New System Architecture in Clojure

2012-12-11 Thread Paul deGrandis
I would take a look at MIT's Pyxis for help. The publications and work sounds very similar to what you're shooting for: http://web.mit.edu/newsoffice/2012/making-web-applications-more-efficient-0831.html Paul -- You received this message because you are subscribed to the Google Groups Clojure

Re: New System Architecture in Clojure

2012-12-11 Thread ArturoH
Paul, That is exactly what I was driving at, with a slight difference. Pryxis takes an existing program with all the extra code and makes it faster. I would like to build new applications, and I don't even want to build the extra code to begin with. Naively speaking, a system that was built

Re: abysmal multicore performance, especially on AMD processors

2012-12-11 Thread Lee Spector
On Dec 11, 2012, at 4:37 AM, Marshall Bockrath-Vandegrift wrote: I’m not sure what the next steps are. Open a bug on the JVM? This is something one can attempt to circumvent on a case-by-case basis, but IHMO has significant negative implications for Clojure’s concurrency story. I've gotten

Re: No show?

2012-12-11 Thread Asim Jalis
This is a good workaround—however, I still wish repl-utils/show was still there. It was nice to always have it there instead doing this defn every time I need it to explore a Java API. On Sat, Feb 11, 2012 at 6:30 PM, Michał Marczyk michal.marc...@gmail.comwrote: On 11 February 2012 10:35, Ken

Re: [ANN]First toy-project : CYASUS

2012-12-11 Thread Asim Jalis
I tried to run this using git clone git://github.com/Yakulu/cyasus.git lein deps lein run And got a failure with this exception: Exception in thread main java.lang.ClassNotFoundException: cyasus.config, compiling:(cyasus/common.clj:8) Did you forget to check in a file? Also do you

Re: abysmal multicore performance, especially on AMD processors

2012-12-11 Thread Gary Johnson
Lee, My reading of this thread is not quite as pessimistic as yours. Here is my synthesis for the practical application developer in Clojure from reading and re-reading all of the posts above. Marshall and Cameron, please feel free to correct me if I screw anything up here royally. ;-) When

Re: abysmal multicore performance, especially on AMD processors

2012-12-11 Thread Marshall Bockrath-Vandegrift
Lee Spector lspec...@hampshire.edu writes: Is the following a fair characterization pending further developments? If you have a cons-intensive task then even if it can be divided into completely independent, long-running subtasks, there is currently no known way to get significant speedups

Vector of different refs?

2012-12-11 Thread Thomas
Hi, How do I create a vector of different refs? I would like to have a vector with in each cell a ref so that I can manipulate them independently from each other (Is that a good idea anyway?). But when I do (def x (into [] (repeat 10 (ref 100 I end up with the same ref ten times (not

Re: Vector of different refs?

2012-12-11 Thread Ray Miller
(repeatedly 10 #(ref 100)) Ray. On 11 December 2012 16:44, Thomas th.vanderv...@gmail.com wrote: Hi, How do I create a vector of different refs? I would like to have a vector with in each cell a ref so that I can manipulate them independently from each other (Is that a good idea

Re: Vector of different refs?

2012-12-11 Thread Timothy Baldridge
To answer your question: (def x (into [] (map (fn [x] (ref 100)) (range 10 Or, instead of map into, use mapv. But yes, 90% of the time you are better served by putting the entire vector in a single ref. Try using as little mutable state as possible, and you'll

Re: abysmal multicore performance, especially on AMD processors

2012-12-11 Thread Lee Spector
On Dec 11, 2012, at 11:40 AM, Marshall Bockrath-Vandegrift wrote: Or have I missed a currently-available work-around among the many suggestions? You can specialize your application to avoid megamodal call sites in tight loops. If you are working with `Cons`-order sequences, just use

Re: [ANN]First toy-project : CYASUS

2012-12-11 Thread Rogelio
I had the same problem. I changed line 8 in common.clj as follows: it was: (def params cyasus.config/params) changed to: (def params cyasus-ring.config/params) because it looked like the namespace in config.clj was cyasus-ring not cyasus. This worked for me, but I've only been using Clojure

Re: Meaning of =

2012-12-11 Thread Andy Fingerhut
I added some text to the macro if on ClojureDocs.org last time this issue was discussed on the email list. It is a bit wordy, but does also mention that this is something the Java docs themselves warn about. http://clojuredocs.org/clojure_core/clojure.core/if Andy On Dec 11, 2012, at 5:38

Re: Interop question concerning optional args

2012-12-11 Thread Andy Fingerhut
There is a ticket filed for it, in case some contributor wants to update the patches for it. It got intertwined with CLJ-445's patch, which hasn't been updated in a while, so you might want to start fresh rather than untangle the history there. http://dev.clojure.org/jira/browse/CLJ-440 Andy

Re: abysmal multicore performance, especially on AMD processors

2012-12-11 Thread Marshall Bockrath-Vandegrift
Lee Spector lspec...@hampshire.edu writes: If the application does lots of list processing but does so with a mix of Clojure list and sequence manipulation functions, then one would have to write private, list/cons-only versions of all of these things? That is -- overstating it a bit, to be

Re: STM - a request for war stories

2012-12-11 Thread Patrick Logan
I am unsure whether you are writing about STM in general or in Clojure specifically. I worked for Gemstone Systems for five years on the object engine as well as applications of the distributed, multi-user, garbage-collected STM that is the centerpiece of Gemstone Smalltalk. During that time I

Autotest for Clojure/Midje?

2012-12-11 Thread Timothy Baldridge
For a project I'm working on it would be awesome to have my tests auto-rerun after every file change. I know lazy test exists, but it doesn't work with Lein2 it seems. In the past I've used speclj with lein speclj -a. But I'd rather not use specs in this design, instead sticking with clojure's

Re: Autotest for Clojure/Midje?

2012-12-11 Thread Jay Fields
another option: https://github.com/jaycfields/expectations https://github.com/jakemcc/lein-autoexpect On Tue, Dec 11, 2012 at 12:38 PM, Timothy Baldridge tbaldri...@gmail.com wrote: For a project I'm working on it would be awesome to have my tests auto-rerun after every file change. I know

when is a zipper better than get-in ?

2012-12-11 Thread larry google groups
I am sorry for the dumb question, but zippers are for looping over nested collections, yes? Why can't I just use get-in for that? When would I need a zipper? -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to

Re: core.logic vs. Prolog

2012-12-11 Thread JvJ
Is there a list of features that you'd like to implement that core.logic doesn't have yet? On Tuesday, 11 December 2012 00:52:24 UTC-5, David Nolen wrote: core.logic is still pretty young - some (many?) Prolog niceties may not be present. Don't know until you try ;) On Tue, Dec 11, 2012

Re: Autotest for Clojure/Midje?

2012-12-11 Thread Brian Marick
On Dec 11, 2012, at 12:38 PM, Timothy Baldridge tbaldri...@gmail.com wrote: For a project I'm working on it would be awesome to have my tests auto-rerun after every file change. I know lazy test exists, but it doesn't work with Lein2 it seems. (defproject ... :profiles {:dev

Re: when is a zipper better than get-in ?

2012-12-11 Thread Brian Marick
On Dec 11, 2012, at 12:48 PM, larry google groups lawrencecloj...@gmail.com wrote: I am sorry for the dumb question, but zippers are for looping over nested collections, yes? Why can't I just use get-in for that? When would I need a zipper? If you want to edit trees, using zippers is

Slime and heroku setup question

2012-12-11 Thread Jonathon McKitrick
I sort of got clojure interactively running and working with slime. I'd like to interactively run and test in emacs, then push to heroku. Any tutorials or pointers on how to do this? -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this

Re: when is a zipper better than get-in ?

2012-12-11 Thread Brian Marick
On Dec 11, 2012, at 1:04 PM, Brian Marick mar...@exampler.com wrote: If you want to edit trees, using zippers is often much much easier than collection functions. I find the code easier to understand, too. I almost forgot to make a shameless plug for /Functional Programming for the

Re: STM - a request for war stories

2012-12-11 Thread Stuart Halloway
Hi Paul, If it isn't too late to change your chapter title, I would encourage emphasizing Clojure's model of references and values in general, and the option of implementing a variety of different reference semantics that all conform to the same basic API shape. That general approach has been

Re: STM - a request for war stories

2012-12-11 Thread Stuart Halloway
Hi Paul, Here is a real-world, production software example of the advantage of values+refs over mutable objects and locks. A Datomic user reported the following stack trace as a potential bug: 12:45:43.480 [qtp517338136-84] WARN c.v.a.s.p.e.UnknownExceptionHandler - UnknownExceptionHandler:

Re: abysmal multicore performance, especially on AMD processors

2012-12-11 Thread Wm. Josiah Erikson
OK WOW. You hit the nail on the head. It's reverse being called in a pmap that does it. When I redefine my own version of reverse (I totally cheated and just stole this) like this: (defn reverse-recursively [coll] (loop [[r more :as all] (seq coll) acc '()] (if all (recur

Re: abysmal multicore performance, especially on AMD processors

2012-12-11 Thread Wm. Josiah Erikson
And, interestingly enough, suddenly the AMD FX-8350 beats the Intel Core i7 3770K, when before it was very very much not so. So for some reason, this bug was tickled more dramatically on AMD multicore processors than on Intel ones. On Tue, Dec 11, 2012 at 2:54 PM, Wm. Josiah Erikson

Re: abysmal multicore performance, especially on AMD processors

2012-12-11 Thread Andy Fingerhut
Marshall: I'm not practiced in recognizing megamorphic call sites, so I could be missing some in the example code below, modified from Lee's original code. It doesn't use reverse or conj, and as far as I can tell doesn't use PersistentList, either, only Cons. (defn burn-cons [size] (let

Re: when is a zipper better than get-in ?

2012-12-11 Thread Russell Whitaker
I just downloaded the sample PDF for FP-OO, and it's delightful; I'll be springing for a copy myself. Russell On Tue, Dec 11, 2012 at 11:14 AM, Brian Marick mar...@exampler.com wrote: On Dec 11, 2012, at 1:04 PM, Brian Marick mar...@exampler.com wrote: If you want to edit trees, using

Re: abysmal multicore performance, especially on AMD processors

2012-12-11 Thread Wm. Josiah Erikson
...and, suddenly, the high-core-count Opterons show us what we wanted and hoped for. If I increase that range statement to 100 and run it on the 48-core node, it takes 50 seconds (before it took 50 minutes), while the FX-8350 takes 3:31.89 and the 3770K takes 3:48.95. Thanks Marshall! I think you

Re: abysmal multicore performance, especially on AMD processors

2012-12-11 Thread Wm. Josiah Erikson
Hm. Interesting. For the record, the exact code I'm running right now that I'm seeing great parallelism with is this: (defn reverse-recursively [coll] (loop [[r more :as all] (seq coll) acc '()] (if all (recur more (cons r acc)) acc))) (defn burn ([] (loop [i 0

Re: STM - a request for war stories

2012-12-11 Thread Marko Topolnik
Just curious, how did you immediately eliminate the possibility that the reducing function was mutating the list that is being reduced? No concurrency involved. In regular Java the 95% leading cause of CME is precisely that. Anyway, this applies to immutable structures per se, whether combined

Re: STM - a request for war stories

2012-12-11 Thread Timothy Baldridge
I want to +1 what Stuart said. In my research on the subject, almost every implementation of STM that allows for mutable-by-default data has ended up as a miserable failure. Specifically see the results from Microsoft's research: http://www.infoq.com/news/2010/05/STM-Dropped Clojure's

why is nth called here?

2012-12-11 Thread Dennis Haupt
i am trying to solve euler problem 125. when i tested this code: (ns euler.Problem125) (defn is-palindrome [n] (let [s (str n)] (= (seq s) (reverse s (defn to-check [] (filter is-palindrome (range 1 1000))) (defn square-root [n] (Math/sqrt n)) (defn squared [n] (* n n)) (defn

Re: why is nth called here?

2012-12-11 Thread Ben Wolfson
nth is called in doing the destructuring for the argument lists in your fns defined in try-find-sequence. On Tue, Dec 11, 2012 at 1:20 PM, Dennis Haupt d.haup...@gmail.com wrote: i am trying to solve euler problem 125. when i tested this code: (ns euler.Problem125) (defn is-palindrome [n]

Re: why is nth called here?

2012-12-11 Thread Dennis Haupt
i just saw my error :/ Am 11.12.2012 22:22, schrieb Ben Wolfson: nth is called in doing the destructuring for the argument lists in your fns defined in try-find-sequence. On Tue, Dec 11, 2012 at 1:20 PM, Dennis Haupt d.haup...@gmail.com wrote: i am trying to solve euler problem 125.

Re: STM - a request for war stories

2012-12-11 Thread Stuart Halloway
Is it possible to write a reducing function that mutates a list in Clojure? Sure. But I think it is absurdly unlikely that it would happen by accident. My 1% chance wasn't hedging against that case -- I was hedging against a bug in reduce itself. I don't really see even a 1% likelihood of either

Re: core.logic vs. Prolog

2012-12-11 Thread David Nolen
There's not a list of features so much as a list of improvements I would like to make. Some medium to big project ideas: - CLP(Set) - Improvements to tabling (currently a lot of redundant information is recorded) - Negation (based on CiaoProlog work) - Environment Trimming (to make the Definite

Re: when is a zipper better than get-in ?

2012-12-11 Thread Nando
Brian, Thanks! I bought and started reading your book. Seems excellent so far, and wanted to say that I particularly appreciate your stated willingness to help those of us with no experience in functional programming. Nando On Dec 11, 2012, at 20:14, Brian Marick mar...@exampler.com wrote:

Re: core.logic vs. Prolog

2012-12-11 Thread David Nolen
Oh and of course AND and OR parallelism. On Tue, Dec 11, 2012 at 5:44 PM, David Nolen dnolen.li...@gmail.com wrote: There's not a list of features so much as a list of improvements I would like to make. Some medium to big project ideas: - CLP(Set) - Improvements to tabling (currently a lot

Re: when is a zipper better than get-in ?

2012-12-11 Thread Brian Marick
On Dec 11, 2012, at 4:45 PM, Nando d.na...@gmail.com wrote: Thanks! I bought and started reading your book. Seems excellent so far, and wanted to say that I particularly appreciate your stated willingness to help those of us with no experience in functional programming. I'm pleased to

Re: Meaning of =

2012-12-11 Thread Phil Hagelberg
On Tue, Dec 11, 2012 at 5:17 AM, Jim foo.bar jimpil1...@gmail.com wrote: I disagree... One of the nice things about clojrue is that, at tis hear, lies the 'equiv' operator which is basically the 'egal' fn as defined by Baker [1993] [Equal rights for functional objects or the mroe things change

Re: Meaning of =

2012-12-11 Thread Raoul Duke
one of the things which seem to be true but nowhere completely successfully fleshed out is the fact that equality is very subjective. there can and should be many different ways to pose and answer the question a == b. -- You received this message because you are subscribed to the Google Groups

Re: Slime and heroku setup question

2012-12-11 Thread Phil Hagelberg
On Tue, Dec 11, 2012 at 11:07 AM, Jonathon McKitrick jmckitr...@gmail.com wrote: I sort of got clojure interactively running and working with slime. I'd like to interactively run and test in emacs, then push to heroku. Any tutorials or pointers on how to do this? For what it's worth direct

Re: Meaning of =

2012-12-11 Thread Phil Hagelberg
On Tue, Dec 11, 2012 at 3:32 PM, Raoul Duke rao...@gmail.com wrote: one of the things which seem to be true but nowhere completely successfully fleshed out is the fact that equality is very subjective. there can and should be many different ways to pose and answer the question a == b. There

Re: Meaning of =

2012-12-11 Thread László Török
Hi, Equality is never subjective. There maybe different equality relations defined. In most cases (integer) one os well served by intuition. In other cases (clojure's =) the definition may not be intuitive, but never subjective. On Dec 12, 2012 12:32 AM, Raoul Duke rao...@gmail.com wrote: one

Re: Meaning of =

2012-12-11 Thread László Török
Great paper btw! On Dec 12, 2012 12:42 AM, Phil Hagelberg p...@hagelb.org wrote: On Tue, Dec 11, 2012 at 3:32 PM, Raoul Duke rao...@gmail.com wrote: one of the things which seem to be true but nowhere completely successfully fleshed out is the fact that equality is very subjective. there

Re: Meaning of =

2012-12-11 Thread Raoul Duke
Equality is never subjective. There maybe different equality relations defined. In most cases (integer) one os well served by intuition. In other cases (clojure's =) the definition may not be intuitive, but never subjective. ok sheesh then ^subjective^context dependent -- You received this

Re: Meaning of =

2012-12-11 Thread Brian Marick
On Dec 11, 2012, at 5:42 PM, Phil Hagelberg p...@hagelb.org wrote: Henry Baker's Equal Rights for Functional Objects paper: http://home.pipeline.com/~hbaker1/ObjectIdentity.html Henry Baker was/is a brilliantly just-outside-of-the-box thinker. Many of the papers at

Re: abysmal multicore performance, especially on AMD processors

2012-12-11 Thread Lee Spector
On Dec 11, 2012, at 1:06 PM, Marshall Bockrath-Vandegrift wrote: So I think if you replace your calls to `reverse` and any `conj` loops you have in your own code, you should see a perfectly reasonable speedup. Tantalizing, but on investigation I see that our real application actually does

Re: Slime and heroku setup question

2012-12-11 Thread Jonathon McKitrick
Well, I've used slime with SBCL for quite a while, but this is my first foray into clojure and heroku. Are you basically saying the best approach is just to edit locally, push to heroku, and run? There's really no way to have a similar environment set up locally that runs as well? I haven't

Re: core.logic vs. Prolog

2012-12-11 Thread JvJ
Thanks. I can't think of a feature at the moment. I'm just trying to decide between the two. I'm working on a rule engine/DSL for game AI and I'm trying to make a decision... but I still haven't worked out all the requirements. On Tuesday, 11 December 2012 17:45:40 UTC-5, David Nolen wrote:

Re: Slime and heroku setup question

2012-12-11 Thread Phil Hagelberg
On Tue, Dec 11, 2012 at 6:55 PM, Jonathon McKitrick jmckitr...@gmail.com wrote: Well, I've used slime with SBCL for quite a while, but this is my first foray into clojure and heroku. Are you basically saying the best approach is just to edit locally, push to heroku, and run? I suppose if you

Re: STM - a request for war stories

2012-12-11 Thread Marko Topolnik
Yes, upon second thought I saw exactly what you mean. I think you make an important point: when talking about the STM we need to look at the wider picture. Where a mutable-by-default language needs the STM, Clojure gets by with just atoms because a single swap! call can do any number of