Re: JVM assertions in Clojure

2013-10-15 Thread Phillip Lord
Paul Stadig p...@stadig.name writes: I think that you are worried about the overhead unnecessarily, though. The assert status is checked at macro expansion time. If per module switching on and off is what then I would suggest that you build on top of the existing assert. There is a huge

is PG's imperative outside-in advice any good?

2013-10-15 Thread Daniel Higginbotham
I've been going through On Lisp by Paul Graham and on page 33 he recommends against performing intermediate bindings. Does this advice hold for Clojure? Here are a couple examples: ;; Common Lisp (from the book) (defun bad (x) (let (y sqr) (setq y (car x)) (setq sqr (expt y 2)) (list

Re: [ANN] Timeline - a library for time-varying data values

2013-10-15 Thread Michael Klishin
2013/10/15 Mikera mike.r.anderson...@gmail.com Repository is here: https://github.com/mikera/timeline Have fun! It would be a bit easier to have fun if there were dependency/installation instructions provided in README. -- MK http://github.com/michaelklishin

Re: [ANN] Timeline - a library for time-varying data values

2013-10-15 Thread Mikera
Easily done :-) - README updated, the early releases are all on Clojars https://clojars.org/net.mikera/timeline On Tuesday, 15 October 2013 21:03:16 UTC+8, Michael Klishin wrote: 2013/10/15 Mikera mike.r.an...@gmail.com javascript: Repository is here: https://github.com/mikera/timeline

Re: is PG's imperative outside-in advice any good?

2013-10-15 Thread Brian Hurt
Lifting subexpressions up into lets is actually something I do a lot- for one very important reason: it lets me insert print statements (or logging statements) showing the value of the subexpression. So I'll do; (let [ x (subexpression) ] (main-expression)) because it lets me do:

Re: [ANN] Timeline - a library for time-varying data values

2013-10-15 Thread Jozef Wagner
Wouldn't sorted-set be better than RRB vector in your case? On Tue, Oct 15, 2013 at 2:15 PM, Mikera mike.r.anderson...@gmail.comwrote: Hi All, I just created a new, small, experimental library because I needed to represent a timeline of values as an immutable object. Target use cases: -

Re: finding a call to longCast

2013-10-15 Thread John D. Hume
If you have some idea where to look in your code, or if there isn't much code, I'd take a look at clojure.tools.analyzer/analyze-ns[1]. The output is a little overwhelming, but it's pretty easy to navigate in clojure.inspector. One issue may be finding the call (e.g. to some clojure.core fn) that

Re: [ANN] Timeline - a library for time-varying data values

2013-10-15 Thread Mikera
I assume you mean sorted maps? A timeline is pretty much an ordered time - event mapping The main reason for the RRB vectors is the efficient concatenation and slicing. So you can manipulate large chunks of timeline data. For example - this is helpful if you are handling long streams of sensor

Re: is PG's imperative outside-in advice any good?

2013-10-15 Thread Raoul Duke
if a programming language doesn't have something like 'where', then i am sad. http://stackoverflow.com/questions/4362328/haskell-where-vs-let -- -- You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email to

Re: Lifecycle Composition

2013-10-15 Thread Murtaza Husain
Thanks Jonah. Appreciate the reply, it was very helpful. On Monday, September 23, 2013 9:03:35 AM UTC+5:30, jonah wrote: Hi Murtaza, The short answer is that it's not necessarily that there are pros or cons between having components know about each other in their constructed vs

Re: is PG's imperative outside-in advice any good?

2013-10-15 Thread Alex Baranosky
I and some of my coworkers do tend to avoid `let` unless in this particular case you especially want to emphasize the name of something unobvious. OFten I'd prefer to pull out a new function over using let, or inline the binding for readability *improvement*. On Tue, Oct 15, 2013 at 8:18 AM,

Re: is PG's imperative outside-in advice any good?

2013-10-15 Thread Sean Corfield
Yeah, I found when I first got started with Clojure I tended to use let for intermediate named results but over time I've moved to using small, private top-level functions instead because I want to focus on the names of the _functionality_ rather than the names of intermediate _data_. I still use

Re: [ANN] Timeline - a library for time-varying data values

2013-10-15 Thread Tim Visher
On Tue, Oct 15, 2013 at 8:15 AM, Mikera mike.r.anderson...@gmail.com wrote: I just created a new, small, experimental library because I needed to represent a timeline of values as an immutable object. This sounds very cool. I've been thinking about doing something like this for awhile to

Re: is PG's imperative outside-in advice any good?

2013-10-15 Thread Marcus Lindner
How looks this? (defn conditional [x condition consequent alternative] (if (condition x) (consequent x) (alternative x (conditional (some-expression) p f g) Am 15.10.2013 19:02, schrieb Sean Corfield: Yeah, I found when I first got started with Clojure I tended to use let for

Re: is PG's imperative outside-in advice any good?

2013-10-15 Thread Guru Devanla
Sean, The case you listed is where let binding becomes important so as to not perform duplicate evaluation. That is one place the utility of let stands out along with its scope. For example Without let bindings: (if (p (some-expression)) (f (some-expression)) (g (some-expression))

Re: is PG's imperative outside-in advice any good?

2013-10-15 Thread Sean Corfield
I know how to write it but I just don't like that name (or any other I've come up with yet). And I'd probably put the `x` as the last argument and provide a curried version. On Tue, Oct 15, 2013 at 10:13 AM, Marcus Lindner marcus.goldritter.lind...@gmail.com wrote: How looks this? (defn

Re: is PG's imperative outside-in advice any good?

2013-10-15 Thread Sean Corfield
On Tue, Oct 15, 2013 at 10:15 AM, Guru Devanla grd...@gmail.com wrote: The case you listed is where let binding becomes important so as to not perform duplicate evaluation. That is one place the utility of let stands out along with its scope. Yup, exactly. I just see it often enough that I

Re: is PG's imperative outside-in advice any good?

2013-10-15 Thread Jim - FooBar();
On 15/10/13 18:02, Sean Corfield wrote: One construct using let that I see in my code quite a bit that I haven't figured out a cleaner way to express: (let [x (some-expression)] (if (p x) (f x) (g x))) wasn't cond- designed exactly for that? (let [x (some-expression)] (cond- x

Re: is PG's imperative outside-in advice any good?

2013-10-15 Thread Sean Corfield
On Tue, Oct 15, 2013 at 10:19 AM, Jim - FooBar(); jimpil1...@gmail.com wrote: wasn't cond- designed exactly for that? (let [x (some-expression)] (cond- x (p x) f ((comlpement p) x) g))) That's uglier than the if :) Sometimes I wish there was a variant of cond- that took functions

RE: is PG's imperative outside-in advice any good?

2013-10-15 Thread Phillip Lord
What about let-some-expression-if-then-else? From: clojure@googlegroups.com [clojure@googlegroups.com] on behalf of Sean Corfield [seancorfi...@gmail.com] Sent: 15 October 2013 18:02 To: clojure@googlegroups.com Subject: Re: is PG's imperative

reflection warning with threading macro

2013-10-15 Thread Brian Craft
This gives me a reflection warning: (.write out ^String (- slist meta :hex)) This does not: (.write out ^String (:hex (meta slist))) = (clojure.walk/macroexpand-all '(- slist meta :hex)) (:hex (meta slist)) What's going on? Is there some other way to type hint the case with the threading

Re: is PG's imperative outside-in advice any good?

2013-10-15 Thread Ben Wolfson
On Tue, Oct 15, 2013 at 10:48 AM, Sean Corfield seancorfi...@gmail.comwrote: On Tue, Oct 15, 2013 at 10:19 AM, Jim - FooBar(); jimpil1...@gmail.com wrote: wasn't cond- designed exactly for that? (let [x (some-expression)] (cond- x (p x) f ((comlpement p) x) g))) That's

Re: reflection warning with threading macro

2013-10-15 Thread Sean Corfield
My guess would be the ^String is attached to the following expression in both cases but the macro-expansion process loses that metadata... On Tue, Oct 15, 2013 at 10:51 AM, Brian Craft craft.br...@gmail.com wrote: This gives me a reflection warning: (.write out ^String (- slist meta :hex))

Re: reflection warning with threading macro

2013-10-15 Thread Marshall Bockrath-Vandegrift
Brian Craft craft.br...@gmail.com writes: What's going on? Is there some other way to type hint the case with the threading macro? I’m pretty sure this is CLJ-865 “Macroexpansion discards form metadata”: http://dev.clojure.org/jira/browse/CLJ-865 In which case you’ll need to use an

Re: is PG's imperative outside-in advice any good?

2013-10-15 Thread Bob Hutchison
On 2013-10-15, at 8:29 AM, Daniel Higginbotham nonrecurs...@gmail.com wrote: I've been going through On Lisp by Paul Graham and on page 33 he recommends against performing intermediate bindings. Does this advice hold for Clojure? Here are a couple examples: ;; Common Lisp (from the book)

Re: ANN: lein-midje-doc 0.0.9 released

2013-10-15 Thread zcaudate
Hi Tim. I've lodged the issue with Raynes here: https://github.com/Raynes/conch/issues/7 Chris. -- -- 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

Re: ANN: lein-midje-doc 0.0.9 released

2013-10-15 Thread zcaudate
Hi Tim. I've lodged the issue with Raynes here: https://github.com/Raynes/conch/issues/7 Chris. -- -- 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

Generating schema maps

2013-10-15 Thread zcaudate
I'm wondering if there are any good tools around for generating schema maps. I'm looking for a example that can generate the picture from codeq - https://github.com/downloads/Datomic/codeq/codeq.pdf -- -- You received this message because you are subscribed to the Google Groups Clojure group.

Re: [ANN] Jig

2013-10-15 Thread Malcolm Sparks
Hi Tim, Thanks for the feedback. A. By default, nrepl-jack-in will invoke lein from the directory of the project that owns the file in the current Emacs buffer. You need to start Jig from its own project directory, not the project directory of your own application. Normally I load up Jig's

Re: [ANN] Jig

2013-10-15 Thread Malcolm Sparks
On Sunday, 13 October 2013 01:21:40 UTC+1, Manuel Paccagnella wrote: Looks very interesting, thanks for sharing! BTW, documentation is impressive and quite comprehensive. On a related note: I've spotted a couple of typos in your README.md so far. Do you accept pull requests for small

Re: is PG's imperative outside-in advice any good?

2013-10-15 Thread Daniel Higginbotham
Thanks for all the responses! This discussion will definitely help me write better code. This was especially helpful: over time I've moved to using small, private top-level functions instead because I want to focus on the names of the _functionality_ rather than the names of intermediate

Re: [ANN] Timeline - a library for time-varying data values

2013-10-15 Thread Mikera
On Wednesday, 16 October 2013 01:03:56 UTC+8, Tim Visher wrote: On Tue, Oct 15, 2013 at 8:15 AM, Mikera mike.r.an...@gmail.comjavascript: wrote: I just created a new, small, experimental library because I needed to represent a timeline of values as an immutable object. This sounds