Re: Best tools for profiling Clojure programs?

2014-07-03 Thread ru
Thank you Niels, вторник, 1 июля 2014 г., 15:10:42 UTC+4 пользователь Niels van Klaveren написал: A new option for test purposes is included in JDK 1.7.0_40 and up and is called Java Mission Control. It is located in the JDK as /bin/jmc.exe. Is this tool only for Windows? With it you

Re: Deploying to Clojars no longer works

2014-07-03 Thread Adam Clements
Have you tried upgrading leiningen to the latest version? I don't think you can deploy from old versions, at least that's been a problem for me in the past. On 2 Jul 2014 20:55, Jacob Goodson submissionfight...@gmx.com wrote: I have been deploying the same project to clojars for quite a while

Re: Best tools for profiling Clojure programs?

2014-07-03 Thread Jakub Holy
No, it is not. At least it is available on Mac too. On Thursday, July 3, 2014 9:25:44 AM UTC+2, ru wrote: Thank you Niels, вторник, 1 июля 2014 г., 15:10:42 UTC+4 пользователь Niels van Klaveren написал: A new option for test purposes is included in JDK 1.7.0_40 and up and is called

Re: Best tools for profiling Clojure programs?

2014-07-03 Thread Alex Baranosky
YourKit works well. I've heard good things about JVisualVM, but don't have experience using it. On Thu, Jul 3, 2014 at 12:31 AM, Jakub Holy jakub.h...@iterate.no wrote: No, it is not. At least it is available on Mac too. On Thursday, July 3, 2014 9:25:44 AM UTC+2, ru wrote: Thank you

Re: Best tools for profiling Clojure programs?

2014-07-03 Thread Alex Baranosky
Woops, posting too late... I typed JVisualVM, but meant to say Java Mission Control. On Thu, Jul 3, 2014 at 1:10 AM, Alex Baranosky alexander.barano...@gmail.com wrote: YourKit works well. I've heard good things about JVisualVM, but don't have experience using it. On Thu, Jul 3, 2014 at

Re: Best tools for profiling Clojure programs?

2014-07-03 Thread Niels van Klaveren
No, also for Oracle JVM on Linux, and 64 bit Mac OS X -- 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

clojure.test.check

2014-07-03 Thread cig
Hi I have been trying to build a test.check generator for a multi map, without much success. I have a generator which generates ordinary maps: (def ord-gen (gen/fmap (partial zipmap [:port :instr :qty]) (gen/tuple (gen/not-empty gen/string-alpha-numeric)

Re: Deploying to Clojars no longer works

2014-07-03 Thread Zach Oakes
Even on the latest version (2.4.0), I've experienced problems in the last three weeks. I believe they've coincided with the site redesign, but they may not be related. I sometimes get Read timed out when uploading an artifact. Since deployments aren't atomic, the library or template will be

Re: auto-reloading tests with diffs

2014-07-03 Thread Jake McCrary
Hi Conrad, Not sure if this will meet your needs but I just tried using humane-test-output with lein-test-refresh and had auto-running of tests with a nice diff output. If humane-test-output gives you the output you are looking for I'd imagine it works with prism as well. humane-test-output:

Re: clojure.test.check

2014-07-03 Thread Reid Draper
Hi, I've taken a stab at what I think you want: (def gen-cache (gen/fmap #(reduce (fn [r m] (merge-with merge r m)) {} %) (gen/vector (gen/fmap (fn [o] (let [{:keys [port instr] :as ord} o] (assoc-in {} [port instr] ord)))

Re: Broad question about best-practices for structs

2014-07-03 Thread SharpCoder
Hello Timothy, Thank you for the response. I've given much thought to your examples and it quickly became clear how relevant defprotocol and deftype is. I had no idea Clojure provided a mechanism for strongly typed structures like that. I've started re-designing my library around this concept

Re: Broad question about best-practices for structs

2014-07-03 Thread Timothy Baldridge
There's one other construct that may help you here: (defrecord Point [x y] (scale [this amount] (assoc this :x (* x amount) :y (* y amount defrecord acts much like deftype, but creates a new copy of the record via assoc, you can also do stuff like: (:x (-Point 10 11)) defrecord

Re: Why does unquote clone values?

2014-07-03 Thread Pascal Germroth
Hi Atamert, Here's a gist with the example code: https://gist.github.com/neapel/4e502a14e3738b709672 I tried replacing a closure with a dynamically built and evaluated metafunction but discovered that it was actually slower. If evaluating code during run is slower than AOT compiling it, it

syntax tree manipulation

2014-07-03 Thread Brian Craft
What clojure tools should I be considering for doing syntax tree manipulations? In general, I'm recursively matching patterns in subtrees and rewriting them. The patterns are usually more complex than, say, core.match patterns (e.g. match subtree having vector that contains term, and split the

Re: Why does unquote clone values?

2014-07-03 Thread adrian . medina
You're going down a rabbit hole here. Evaluating forms at runtime will always result in a slower execution time than a function that doesn't evaluate a form at runtime. On Thursday, July 3, 2014 11:55:02 AM UTC-4, Pascal Germroth wrote: Hi Atamert, Here's a gist with the example code:

Re: reloading enlive templates

2014-07-03 Thread Curtis Summers
I'm using ring.middleware.force-reload to always reload the namespaces that reference my enlive templates. (only in dev, of course) https://github.com/citizenparker/ring-middleware-force-reload Hope that helps, Curtis On Wednesday, July 2, 2014 3:14:16 PM UTC-5, Sven Richter wrote: Hi,

Re: syntax tree manipulation

2014-07-03 Thread adrian . medina
If I understand your question correctly, you want to manipulate a deeply nested tree-like data structure, right? If that's correct, then perhaps a combination of clojure.zip and multimethods will suit your needs. Zippers provide a facility to transform (possibly) deeply nested immutable data

Re: syntax tree manipulation

2014-07-03 Thread Timothy Baldridge
Zippers, clojure core functions work great if you don't need to query up the tree as well as down. For situations where I want pattern-matching like semantics, with the ability to do arbitrary queries, I've reached for core.logic and/or Datomic. It's pretty trivial to have some code that turns a

Re: syntax tree manipulation

2014-07-03 Thread James Reeves
You may want to take a look at seqexp https://github.com/cgrand/seqexp and zip-visit https://github.com/akhudek/zip-visit. - James On 3 July 2014 17:12, Brian Craft craft.br...@gmail.com wrote: What clojure tools should I be considering for doing syntax tree manipulations? In general, I'm

Re: Why does unquote clone values?

2014-07-03 Thread Pascal Germroth
On Thursday, July 3, 2014 5:19:56 PM UTC+1, adrian...@mail.yu.edu wrote: You're going down a rabbit hole here. Evaluating forms at runtime will always result in a slower execution time than a function that doesn't evaluate a form at runtime. I thought that was the whole point of

When to prefer keywords as functions?

2014-07-03 Thread gvim
I'm reading Cloujure in Action as an introduction to Clojure and, although, I understand a keyword can be used as a function I don't understand the difference between: (ns org.currylogic.damages.http.expenses (:require [clojure.data.json :as json-lib]

Re: Why does unquote clone values?

2014-07-03 Thread adrian . medina
I'm not sure I understand what you're saying here. :( Your example is simply benchmarking the same bit of code in each form. Why would evaluating one explicitly affect that benchmark? Your original example called eval in the body of the functions that you're benchmarking. That is where the

Re: When to prefer keywords as functions?

2014-07-03 Thread James Reeves
The ns form is a macro that takes a special syntax and always uses the keyword form, as you have in your first example. Your second example is incorrect; I'd be surprised if it even ran. The reason for this is to make it clear that you're not executing the require function directly, but instead

Re: clojure.test.check

2014-07-03 Thread cig
Hi Reid Yes that's exactly what I was trying to achieve. Thank you very much. As for the multi-maps. I was simply using the term incorrectly, sorry for the confusion. Thanks once again On Thursday, 3 July 2014 16:44:29 UTC+2, Reid Draper wrote: Hi, I've taken a stab at what I think you

Re: Why does unquote clone values?

2014-07-03 Thread Pascal Germroth
On Thursday, July 3, 2014 6:15:32 PM UTC+1, adrian...@mail.yu.edu wrote: I'm not sure I understand what you're saying here. :( Your example is simply benchmarking the same bit of code in each form. Why would evaluating one explicitly affect that benchmark? Your original example called eval

Re: When to prefer keywords as functions?

2014-07-03 Thread gvim
On 03/07/2014 18:36, James Reeves wrote: The reason for this is to make it clear that you're not executing the require function directly, but instead passing options to the ns form. I don't understand not executing the require function directly. I've also seen the when function called as

Re: Why does unquote clone values?

2014-07-03 Thread adrian . medina
No I'm benchmarking the functions returned by f1-4. Where did I say different? In any event, I'm trying to help you understand why your benchmarking results are not aligning with your expectations and assumptions about the code you wrote. I would really like to help you gain a greater

Re: When to prefer keywords as functions?

2014-07-03 Thread adrian . medina
I believe you might have seen :when in the binding vector of either a for or deseq form. Their special usage is documented here: http://clojure.github.io/clojure/clojure.core-api.html#clojure.core/for In any event, James explained the distinction quite well. Macros are often used to create

Re: When to prefer keywords as functions?

2014-07-03 Thread Mauricio Aldazosa
Keywords can be used as a function with a map, so the keyword will search for itself in the map. Take a look at http://clojure.org/data_structures#Data%20Structures-Keywords In the case of the ns form, as James pointed out, what is happening is not a function call. ns is a macro and as such that

Re: Why does unquote clone values?

2014-07-03 Thread Pascal Germroth
On Thursday, July 3, 2014 7:27:24 PM UTC+1, adrian...@mail.yu.edu wrote: No I'm benchmarking the functions returned by f1-4. Where did I say different? I understood Your original example called eval in the body of the functions that you're benchmarking as meaning I was running something

Re: When to prefer keywords as functions?

2014-07-03 Thread Jony Hudson
One thing to note is that while it's true keywords can be used as functions they can only really do one thing, which is get values from maps. That is to say, the keyword-function :foo is equivalent to the function #(get % foo). The function :foo has no relationship with the function foo, if it

Re: noob questions - Hello world + learning

2014-07-03 Thread Evan Zamir
New to Clojure (find it fascinating so far, in large part due to watching approximately a billion Rich Hickey vids on YouTube). I had a similar question and figured I just resurrect this thread on it. My naive thought was that when you (re)def a variable, you aren't actually copying over the

Re: noob questions - Hello world + learning

2014-07-03 Thread Andy Fingerhut
In your example, [1 2 3 4 5] allocates and initializes a vector with the 5 elements 1 2 3 4 5. The first (def my-vec ...) also allocates a Var, and makes it 'point' at the vector [1 2 3 4 5]. When you do (assoc my-vec 2 hello), it looks up the current value pointed at by my-vec, which is the

Re: Why does unquote clone values?

2014-07-03 Thread Atamert Ölçgen
On Thu, Jul 3, 2014 at 11:55 PM, Pascal Germroth funkyco...@gmail.com wrote: Hi Atamert, Here's a gist with the example code: https://gist.github.com/neapel/4e502a14e3738b709672 I tried replacing a closure with a dynamically built and evaluated metafunction but discovered that it was