leiningen and updating project versions
Has anyone looked at how to manage snapshots and dependencies in projects with checkouts - where the checkouts (also snapshots) are being edited along with the main project? As I look at my layers of projects, they looks like a lot of rather tedious manual work for each project to: bump the project version; check dependency versions are correct; commit; install; bump project version to the next snapshot; commit; check dependency versions are correct snapshots; ...etc. I am curious as to whether anyone has an effective way of dealing with this? Dave -- 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 unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Decomplecting if
Nice :) On Sunday, December 9, 2012 1:17:48 AM UTC+1, Michał Marczyk wrote: Better yet, (defmacro iff [test {:keys [then else]}] `(if ~test ~then ~else)) (that's doing the lookup for then and else in the map constructing from the macro's rest argument at compilation time rather than in an evaluated map including both at run time). Cheers, Michał On 9 December 2012 00:40, Ben Wolfson wol...@gmail.com javascript: wrote: You may want to use some delays to prevent evaluation of untaken branches: user= (iff true :else (println 1) :then (println 3)) 3 1 nil user= On Sat, Dec 8, 2012 at 3:02 PM, Thomas Goossens con...@thomasgoossens.be javascript: wrote: One of the issues i had and still have with the if function is that because it has ordered arguments, makes things more complex. For small functions this is no so much of a problem. (if test 1 0) But when things get larger, that extra complexity of order without explicit information can get significant, I believe So I wanted (this would be officially my first macro ever!) something that behaved as follows: (if test :then true :else false) (if test :else false :then true) Which is what I eventually did: (defmacro iff [test body] (let [args (apply hash-map body)] `(if ~test (:then ~args) (:else ~args Any thoughts, improvements on my macro? (Also I'm not quite sure how to document my macro. So any advice on that is appreciated :) -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clo...@googlegroups.comjavascript: Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+u...@googlegroups.com javascript: For more options, visit this group at http://groups.google.com/group/clojure?hl=en -- Ben Wolfson Human kind has used its intelligence to vary the flavour of drinks, which may be sweet, aromatic, fermented or spirit-based. ... Family and social life also offer numerous other occasions to consume drinks for pleasure. [Larousse, Drink entry] -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clo...@googlegroups.comjavascript: Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+u...@googlegroups.com javascript: For more options, visit this group at http://groups.google.com/group/clojure?hl=en -- 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 unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Decomplecting if
(defmacro iff [test {:keys [then else]}] You probably want a different name for this, 'iff' already has a well understood meaning as 'if and only if' See http://en.m.wikipedia.org/wiki/If_and_only_if -- 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 unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Decomplecting if
You could add check for other keys than :then and :else being used. For documentation, I'd add a docstring Macro, similar to if but with branches labeled by keywords :then, :else. + the usage examples you posted. Also, have you looked at cond and if-not? Using cond to me feels like labeling the branches, if-not allows to switch the args when compared to if. -- 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 unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: core.logic vs datomic
You have a misunderstanding. core.logic and datomic datalog are not the same thing. core.logic is a turing complet logic engine, datomic datalog is only a querying subpart of this. You can not solve the zebra problem with datomic datalog, its impossible. Think of datomic datalog as if it would be something like SQL, while core.logic is something like the prolog programming language. Am Sonntag, 9. Dezember 2012 07:42:16 UTC+1 schrieb Brent Millare: I understand both core.logic and datomic offer a query system. While there are clear interface differences, and the systems are continuing to evolve so the answer will change over time, however, I don't have a good first order approximation understanding of the capabilities or performance differences between the two. Can anyone give a good explanation? As an example, how is the approach to solving the zebra problem different with each system? What's the difference between functional constraints in datomic and constraint programming in core.logic? -- 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 unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Clojure contrib datalog
Hi, I saw clojure-contrib datalog has not made it into modular contribs: https://github.com/clojure/clojure-contrib/tree/master/modules/datalog http://dev.clojure.org/display/design/Where+Did+Clojure.Contrib+Go http://dev.clojure.org/display/doc/Clojure+Contrib+Libraries Does anybody know if it's being maintained somewhere? Datomic supports datalog, so I wrongly presumed otherwise earlier. Shantanu -- 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 unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Decomplecting if
Cool thanks! On Sunday, December 9, 2012 11:52:32 AM UTC+1, Alex Baranosky wrote: The version I just posted also has the benefit that it does not cause multiple evaluations of its branches. On Sun, Dec 9, 2012 at 2:39 AM, Herwig Hochleitner hhochl...@gmail.comjavascript: wrote: 2012/12/9 Ben Wolfson wol...@gmail.com javascript: You may want to use some delays to prevent evaluation of untaken branches: Right, the macro evaluates its branches before deciding. You could fix that: (defmacro iff [test body] (let [args (apply hash-map body)] `(if ~test ~(:then args) ~(:else args Notice the unquotes ~ are outside of selecting the branches. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clo...@googlegroups.comjavascript: Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+u...@googlegroups.com javascript: For more options, visit this group at http://groups.google.com/group/clojure?hl=en -- 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 unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: abysmal multicore performance, especially on AMD processors
Hi Lee, Would it be difficult to try the following version of 'pmap'? It doesn't use futures but executors instead so at least this could help narrow the problem down... If the problem is due to the high number of futures spawned by pmap then this should fix it... (defn- with-thread-pool* [num-threads f] (let [pool (java.util.concurrent.Executors/newFixedThreadPool num-threads)] (try (f pool) (finally (when pool (.shutdown pool)) (defmacro with-thread-pool [[name num-threads] body] `(with-thread-pool* ~num-threads (fn [~name] ~@body))) (defn pmapp [f coll] (with-thread-pool [pool (.. Runtime getRuntime availableProcessors)] (doall (map #(.get %) (.invokeAll pool (map (partial partial f) coll)) And btw, reducers are great but usually you need to reformulate your problem..r/map is not parallel. It is serial but with no intermediate allocation (unlike lazy-seqs). If you want to make it parallel you need to r/fold the result of r/map (the reducer) providing reducing combining fns. However, is still doesn't make sense to be slower than map...If you 've followed Rich's example with the pie-maker consider this: Both map r/map will return immediately. The difference is that map will build a recipe for the first item whereas r/map will build a recipe for the entire coll. In other words, the lazy-pie-maker assistant provides 1 apple at a time (after asking for an apple) but the reducer-pie-maker-assistant, as soon as you ask for the 1st apple it will do the entire bag (without intermediate 'asking'). The lazy recipe is recursive whereas the reducer-based one looks like a stream...It should be still faster, albeit not terribly faster. You need r/fold to see any parallelism... Jim On 09/12/12 05:19, Lee Spector wrote: On Dec 8, 2012, at 8:16 PM, Marek Šrank wrote: Yep, reducers, don't use lazy seqs. But they return just sth. like transformed functions, that will be applied when building the collection. So you can use them like this: (into [] (r/map burn (doall (range 4) See http://clojure.com/blog/2012/05/08/reducers-a-library-and-model-for-collection-processing.html and http://clojure.com/blog/2012/05/15/anatomy-of-reducer.html for more info... Thanks Marek. This does fix the too quick to be true issue, but alas, on my mac laptop (a 4 core intel i7): 57522.869 msecs for (time (into [] (r/map burn (doall (range 4) 58263.312 msecs for (time (doall (map burn (doall (range 4) So while I'm not getting a terrible slowdown from using the reducers version of map, I'm also not getting any speedup over the single-thread map. We should try this on our other architectures too, but it doesn't look promising. -Lee -- Lee Spector, Professor of Computer Science Cognitive Science, Hampshire College 893 West Street, Amherst, MA 01002-3359 lspec...@hampshire.edu, http://hampshire.edu/lspector/ Phone: 413-559-5352, Fax: 413-559-5438 -- 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 unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Exception when loading clojure.core.reducers
Using 1.5.0-beta1, attempting to load the reducers namespace, `(require '[clojure.core.reducers :as r])`, is generating this exception: CompilerException java.lang.ClassNotFoundException: jsr166y.ForkJoinPool, compiling:(clojure/core/reducers.clj:56:21) TERMINAL java -version java version 1.6.0_37 Java(TM) SE Runtime Environment (build 1.6.0_37-b06-434-11M3909) Java HotSpot(TM) 64-Bit Server VM (build 20.12-b01-434, mixed mode) Any suggestions? Alex -- 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 unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: abysmal multicore performance, especially on AMD processors
cameron cdor...@gmail.com writes: Interesting problem, the slowdown seems to being caused by the reverse call (actually the calls to conj with a list argument). Excellent analysis, sir! I think this points things in the right direction. fast-reverse : map-ms: 3.3, pmap-ms 0.7, speedup 4.97 list-cons : map-ms: 4.0, pmap-ms 0.7, speedup 6.13 The difference between these two I believe is just jitter. Once `cons` is called on either a list or a vector, the result is a `clojure.lang.Cons` object. vec-conj : map-ms: 4.0, pmap-ms 1.3, speedup 3.10 For the sub-goal of optimizing `reverse`, I get better times even than for the `cons`-based implementation by using transient vectors: list-cons : map-ms: 4.0, pmap-ms 0.6, speedup 6.42 tvec-conj : map-ms: 0.9, pmap-ms 0.2, speedup 4.10 (defn tvec-conj [coll] (persistent! (reduce conj! (transient []) coll))) list-conj : map-ms: 10.8, pmap-ms 21.2, speedup 0.51 clojure-reverse : map-ms: 13.5, pmap-ms 26.8, speedup 0.50 (this is equivalent to the original code) I add the following: cons-conj : map-ms: 3.3, pmap-ms 16.8, speedup 0.19 (defn cons-conj [coll] (reduce conj (clojure.lang.Cons. (first coll) nil) (rest coll))) I think this is the key, but I don’t understand it. The `cons` function just immediately creates a new `Cons` object. The `conj` function calls the `.cons` method of the collection, and the `.cons` implementation `Cons` inherits from `ASeq` just creates a new `Cons` object! It’s like there’s a lock of some sort sneaking in on the `conj` path. Any thoughts on what that could be? -Marshall -- 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 unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Exception when loading clojure.core.reducers
Use java 7 with clojure 1.5.0-beta1 or use java6 with the jsr166.jar already in your classpath...Alternatively, if you use some clojure version older than 1.5.0-beta1 with Java 7 you may need to build clojure on your system... Hope that helps... Jim On 09/12/12 12:44, Alex Baranosky wrote: Using 1.5.0-beta1, attempting to load the reducers namespace, `(require '[clojure.core.reducers :as r])`, is generating this exception: CompilerException java.lang.ClassNotFoundException: jsr166y.ForkJoinPool, compiling:(clojure/core/reducers.clj:56:21) TERMINAL java -version java version 1.6.0_37 Java(TM) SE Runtime Environment (build 1.6.0_37-b06-434-11M3909) Java HotSpot(TM) 64-Bit Server VM (build 20.12-b01-434, mixed mode) Any suggestions? Alex -- 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 unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -- 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 unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Exception when loading clojure.core.reducers
Thanks Jim, that worked like a charm. For anyone lurking this is what I used in my project.clj: [org.codehaus.jsr166-mirror/jsr166y 1.7.0] On Sun, Dec 9, 2012 at 4:55 AM, Jim - FooBar(); jimpil1...@gmail.comwrote: jsr166 -- 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 unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Starting to use Clojure, Yeah!
Yeah! -- 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 unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Multiple java class import
Hi, Is it possible to import multiple java classes using import? e.g (import '(java.naming.*)) Or will I have to import each class separately? Thanks, Yinka. -- 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 unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: abysmal multicore performance, especially on AMD processors
If the number of object allocation mentioned earlier in this thread are real, yes vm heap management can be a bottleneck. There has to be some locking done somewhere otherwise the heap would corrupt :) The other bottleneck can come from garbage collection which has to freeze object allocation completely or partially. This internal process has to reclaim unreferenced objects otherwise you may end up exhausting the heap. That can even susoend your app while gc is running depending on the strategy used. In java 6, the vm is suppose to adjust the gc strategy by looking at your app behavior. That may take some time to profile however. If your app has this heavy memory requirement abruptely, the vm may not have enough data to adapt. Have a look here, you will find how to set explicitly the gc behavior: http://www.oracle.com/technetwork/java/javase/gc-tuning-6-140523.html This is specific to java 6, java 5 is a different beast as java 7. Maybe this can help, I emphasize, *can help* not having looked deeply into your problem. Luc P. On Dec 8, 2012, at 10:19 PM, meteorfox wrote: Now if you run vmstat 1 while running your benchmark you'll notice that the run queue will be most of the time at 8, meaning that 8 processes are waiting for CPU, and this is due to memory accesses (in this case, since this is not true for all applications). So, I feel your benchmark may be artificial and does not truly represent your real application, make sure to profile your real application, and optimize according to the bottlenecks. There are really useful tools out there for profiling, such as VisualVM, perf. Thanks Carlos. I don't actually think that the benchmark is particularly artificial. It's very difficult to profile my actual application because it uses random numbers all over the place and is highly and nonlinearly variable in lots of ways. But I think that the benchmark I'm running really is pretty representative. In any event, WHY would all of that waiting be happening? Logically, nothing should have to be waiting for anything else. We know from the fact that we get good speedups from multiple simultaneous JVM runs, each just running one call to my burn function, that the hardware is capable of performing well with multiple instances of this benchmark running concurrently. It MUST be able to handle all of the memory allocation and everything else. It's just when we try to launch them all in parallel from the same Clojure process, using pmap OR agents OR reducers, that we fail to get the concurrency speedups. Why should this be? And what can be done about it? I know nearly nothing about the internals of the JVM, but is there perhaps a bottleneck on memory allocation because there's a single serial allocator? Perhaps when we run multiple JVMs each has its own allocator so we don't have the bottleneck? If all of this makes sense and is true, then perhaps (wishful thinking) there's a JVM option like use parallel memory allocators that will fix it?! Thanks, -Lee -- 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 unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -- Softaddictslprefonta...@softaddicts.ca sent by ibisMail from my ipad! -- 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 unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Multiple java class import
Unfortunately you have to import each class separately...no wild-cards in ns declarations :-( Jim On 09/12/12 14:21, Yinka Erinle wrote: Hi, Is it possible to import multiple java classes using import? e.g (import '(java.naming.*)) Or will I have to import each class separately? Thanks, Yinka. -- 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 unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -- 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 unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
parenface support in clojure (parenface-plus)
Here[1] is an enhancement to parenface[2] that adds support for the editor and REPL for Clojure, Jess, and Elisp. 1 http://marmalade-repo.org/packages/parenface-plus 2 http://marmalade-repo.org/packages/parenface -- 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 unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Multiple java class import
Thanks Jim. I wonder why. On Sunday, December 9, 2012 2:43:54 PM UTC, Jim foo.bar wrote: Unfortunately you have to import each class separately...no wild-cards in ns declarations :-( Jim On 09/12/12 14:21, Yinka Erinle wrote: Hi, Is it possible to import multiple java classes using import? e.g (import '(java.naming.*)) Or will I have to import each class separately? Thanks, Yinka. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clo...@googlegroups.comjavascript: Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+u...@googlegroups.com javascript: For more options, visit this group at http://groups.google.com/group/clojure?hl=en -- 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 unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Multiple java class import
Rich explains why here: https://groups.google.com/forum/?fromgroups=#!msg/clojure/-gCg_0wmT5o/H7WobsV-yt0J Jim On 09/12/12 15:06, Yinka Erinle wrote: Thanks Jim. I wonder why. On Sunday, December 9, 2012 2:43:54 PM UTC, Jim foo.bar wrote: Unfortunately you have to import each class separately...no wild-cards in ns declarations :-( Jim On 09/12/12 14:21, Yinka Erinle wrote: Hi, Is it possible to import multiple java classes using import? e.g (import '(java.naming.*)) Or will I have to import each class separately? Thanks, Yinka. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clo...@googlegroups.com javascript: Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+u...@googlegroups.com javascript: For more options, visit this group at http://groups.google.com/group/clojure?hl=en http://groups.google.com/group/clojure?hl=en -- 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 unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -- 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 unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: core.logic vs datomic
Can you elaborate on the zebra puzzle? What particular aspect is required? What would need to be implemented to get it to work on datomic? On Sunday, December 9, 2012 5:48:55 AM UTC-5, Nick Zbinden wrote: You have a misunderstanding. core.logic and datomic datalog are not the same thing. core.logic is a turing complet logic engine, datomic datalog is only a querying subpart of this. You can not solve the zebra problem with datomic datalog, its impossible. Think of datomic datalog as if it would be something like SQL, while core.logic is something like the prolog programming language. Am Sonntag, 9. Dezember 2012 07:42:16 UTC+1 schrieb Brent Millare: I understand both core.logic and datomic offer a query system. While there are clear interface differences, and the systems are continuing to evolve so the answer will change over time, however, I don't have a good first order approximation understanding of the capabilities or performance differences between the two. Can anyone give a good explanation? As an example, how is the approach to solving the zebra problem different with each system? What's the difference between functional constraints in datomic and constraint programming in core.logic? -- 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 unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Help with zetta-parser please
Hi Can someone give example of parsing using zetta-parser for the case that the input stream is intermittent (i.e. possibly incomplete at a particular moment). The author of zetta-parser refers to this very possibility in his readme (for example parsing messages arriving at a socket or such). My particular application is interacting with several command line programs in MS Windows. So I need to parse the characters coming from the program's output streams (stdout and stderr). The interaction really is interactive, so for example, when I start the CL program, I might get a lot of lines of output followed by a prompt TypeNow kind of thing. So I want the parser to skip the lines and return when it sees the prompt. Now I might send a character or string to the CL program's stdin and then get more (differently structured) output to parse. And so on. I cannot change these CL programs because they are provided by third parties; they were written with a view to interacting with a human, not a program. It seems to me that this kind of parser is perfect for this job - but I'm a newbie at monads etc so I don't know how to express it in zetta-parser syntax. (I'm also not familiar with Haskell). BTW The Win32 treatment of the streams associated with a command line program is completely broken, in the sense that the stdout stream is *buffered*, so as it stands it is not possible to interact like this with a console program. You don't get to see the buffered output until either the buffer fills up, or the program terminates. Either way, it's not interaction. This of course also carries over the Java version using java.lang.RunTime.exec. If one tries to run an interactive program by this means, it just hangs up. In order to achieve interactivity I have had to create a truly horrible CL program runner written in C (which I start and interact with via a JNI interface) that infers the output from stdout and stderr by continually examining the console output buffer (i.e. the screen). Best regards, Tim -- 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 unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Specific reduce function version
Hi, folks. I'm wondering if Clojure library has 'reduce' function version which is like (reduce f coll) - i.e. it applies function to coll elements without the initial value but at the same time allows to use external accumulator which is passed to f as well. Better look at the code: (defn reduce-with-acc Applies f to first two coll elements and acc producing new acc value for subsequent f calls. Returns acc. On singleton or empty collection returns acc immediately. [f acc coll] (loop [a (first coll) acc acc s (next coll)] (if (seq s) (let [b (first s)] (recur b (f a b acc) (next s))) acc))) Regards, Alexander. -- 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 unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Decomplecting if
How about cond? (cond test true :else false) BTW I personally don't consider if complected. If reverse order is more appropriate, I use if-not. On Sunday, December 9, 2012 12:02:54 AM UTC+1, Thomas Goossens wrote: One of the issues i had and still have with the if function is that because it has ordered arguments, makes things more complex. For small functions this is no so much of a problem. (if test 1 0) But when things get larger, that extra complexity of order without explicit information can get significant, I believe So I wanted (this would be officially my first macro ever!) something that behaved as follows: (if test :then true :else false) (if test :else false :then true) Which is what I eventually did: (defmacro iff [test body] (let [args (apply hash-map body)] `(if ~test (:then ~args) (:else ~args Any thoughts, improvements on my macro? (Also I'm not quite sure how to document my macro. So any advice on that is appreciated :) -- 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 unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Specific reduce function version
Essentially, you are using two accumulators: acc and (first coll). You can probably use reduce for this purpose by (reduce f [acc (first coll)] (rest coll)) adjusting the starting accumulator accordingly and altering f to be (fn [[acc coll-acc] item] ...) Frankly, it would probably be more readable to just use loop. That's what I do if I have more than one accumulator. On Sun, Dec 9, 2012 at 7:39 AM, Alexander Semenov bohtva...@gmail.comwrote: Hi, folks. I'm wondering if Clojure library has 'reduce' function version which is like (reduce f coll) - i.e. it applies function to coll elements without the initial value but at the same time allows to use external accumulator which is passed to f as well. Better look at the code: (defn reduce-with-acc Applies f to first two coll elements and acc producing new acc value for subsequent f calls. Returns acc. On singleton or empty collection returns acc immediately. [f acc coll] (loop [a (first coll) acc acc s (next coll)] (if (seq s) (let [b (first s)] (recur b (f a b acc) (next s))) acc))) Regards, Alexander. -- 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 unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -- 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 unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Decomplecting if
Yeah, cond will probably do the trick as well. I do consider if complex (and yeah my argument is true for a lot of functions) What i'm talking about is some accidental complexity of the language. That I must constantly be aware of what parameter of the function I'm looking at. My point is not so much the order (but I did it anyway to take even more complexity) of then, else but the fact that when looking at longer pieces of code I cannot immediately see whether i'm looking at the then branch er else branch. Mostly i must rely on intendations, which makes everything more complex. So, I saw the ideal opportunity to write my first macro. In my opinion it makes it simpler. But then again, cond seems to accomplish my goal already :-) On Sun, Dec 9, 2012 at 5:14 PM, Jozef Wagner jozef.wag...@gmail.com wrote: How about cond? (cond test true :else false) BTW I personally don't consider if complected. If reverse order is more appropriate, I use if-not. On Sunday, December 9, 2012 12:02:54 AM UTC+1, Thomas Goossens wrote: One of the issues i had and still have with the if function is that because it has ordered arguments, makes things more complex. For small functions this is no so much of a problem. (if test 1 0) But when things get larger, that extra complexity of order without explicit information can get significant, I believe So I wanted (this would be officially my first macro ever!) something that behaved as follows: (if test :then true :else false) (if test :else false :then true) Which is what I eventually did: (defmacro iff [test body] (let [args (apply hash-map body)] `(if ~test (:then ~args) (:else ~args Any thoughts, improvements on my macro? (Also I'm not quite sure how to document my macro. So any advice on that is appreciated :) -- 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 unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -- Thomas Goossens -- 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 unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
gen-class: class loading problem
Hi, I'm trying embed clojure into a proprietary system. That system can be configured to create instances of specified Java classes and calling specified methods. So I want to use gen-class to create these proxies. The only problem is that both clojure and my proprietary system handle class loading differently, so I need to set clojure class loader to that provided by the system before trying to load any application namespaces. It would be nice to add an option to gen-class, say :use-system-loader, so the class created with the following declaration (gen-class :name a.b.C :use-system-loader true) has code generated in the very beginning of clinit method: clojure.lang.Compiler.LOADER.bindRoot(a.b.C.getClassLoader()); to implement this feature, the following changes have be done th the genclass.clj: 1. The option name shall be listed among other options 2. The following block shall be added at beginning of the section for clinit method: (when use-system-loader (doto gen (.getStatic (Type/getType clojure.lang.Compiler) LOADER var-type) (.push ctype) (.invokeVirtual class-type (Method/getMethod ClassLoader getClassLoader())) (.invokeVirtual var-type (Method/getMethod void bindRoot(Object))) )) Regards, Vladimir -- 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 unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: abysmal multicore performance, especially on AMD processors
On Dec 8, 2012, at 9:37 PM, Lee Spector wrote: On Dec 8, 2012, at 10:19 PM, meteorfox wrote: Now if you run vmstat 1 while running your benchmark you'll notice that the run queue will be most of the time at 8, meaning that 8 processes are waiting for CPU, and this is due to memory accesses (in this case, since this is not true for all applications). So, I feel your benchmark may be artificial and does not truly represent your real application, make sure to profile your real application, and optimize according to the bottlenecks. There are really useful tools out there for profiling, such as VisualVM, perf. Thanks Carlos. I don't actually think that the benchmark is particularly artificial. It's very difficult to profile my actual application because it uses random numbers all over the place and is highly and nonlinearly variable in lots of ways. But I think that the benchmark I'm running really is pretty representative. In any event, WHY would all of that waiting be happening? Logically, nothing should have to be waiting for anything else. We know from the fact that we get good speedups from multiple simultaneous JVM runs, each just running one call to my burn function, that the hardware is capable of performing well with multiple instances of this benchmark running concurrently. It MUST be able to handle all of the memory allocation and everything else. It's just when we try to launch them all in parallel from the same Clojure process, using pmap OR agents OR reducers, that we fail to get the concurrency speedups. Why should this be? And what can be done about it? I know nearly nothing about the internals of the JVM, but is there perhaps a bottleneck on memory allocation because there's a single serial allocator? Perhaps when we run multiple JVMs each has its own allocator so we don't have the bottleneck? If all of this makes sense and is true, then perhaps (wishful thinking) there's a JVM option like use parallel memory allocators that will fix it?! Lee: I don't know yet know how to get good speedups with this workload in the Oracle JVM, although it might be possible with options I'm unaware of. Azul's Zing JVM has a different memory allocator and GC implementation that might be better tuned for parallel workloads. I haven't used it myself yet -- this is just from hearing about it in the past and a brief scan of their web site. They have free trials available. Maybe you could try that to see if it gives you better results out of the box, or with minor tweaking of parameters? I don't know the cost, but like many companies they might have significant discounts for educational customers. Andy -- 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 unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Multiple java class import
Thanks On Sunday, December 9, 2012 3:11:02 PM UTC, Jim foo.bar wrote: Rich explains why here: https://groups.google.com/forum/?fromgroups=#!msg/clojure/-gCg_0wmT5o/H7WobsV-yt0J Jim On 09/12/12 15:06, Yinka Erinle wrote: Thanks Jim. I wonder why. On Sunday, December 9, 2012 2:43:54 PM UTC, Jim foo.bar wrote: Unfortunately you have to import each class separately...no wild-cards in ns declarations :-( Jim On 09/12/12 14:21, Yinka Erinle wrote: Hi, Is it possible to import multiple java classes using import? e.g (import '(java.naming.*)) Or will I have to import each class separately? Thanks, Yinka. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clo...@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+u...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clo...@googlegroups.com javascript: Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+u...@googlegroups.com javascript: For more options, visit this group at http://groups.google.com/group/clojure?hl=en -- 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 unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: abysmal multicore performance, especially on AMD processors
On Dec 9, 2012, at 4:48 AM, Marshall Bockrath-Vandegrift wrote: It’s like there’s a lock of some sort sneaking in on the `conj` path. Any thoughts on what that could be? My current best guess is the JVM's memory allocator, not Clojure code. Andy -- 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 unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Specific reduce function version
Okay thanks, I just wanted to make sure that I'm not re-inventing something already ready. On Sunday, December 9, 2012 8:07:24 PM UTC+3, puzzler wrote: Essentially, you are using two accumulators: acc and (first coll). You can probably use reduce for this purpose by (reduce f [acc (first coll)] (rest coll)) adjusting the starting accumulator accordingly and altering f to be (fn [[acc coll-acc] item] ...) Frankly, it would probably be more readable to just use loop. That's what I do if I have more than one accumulator. On Sun, Dec 9, 2012 at 7:39 AM, Alexander Semenov boht...@gmail.comjavascript: wrote: Hi, folks. I'm wondering if Clojure library has 'reduce' function version which is like (reduce f coll) - i.e. it applies function to coll elements without the initial value but at the same time allows to use external accumulator which is passed to f as well. Better look at the code: (defn reduce-with-acc Applies f to first two coll elements and acc producing new acc value for subsequent f calls. Returns acc. On singleton or empty collection returns acc immediately. [f acc coll] (loop [a (first coll) acc acc s (next coll)] (if (seq s) (let [b (first s)] (recur b (f a b acc) (next s))) acc))) Regards, Alexander. -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to clo...@googlegroups.comjavascript: Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+u...@googlegroups.com javascript: For more options, visit this group at http://groups.google.com/group/clojure?hl=en -- 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 unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: abysmal multicore performance, especially on AMD processors
Andy Fingerhut andy.finger...@gmail.com writes: My current best guess is the JVM's memory allocator, not Clojure code. I didn’t mean to imply the problem was in Clojure itself, but I don’t believe the issue is in the memory allocator either. I now believe the problem is in a class of JIT optimization HotSpot is performing which turns into a “pessimization” in the parallel case. I have the following code, taking the structure from Cameron’s benchmarks, but replacing the exact functions being tested: https://gist.github.com/4246320 Note that `conj*` is simply a copy-paste of the `conj` implementation from clojure/core.clj. The benchmark runs reducing that `conj*` function once on `Cons`s, then on `PersistantList`s, then again on `Cons`s. And here are the results: cons-conj* : map-ms: 5.6, pmap-ms 1.1, speedup 5.08 list-conj* : map-ms: 10.1, pmap-ms 15.9, speedup 0.63 cons-conj* : map-ms: 10.0, pmap-ms 15.6, speedup 0.64 The function performs fine on `Cons` objects, but once applied to `PersistantList` objects, `conj*` somehow becomes “tainted” and acquires the inverse speedup factor. When I run with -XX:+PrintCompilation I don’t see anything particularly suspicious, but I’m not well-versed in the art of interpreting HotSpot’s entrails. My idea for next steps is to create a copy of the PersistantList class and selectively modify it in an attempt to identify what aspect of it causes the JVM to produce this behavior. -Marshall -- 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 unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: ANN: clj-schema, Schemas For Clojure Maps
Hello, this is exactly the kind of library I was probably going to rewrite for myself rather sooner than later, cool ! One question, though : if I understant it correctly, the default behaviour once you start defining a schema is for it to be strict rather than loose, meaning that any extra key found in a map will be default generate an error. I find that a little bit unfortunate. What is a rationale behind being strict by default ? 2012/12/5 Alex Baranosky alexander.barano...@gmail.com: Added a step-wise 'Getting Started' tutorial. Plan to add more in-depth documentation soon: https://github.com/runa-dev/clj-schema/wiki/Getting-Started On Tue, Nov 27, 2012 at 7:18 PM, Alex Baranosky alexander.barano...@gmail.com wrote: Hi Stathis, Thanks for your interestin clj-schema. If you use it and have any feedback please let me know. clj-schema is released under the MIT license: http://mit-license.org/ I think TypedClojure is really cool. I'm excited about both approaches because in general I'm very interested in approaches to coding that help us ensure that our code works correctly. That said there are some interesting differences in the approaches: schemas can be used for other things other than validation or type checking. schemas are more decoupled from the code. Say you are reading a map out of a file, or get a map returned from another library. With schemas you could easily validate the map. How would that be handled in a TypeClojure approach? Also, schema validation only checks at a snapshot in time; it makes no effort to ensure that that map is always correct. schema validation happens at run-time; TypedClojure is a static analysis tool. ( Of course, if there was some kind of adapter for TypedClojure it could take schemas as params to the type declarations.) Alex On Tue, Nov 27, 2012 at 2:23 AM, Stathis Sideris side...@gmail.com wrote: Hello Alex, This looks very useful, thanks. What's the license under which you are releasing this code? Also, I'm wondering whether something like that could be the next step for Typed Clojure. From Ambrose's thesis, I got the impression that he would like Typed Clojure to eventually cater for checking the contents of maps. Thanks, Stathis On Sunday, 25 November 2012 23:22:04 UTC, Alex Baranosky wrote: Clj-schema is a library for defining and validating schemas for maps, as well as for using those schemas to create valid test data. We've been using this in production for at least a few months now, at Runa. https://github.com/runa-dev/clj-schema The main benefits I've found from using this library are: * validating the inputs to the application: validating Ring request params and config files * validating before storing maps into the DB * using the clj-schema.fixtures library to create valid test data that stays valid. So as the standard form of a map changes over time the tests will stay in sync with those changes automatically. * there are some code-readability benefits as well - any developer can pretty quickly see what certain kinds of maps tend to look like. There's more info in the README: https://github.com/runa-dev/clj-schema/blob/master/README.md Future possibilities: * auto-generating test data from clj-schema fixtures * being able to create schemas for sets and sequences (currently a schema is always for a map) Contributors welcome. Alex -- 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 unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -- 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 unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -- 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 unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Specific reduce function version
You seem to have written (reduce (fn [acc [a b]] ...) (partition 2 1 coll)). On Sunday, December 9, 2012 7:39:21 AM UTC-8, Alexander Semenov wrote: Hi, folks. I'm wondering if Clojure library has 'reduce' function version which is like (reduce f coll) - i.e. it applies function to coll elements without the initial value but at the same time allows to use external accumulator which is passed to f as well. Better look at the code: (defn reduce-with-acc Applies f to first two coll elements and acc producing new acc value for subsequent f calls. Returns acc. On singleton or empty collection returns acc immediately. [f acc coll] (loop [a (first coll) acc acc s (next coll)] (if (seq s) (let [b (first s)] (recur b (f a b acc) (next s))) acc))) Regards, Alexander. -- 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 unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: ANN: clj-schema, Schemas For Clojure Maps
I think Typed Clojure and clj-schema could work very nicely together. I'll look at it again in a few months. Thanks, Ambrose On Wed, Nov 28, 2012 at 11:18 AM, Alex Baranosky alexander.barano...@gmail.com wrote: Hi Stathis, Thanks for your interestin clj-schema. If you use it and have any feedback please let me know. clj-schema is released under the MIT license: http://mit-license.org/ I think TypedClojure is really cool. I'm excited about both approaches because in general I'm very interested in approaches to coding that help us ensure that our code works correctly. That said there are some interesting differences in the approaches: - schemas can be used for other things other than validation or type checking. - schemas are more decoupled from the code. Say you are reading a map out of a file, or get a map returned from another library. With schemas you could easily validate the map. How would that be handled in a TypeClojure approach? Also, schema validation only checks at a snapshot in time; it makes no effort to ensure that that map is always correct. - schema validation happens at run-time; TypedClojure is a static analysis tool. ( Of course, if there was some kind of adapter for TypedClojure it could take schemas as params to the type declarations.) Alex On Tue, Nov 27, 2012 at 2:23 AM, Stathis Sideris side...@gmail.comwrote: Hello Alex, This looks very useful, thanks. What's the license under which you are releasing this code? Also, I'm wondering whether something like that could be the next step for Typed Clojure. From Ambrose's thesis, I got the impression that he would like Typed Clojure to eventually cater for checking the contents of maps. Thanks, Stathis On Sunday, 25 November 2012 23:22:04 UTC, Alex Baranosky wrote: Clj-schema is a library for defining and validating schemas for maps, as well as for using those schemas to create valid test data. We've been using this in production for at least a few months now, at Runa. https://github.com/runa-dev/**clj-schemahttps://github.com/runa-dev/clj-schema The main benefits I've found from using this library are: * validating the inputs to the application: validating Ring request params and config files * validating before storing maps into the DB * using the clj-schema.fixtures library to create valid test data that stays valid. So as the standard form of a map changes over time the tests will stay in sync with those changes automatically. * there are some code-readability benefits as well - any developer can pretty quickly see what certain kinds of maps tend to look like. There's more info in the README: https://github.com/runa-dev/**clj-schema/blob/master/README.**mdhttps://github.com/runa-dev/clj-schema/blob/master/README.md Future possibilities: * auto-generating test data from clj-schema fixtures * being able to create schemas for sets and sequences (currently a schema is always for a map) Contributors welcome. Alex -- 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 unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -- 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 unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -- 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 unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: abysmal multicore performance, especially on AMD processors
On Dec 9, 2012, at 6:25 AM, Softaddicts wrote: If the number of object allocation mentioned earlier in this thread are real, yes vm heap management can be a bottleneck. There has to be some locking done somewhere otherwise the heap would corrupt :) The other bottleneck can come from garbage collection which has to freeze object allocation completely or partially. This internal process has to reclaim unreferenced objects otherwise you may end up exhausting the heap. That can even susoend your app while gc is running depending on the strategy used. Agreed that memory allocation and garbage collection will in some cases need to coordinate between threads to work in the general case of arbitrary allocations and GCs. However, one could have a central list of large pages of free memory (e.g. a few MBytes, or maybe even larger), and pass these out to concurrent memory allocators in these large chunks, and let them do small object allocations and GC within each thread completely concurrently. The only times locking of any kind might be needed with such a strategy would be when one of the parallel threads requests a new big page from the central free list, or returned a completely empty free page back to the central list that it didn't need any more. All other memory allocation and GC could be completely concurrent. The idea of making those pages large is that such passing pages around would be infrequent, and thus could be made to have no measurable synchronization overhead. That is pretty much what is happening when you run Lee's benchmark programs as 1 thread per JVM, but 4 or 8 different JVMs processes running in parallel. In that situation the OS has the central free list of pages, and the JVMs manage their small object allocations and GCs completely concurrently without interfering with each other. If HotSpot's JVM could be configured to work like that, he would be seeing big speedups in a single JVM. Andy -- 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 unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Specific reduce function version
Not exactly: my initial acc value is usually something like #{} or [] but I've got the idea. On Sunday, December 9, 2012 9:29:25 PM UTC+3, Alan Malloy wrote: You seem to have written (reduce (fn [acc [a b]] ...) (partition 2 1 coll)). On Sunday, December 9, 2012 7:39:21 AM UTC-8, Alexander Semenov wrote: Hi, folks. I'm wondering if Clojure library has 'reduce' function version which is like (reduce f coll) - i.e. it applies function to coll elements without the initial value but at the same time allows to use external accumulator which is passed to f as well. Better look at the code: (defn reduce-with-acc Applies f to first two coll elements and acc producing new acc value for subsequent f calls. Returns acc. On singleton or empty collection returns acc immediately. [f acc coll] (loop [a (first coll) acc acc s (next coll)] (if (seq s) (let [b (first s)] (recur b (f a b acc) (next s))) acc))) Regards, Alexander. -- 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 unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: leiningen and updating project versions
When I'm working on a number of interdependent projects, I'm making symbolic links of the src directories of the dependent project inside my main project. In that way, I can easily make changes in the multiple projects without having to go thru the update version/jar/pom/install cycles for all associated projects, because the source changes are automatically picked-up when i remake the main project. Only after all works, you can remove the links and add the dependencies to project.clj... And test again ;-) Enjoy, Frank. On Dec 9, 2012, at 12:18 AM, Dave Sann daves...@gmail.com wrote: Has anyone looked at how to manage snapshots and dependencies in projects with checkouts - where the checkouts (also snapshots) are being edited along with the main project? As I look at my layers of projects, they looks like a lot of rather tedious manual work for each project to: bump the project version; check dependency versions are correct; commit; install; bump project version to the next snapshot; commit; check dependency versions are correct snapshots; ...etc. I am curious as to whether anyone has an effective way of dealing with this? Dave -- 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 unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -- 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 unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: core.logic vs datomic
First of all, stop saying 'on datomic'. Datomic as a Database, witch in its Peer library has a implmentation of Datalog. This implmentation of Datalog has basicly nothing to do with the rest of datomic, it can be used as a query language for data from all sources, it just comes with the Datomic Peer Library. There is no sence in me explaining this. Learn what logic programming (prolog, core.logic) is and how it works, and then you will understand it. Am Sonntag, 9. Dezember 2012 16:18:40 UTC+1 schrieb Brent Millare: Can you elaborate on the zebra puzzle? What particular aspect is required? What would need to be implemented to get it to work on datomic? On Sunday, December 9, 2012 5:48:55 AM UTC-5, Nick Zbinden wrote: You have a misunderstanding. core.logic and datomic datalog are not the same thing. core.logic is a turing complet logic engine, datomic datalog is only a querying subpart of this. You can not solve the zebra problem with datomic datalog, its impossible. Think of datomic datalog as if it would be something like SQL, while core.logic is something like the prolog programming language. Am Sonntag, 9. Dezember 2012 07:42:16 UTC+1 schrieb Brent Millare: I understand both core.logic and datomic offer a query system. While there are clear interface differences, and the systems are continuing to evolve so the answer will change over time, however, I don't have a good first order approximation understanding of the capabilities or performance differences between the two. Can anyone give a good explanation? As an example, how is the approach to solving the zebra problem different with each system? What's the difference between functional constraints in datomic and constraint programming in core.logic? -- 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 unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: ANN: clj-schema, Schemas For Clojure Maps
Hi Laurent, It was originally written as loose-only, because that is an easier problem to solve, but since these schemas are being used at work to make sure no bad data gets stored in HBase we decided collectively that strictness was more of what we wanted. I'm open to exploring ways to make the default behavior of defschema be loose, perhaps via a binding. I could then create a third macro `def-strict-schema`... Let me know if you have any thoughts on approaches for this kind of modification. In general I'm open to ideas that help the library be more useful to people for their projects, so please feel free to shoot ideas by me. Alex On Sun, Dec 9, 2012 at 10:30 AM, Ambrose Bonnaire-Sergeant abonnaireserge...@gmail.com wrote: I think Typed Clojure and clj-schema could work very nicely together. I'll look at it again in a few months. Thanks, Ambrose On Wed, Nov 28, 2012 at 11:18 AM, Alex Baranosky alexander.barano...@gmail.com wrote: Hi Stathis, Thanks for your interestin clj-schema. If you use it and have any feedback please let me know. clj-schema is released under the MIT license: http://mit-license.org/ I think TypedClojure is really cool. I'm excited about both approaches because in general I'm very interested in approaches to coding that help us ensure that our code works correctly. That said there are some interesting differences in the approaches: - schemas can be used for other things other than validation or type checking. - schemas are more decoupled from the code. Say you are reading a map out of a file, or get a map returned from another library. With schemas you could easily validate the map. How would that be handled in a TypeClojure approach? Also, schema validation only checks at a snapshot in time; it makes no effort to ensure that that map is always correct. - schema validation happens at run-time; TypedClojure is a static analysis tool. ( Of course, if there was some kind of adapter for TypedClojure it could take schemas as params to the type declarations.) Alex On Tue, Nov 27, 2012 at 2:23 AM, Stathis Sideris side...@gmail.comwrote: Hello Alex, This looks very useful, thanks. What's the license under which you are releasing this code? Also, I'm wondering whether something like that could be the next step for Typed Clojure. From Ambrose's thesis, I got the impression that he would like Typed Clojure to eventually cater for checking the contents of maps. Thanks, Stathis On Sunday, 25 November 2012 23:22:04 UTC, Alex Baranosky wrote: Clj-schema is a library for defining and validating schemas for maps, as well as for using those schemas to create valid test data. We've been using this in production for at least a few months now, at Runa. https://github.com/runa-dev/**clj-schemahttps://github.com/runa-dev/clj-schema The main benefits I've found from using this library are: * validating the inputs to the application: validating Ring request params and config files * validating before storing maps into the DB * using the clj-schema.fixtures library to create valid test data that stays valid. So as the standard form of a map changes over time the tests will stay in sync with those changes automatically. * there are some code-readability benefits as well - any developer can pretty quickly see what certain kinds of maps tend to look like. There's more info in the README: https://github.com/runa-dev/**clj-schema/blob/master/README.**mdhttps://github.com/runa-dev/clj-schema/blob/master/README.md Future possibilities: * auto-generating test data from clj-schema fixtures * being able to create schemas for sets and sequences (currently a schema is always for a map) Contributors welcome. Alex -- 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 unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -- 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 unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -- 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 unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options,
n00b question on embedded defrecord
; I have these records defined (defrecord Customer [firstName lastName emailAddress deliveryAddress invoiceAddress]) (defrecord Address [street number town postcode]) ; I have this small sample data (def customers { (-Customer Drongo Bongo dro...@bongo.co (-Address Gongo 32A Fongo ) (-Address Gongo 32B Fongo )) (-Customer Tinga Zinga qi...@zinga.co (-Address Thinga 767 Dongo ) (-Address Jinga 828 Qongo )) } ) ; and I want a small filter on an embedded property (deliveryAddress.number) ; this compiles but of course it's wrong so gives back an empty list (prn (filter #(= 32A (:deliveryAddress :number %)) customers)) I have tried putting - and [] in various places and of course checked docs In the end I thought it would be quicker just to ask here. Thanks Ray -- 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 unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: core.logic vs datomic
You are right. I am referring to the querying function, not datomic on the whole. I have my own understanding about the differences but I was interested in hearing others. Please don't feel pressured to answer my question. I'm trying to compile understanding akin to stackoverflow, where as long as the question hasn't been asked before, then its worth posting. I'm not assuming answering this question satisfactorily won't take some effort. I hope my casual prose hasn't discouraged others from providing their input. On Sunday, December 9, 2012 3:11:08 PM UTC-5, Nick Zbinden wrote: First of all, stop saying 'on datomic'. Datomic as a Database, witch in its Peer library has a implmentation of Datalog. This implmentation of Datalog has basicly nothing to do with the rest of datomic, it can be used as a query language for data from all sources, it just comes with the Datomic Peer Library. There is no sence in me explaining this. Learn what logic programming (prolog, core.logic) is and how it works, and then you will understand it. @David, That's actually a good explanation of core.logic I haven't really heard before, in that its all about solving constraint satisfaction problems, which is well defined. So now, my understanding is that querying in datomic is really just declarative code to describe a fancy filter function over a data set. Whereas solving constraint satisfaction problems are about efficiently exploring the combinatorial expansion of the problem to determine the solution space. Mathematically this seems similar though, in that if you could express the expansion of cases in the database, then you could perform the query and obtain the answer. Something tells me that this is where the key difference lies. Since core.logic gradually expands the partial solutions until it meets all the constraints, this happens lazily, whereas datomic querying only occurs on existing values. Does this sound right? In addition, core.logic provides tools for declaring how this expansion occurs. -- 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 unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: n00b question on embedded defrecord
On Sun, Dec 9, 2012 at 4:45 PM, mond r...@mcdermott.be wrote: ; I have these records defined (defrecord Customer [firstName lastName emailAddress deliveryAddress invoiceAddress]) (defrecord Address [street number town postcode]) This looks fine ; I have this small sample data (def customers { (-Customer Drongo Bongo dro...@bongo.co (-Address Gongo 32A Fongo ) (-Address Gongo 32B Fongo )) (-Customer Tinga Zinga qi...@zinga.co (-Address Thinga 767 Dongo ) (-Address Jinga 828 Qongo )) } ) You probably want this to be a vector of customers instead of a map? so, (def customers [ (-Customer Drongo Bongo dro...@bongo.co (-Address Gongo 32A Fongo ) (-Address Gongo 32B Fongo )) (-Customer Tinga Zinga qi...@zinga.co (-Address Thinga 767 Dongo ) (-Address Jinga 828 Qongo )) ] ) ; and I want a small filter on an embedded property (deliveryAddress.number) ; this compiles but of course it's wrong so gives back an empty list (prn (filter #(= 32A (:deliveryAddress :number %)) customers)) So you can write this a bunch of different ways: (prn (filter #(= (:number (:deliveryAddress %)) 32A) customers)) or if you want to use -, you can: (prn (filter #(- % :deliveryAddress :number (= 32A)) customers)) Cheers, Jordan -- 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 unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Clojure raytracing scene description language
Hi all, I'm working on a hobby project to implement a Clojure raytracer, something along the lines of POV-Ray: https://github.com/mikera/enlight It's a a fairly preliminary stage right now, but I'm interested in ideas on how to create the scene description language. Roughly the objectives are: - Allow an intuitive, declarative definition of a 3D scene - Allow parts of the scene to be generated programatically (e.g. randomly duplicating objects!) - Allow mathematical functions and textures to be expressed (probably using clisk - https://github.com/mikera/clisk) - Enable the scene to be compiled down to an optimised scene graph for rendering - Be reasonably concise as a DSL I'm thinking of something like: [ [:camera :position [0 0 -10] :look-at [0 0 0]] ;; a camera for the scene [:sphere :radius 1 :translate [0 2 0] :colour red] ;; a translated red shere [:box [0 0 0] [1 1 1] :colour (function [1 x y])] ;; a box with a procedural colour function (for [i [2 3 4]] [:box [i 1 1] [(inc i) 2 2]]) ;; generate multiple boxes with a parameterised position ] Any thoughts / ideas / feedback? -- 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 unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
what Jetty jars do I need for WebSockets?
I am still fairly new to Clojure, the JVM and Java, so I get lost trying to read some of the stuff that assumes knowledge of any of those 3. I want to build a Clojure app using Jetty and offering WebSocket connections. I have already built an app with Clojure and Jetty, so that part is easy. But I look here: http://wiki.eclipse.org/index.php?title=Jetty/Feature/WebSocketsoldid=297254 and it says I should download 3 jars: wget -O jetty-all.jar --user-agent=demo \ http://repo2.maven.org/maven2/org/eclipse/jetty/aggregate/jetty-all/7.6.2.v20120308/jetty-all-7.6.2.v20120308.jarwget -O jetty-websocket-tests.jar --user-agent=demo \ http://repo2.maven.org/maven2/org/eclipse/jetty/jetty-websocket/7.6.2.v20120308/jetty-websocket-7.6.2.v20120308-tests.jarwget --user-agent=demo \ http://repo2.maven.org/maven2/javax/servlet/servlet-api/2.5/servlet-api-2.5.jar I assume I put these in project.clj? I already have stuff in there like: :dependencies [[org.clojure/clojure 1.3.0] [net.cgrand/moustache 1.1.0] [ring 1.1.5] [ring/ring-jetty-adapter 1.1.5] etc Searching on this topic brought me to this: https://groups.google.com/forum/?fromgroups=#!topic/ring-clojure/JD9FLJFTVsg But that is 2 years old. I have not found anything specific to ring/jetty/websockets that is recent. Can anyone point me to documentation that might lead me out of my confusion? -- 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 unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: what Jetty jars do I need for WebSockets?
I don't have the answer, but I would strongly recommend webbit: https://github.com/webbit/webbit I've been using it for quite awhile and I've been very happy with it. On Sun, Dec 9, 2012 at 8:55 PM, larry google groups lawrencecloj...@gmail.com wrote: I am still fairly new to Clojure, the JVM and Java, so I get lost trying to read some of the stuff that assumes knowledge of any of those 3. I want to build a Clojure app using Jetty and offering WebSocket connections. I have already built an app with Clojure and Jetty, so that part is easy. But I look here: http://wiki.eclipse.org/index.php?title=Jetty/Feature/WebSocketsoldid=297254 and it says I should download 3 jars: wget -O jetty-all.jar --user-agent=demo \ http://repo2.maven.org/maven2/org/eclipse/jetty/aggregate/jetty-all/7.6.2.v20120308/jetty-all-7.6.2.v20120308.jar wget -O jetty-websocket-tests.jar --user-agent=demo \ http://repo2.maven.org/maven2/org/eclipse/jetty/jetty-websocket/7.6.2.v20120308/jetty-websocket-7.6.2.v20120308-tests.jar wget --user-agent=demo \ http://repo2.maven.org/maven2/javax/servlet/servlet-api/2.5/servlet-api-2.5.jar I assume I put these in project.clj? I already have stuff in there like: :dependencies [[org.clojure/clojure 1.3.0] [net.cgrand/moustache 1.1.0] [ring 1.1.5] [ring/ring-jetty-adapter 1.1.5] etc Searching on this topic brought me to this: https://groups.google.com/forum/?fromgroups=#!topic/ring-clojure/JD9FLJFTVsg But that is 2 years old. I have not found anything specific to ring/jetty/websockets that is recent. Can anyone point me to documentation that might lead me out of my confusion? -- 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 unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -- 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 unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: abysmal multicore performance, especially on AMD processors
There's no magic here, everyone tuning their app hit this wall eventually, tweaking the JVM memory options :) Luc On Dec 9, 2012, at 6:25 AM, Softaddicts wrote: If the number of object allocation mentioned earlier in this thread are real, yes vm heap management can be a bottleneck. There has to be some locking done somewhere otherwise the heap would corrupt :) The other bottleneck can come from garbage collection which has to freeze object allocation completely or partially. This internal process has to reclaim unreferenced objects otherwise you may end up exhausting the heap. That can even susoend your app while gc is running depending on the strategy used. Agreed that memory allocation and garbage collection will in some cases need to coordinate between threads to work in the general case of arbitrary allocations and GCs. However, one could have a central list of large pages of free memory (e.g. a few MBytes, or maybe even larger), and pass these out to concurrent memory allocators in these large chunks, and let them do small object allocations and GC within each thread completely concurrently. The only times locking of any kind might be needed with such a strategy would be when one of the parallel threads requests a new big page from the central free list, or returned a completely empty free page back to the central list that it didn't need any more. All other memory allocation and GC could be completely concurrent. The idea of making those pages large is that such passing pages around would be infrequent, and thus could be made to have no measurable synchronization overhead. That is pretty much what is happening when you run Lee's benchmark programs as 1 thread per JVM, but 4 or 8 different JVMs processes running in parallel. In that situation the OS has the central free list of pages, and the JVMs manage their small object allocations and GCs completely concurrently without interfering with each other. If HotSpot's JVM could be configured to work like that, he would be seeing big speedups in a single JVM. Andy -- 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 unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en -- Softaddictslprefonta...@softaddicts.ca sent by ibisMail from my ipad! -- 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 unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: ANN: clj-schema, Schemas For Clojure Maps
I wanted something like this to create an AST validator for ClojureScript! Will have to find some time to study your approach. On Sunday, November 25, 2012 3:22:04 PM UTC-8, Alex Baranosky wrote: Clj-schema is a library for defining and validating schemas for maps, as well as for using those schemas to create valid test data. We've been using this in production for at least a few months now, at Runa. https://github.com/runa-dev/clj-schema The main benefits I've found from using this library are: * validating the inputs to the application: validating Ring request params and config files * validating before storing maps into the DB * using the clj-schema.fixtures library to create valid test data that stays valid. So as the standard form of a map changes over time the tests will stay in sync with those changes automatically. * there are some code-readability benefits as well - any developer can pretty quickly see what certain kinds of maps tend to look like. There's more info in the README: https://github.com/runa-dev/clj-schema/blob/master/README.md Future possibilities: * auto-generating test data from clj-schema fixtures * being able to create schemas for sets and sequences (currently a schema is always for a map) Contributors welcome. Alex -- 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 unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Clojure raytracing scene description language
Are you only interested in static scenes? Or are you interested in simulations too? On Sunday, December 9, 2012 4:03:36 PM UTC-8, Mikera wrote: Hi all, I'm working on a hobby project to implement a Clojure raytracer, something along the lines of POV-Ray: https://github.com/mikera/enlight It's a a fairly preliminary stage right now, but I'm interested in ideas on how to create the scene description language. Roughly the objectives are: - Allow an intuitive, declarative definition of a 3D scene - Allow parts of the scene to be generated programatically (e.g. randomly duplicating objects!) - Allow mathematical functions and textures to be expressed (probably using clisk - https://github.com/mikera/clisk) - Enable the scene to be compiled down to an optimised scene graph for rendering - Be reasonably concise as a DSL I'm thinking of something like: [ [:camera :position [0 0 -10] :look-at [0 0 0]] ;; a camera for the scene [:sphere :radius 1 :translate [0 2 0] :colour red] ;; a translated red shere [:box [0 0 0] [1 1 1] :colour (function [1 x y])] ;; a box with a procedural colour function (for [i [2 3 4]] [:box [i 1 1] [(inc i) 2 2]]) ;; generate multiple boxes with a parameterised position ] Any thoughts / ideas / feedback? -- 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 unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Clojure raytracing scene description language
On Sun, Dec 9, 2012 at 6:03 PM, Mikera mike.r.anderson...@gmail.com wrote: Any thoughts / ideas / feedback? What if you try keeping it pretty close to the current POV syntax/format? -- 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 unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: n00b question on embedded defrecord
Thanks Jordan - I just couldn't quite get that magic combination :) On Sunday, December 9, 2012 11:38:50 PM UTC+1, Jordan wrote: On Sun, Dec 9, 2012 at 4:45 PM, mond r...@mcdermott.be javascript:wrote: ; I have these records defined (defrecord Customer [firstName lastName emailAddress deliveryAddress invoiceAddress]) (defrecord Address [street number town postcode]) This looks fine ; I have this small sample data (def customers { (-Customer Drongo Bongo dro...@bongo.co javascript: (-Address Gongo 32A Fongo ) (-Address Gongo 32B Fongo )) (-Customer Tinga Zinga qi...@zinga.co javascript: (-Address Thinga 767 Dongo ) (-Address Jinga 828 Qongo )) } ) You probably want this to be a vector of customers instead of a map? so, (def customers [ (-Customer Drongo Bongo dro...@bongo.co javascript: (-Address Gongo 32A Fongo ) (-Address Gongo 32B Fongo )) (-Customer Tinga Zinga qi...@zinga.co javascript: (-Address Thinga 767 Dongo ) (-Address Jinga 828 Qongo )) ] ) ; and I want a small filter on an embedded property (deliveryAddress.number) ; this compiles but of course it's wrong so gives back an empty list (prn (filter #(= 32A (:deliveryAddress :number %)) customers)) So you can write this a bunch of different ways: (prn (filter #(= (:number (:deliveryAddress %)) 32A) customers)) or if you want to use -, you can: (prn (filter #(- % :deliveryAddress :number (= 32A)) customers)) Cheers, Jordan -- 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 unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
ANN: simplecl structgen: OpenCL processing pipelines C-struct interop
Dear all, I've just pushed two libraries which I've been working on since summer now and which have already proven themselves in production too (regardless of their baby age): === http://hg.postspectacular.com/simplecl === simplecl is striving to be both a thin wrapper around Jogamp's OpenCL bindings, but also provides a more highlevel API to declaratively define complex processing pipelines and efficiently pass data back forth between Clojure OpenCL. The simplecl.core ns provides several solutions to work with OpenCL buffers in a way which should still be idiomatic (here we go again) to the standard Clojure programmer... Currently there's only a single demo/example available, but it's quite well commented and is a 2D Verlet physics cloth simulation consisting of 40k particles 80k springs. On my MacBook Pro i7 a single simulation step (41 iterations) only takes 280-350ms. Video captures of: 1) a few physics sim variations: http://media.postspectacular.com/2012/simplecl/20121208-gridx-hd720.mp4 2) a 3d strange attractor pipeline (more infos on website) http://media.postspectacular.com/2012/simplecl/20121205-attractor-grad-hd720.mp4 Over the holidays I will add some more examples and start publishing more from my growing collection of composable CL kernels... === http://hg.postspectacular.com/structgen === A Clojure library for seamless working with native C structs structured byte buffers. Structgen has the following features so far: * parsing of typedefs from C source files * dependency graph for nested structs * C source code generation for registered types (incl. automatic dependencies) * representation of C structs as standard Clojure data structures (maps vectors) * customizable memory alignment logic for struct fields (defaults to OpenCL alignment, inserts filler bytes where necessary) * extensible type registry, pre-configured with common C OpenCL primitives Currently not supported: No self-recursive structs, no pointer struct fields Structgen is making use of Zach's Gloss library to encode/decode structs into/from byte buffers. Since these are my first serious releases in Clojure land I'd very much love some feedback am fully open for advice for any improvements! Best, K. -- Karsten Schmidt http://postspectacular.com | http://toxiclibs.org | http://toxi.co.uk -- 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 unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en