Re: Clojure/West 2013 videos?

2013-03-25 Thread Cedric Greevey
On Mon, Mar 25, 2013 at 9:00 AM, Alex Miller wrote: > > > On Sunday, March 24, 2013 8:44:09 PM UTC-5, Cedric Greevey wrote: > >> On Sun, Mar 24, 2013 at 7:23 PM, Alex Miller wrote: >> >>> I have done a fair amount of polling on this for Strange Loop and it'

Re: Clojure/West 2013 videos?

2013-03-24 Thread Cedric Greevey
On Mon, Mar 25, 2013 at 1:16 AM, Sean Grove wrote: > I'm sure that having nice videos (which have all been awesome) aren't > cheap, nor are they easy to produce. It's unfair to trivialize the > production and editing of high-quality material. > We aren't talking Hollywood blockbusters here. A st

Re: Clojure/West 2013 videos?

2013-03-24 Thread Cedric Greevey
On Sun, Mar 24, 2013 at 11:24 PM, Rich Morin wrote: > On Mar 24, 2013, at 18:44, Cedric Greevey wrote: > > Where are these costs coming from? ... > > To get professional results, you need more than a camera > on a tripod. For example, someone has to: > > * keep t

Re: Concurrency and custom types.

2013-03-24 Thread Cedric Greevey
On Sun, Mar 24, 2013 at 6:59 PM, Andy Fingerhut wrote: > > > On Sun, Mar 24, 2013 at 11:04 AM, Jim - FooBar(); wrote: > >> On 24/03/13 17:49, Shantanu Kumar wrote: >> >>> In this case, making the type immutable is probably encouraged but not >>> mandatory >>> >> >> yes true, it's not enforced or a

Re: Clojure/West 2013 videos?

2013-03-24 Thread Cedric Greevey
On Sun, Mar 24, 2013 at 7:23 PM, Alex Miller wrote: > I have done a fair amount of polling on this for Strange Loop and it's > problematic. > > - there are a small number of interested people which thus requires high > per-person prices for videos (higher than you think - Strata video > compilati

Re: doing a Google search from Clojure?

2013-03-22 Thread Cedric Greevey
Change your code to it spoofs a common browser user-agent, change your DHCP-assigned IP address, and try again. They're probably trying to obstruct bots from making overwhelming numbers of requests or something. As long as you don't flood them with requests at a higher rate than a human would gener

Re: question about clojure.lang.LazySeq.toString()

2013-03-21 Thread Cedric Greevey
at 2:37 AM, Cedric Greevey wrote: > Hrm. Sounds like getting the hash of an infinite sequence will hang or > cause OOME. > > On the one hand, *most* uses of the hash are followed by .equals if the > hashes match, and .equals on an infinite seq can't work, since if it gives &g

Re: question about clojure.lang.LazySeq.toString()

2013-03-21 Thread Cedric Greevey
Hrm. Sounds like getting the hash of an infinite sequence will hang or cause OOME. On the one hand, *most* uses of the hash are followed by .equals if the hashes match, and .equals on an infinite seq can't work, since if it gives up and says "equal" after some large number N of elements, the seqs

Re: Exception propagation design in Clojure web APIs.

2013-03-20 Thread Cedric Greevey
It will if you use set! to update the binding. On Wed, Mar 20, 2013 at 1:00 PM, Marko Topolnik wrote: > On Wednesday, March 20, 2013 5:51:59 PM UTC+1, Julien Dreux wrote: > >> Thank you all for your answers, >> >> I like Marko's approach. >> >> What I had in mind, related to OP's post, would be

Re: set!

2013-03-13 Thread Cedric Greevey
Again, those are already given bindings. Think of it as if somewhere there's (binding [*unchecked-math* false] (loop [] (do-repl-stuff!) (recur))). As for "intended for uses other than working at the REPL", they still tend to be compile/macroexpansion-time uses, and presumably dynamic bindings exi

Re: set!

2013-03-13 Thread Cedric Greevey
To expand on what Marko said, the set!able Vars that come with Clojure just have thread-local bindings created already in the REPL thread. They're really only meant to aid developers working at the REPL, rather than to be set! as part of normal running code. On Wed, Mar 13, 2013 at 5:06 PM, Marko

Re: Improving visibility of clojure-doc.org

2013-03-11 Thread Cedric Greevey
If one of those is that Clojure documentation site that has a paywall, I object unless the merged site has no paywall. Official and officially-endorsed documentation for open source software should not be behind a paywall. On Tue, Mar 12, 2013 at 1:47 AM, kinleyd wrote: > I also found clojure-d

Re: Slow image convolution

2012-11-10 Thread Cedric Greevey
On Fri, Nov 9, 2012 at 11:57 AM, Yakovlev Roman wrote: > what a mess if it is a function it's huuge did you try split it to useful > chunks ? it's just unreadable and that's why you cann't spot anything i > guess.. > I can't split it without ending up with boxing at the function call boundaries,

Re: transient/persistent! not worth for less than 7-8 operations

2012-11-09 Thread Cedric Greevey
ot to agree with that! > > Jim > > > > On 09/11/12 15:09, Cedric Greevey wrote: > >> In the real world, it's more complicated than that, and N could end up >> not only depending on which transient operations and on vector vs. map but >> even on details of

Re: transient/persistent! not worth for less than 7-8 operations

2012-11-09 Thread Cedric Greevey
It stands to reason that transients won't help given a small number of operations. Consider a simplified model where conversion to transient and, eventually, back to persistent takes a constant number of cycles T and every operation on a transient takes exactly d cycles less than the corresponding

Re: Slow image convolution

2012-11-08 Thread Cedric Greevey
minutes with only the arithmetic left in the loop. Either something's getting boxed or it's the trig calls. On Thu, Nov 8, 2012 at 8:18 PM, Cedric Greevey wrote: > (rand) is expensive -- removing the two (rand)s knocks about 40 seconds > off it, nearly 1/5 the total time. I'

Re: Slow image convolution

2012-11-08 Thread Cedric Greevey
(rand) is expensive -- removing the two (rand)s knocks about 40 seconds off it, nearly 1/5 the total time. I'll try replacing them with lookup from a precalculated grid of randoms -- long-range correlations shouldn't matter here. On Thu, Nov 8, 2012 at 8:00 PM, Cedric Greevey wrote:

Re: Slow image convolution

2012-11-08 Thread Cedric Greevey
On Thu, Nov 8, 2012 at 3:48 PM, Cedric Greevey wrote: > I have the following code to perform a complicated image convolution. It > takes 10-15 seconds with output dimensions 256x256 and samples 6. No > reflection warnings, and using unchecked math doesn't speed it up any. I'v

How does one make BigDecimals contagious over doubles, instead of the other way around, in a particular computation?

2012-06-25 Thread Cedric Greevey
How does one make BigDecimals contagious over doubles, instead of the other way around, in a particular computation? I can see the reasoning for making doubles preferred by default: once an operation combines a double with a BigDecimal, the additional BigDecimal precision is consumed by the magnitu

Re: Buggy FP behavior with Clojure 1.3

2012-06-25 Thread Cedric Greevey
On Tue, Jun 26, 2012 at 1:30 AM, dennis zhuang wrote: > Added a postfix "M" to make the number as BigDecimal or "N" as a BigInteger: That doesn't work here. It's not double literals that are the problem, but computed values that are coming out as doubles. Furthermore, I'd like the code to use Big

Re: Buggy FP behavior with Clojure 1.3

2012-06-25 Thread Cedric Greevey
On Tue, Jun 26, 2012 at 1:11 AM, Sean Corfield wrote: > On Mon, Jun 25, 2012 at 9:19 PM, Cedric Greevey wrote: >> user=> 1e309 >> Infinity > > FWIW, on 1.4.0 I get: > > user=> 1e309 > CompilerException java.lang.RuntimeException: Unable to resolve > symb

Buggy FP behavior with Clojure 1.3

2012-06-25 Thread Cedric Greevey
user=> 1e308 1.0E308 user=> (* 10.0 1e308) Infinity user=> 1e309 Infinity Whuh? Double precision exponents should go up to 1023 and single precision shouldn't go above 127. There's no floating point format in commonplace use that maxes out its exponent at 308. What is going on here? -- You re

Re: Parallel doseq?

2012-05-27 Thread Cedric Greevey
On Sun, May 27, 2012 at 2:52 AM, Cedric Greevey wrote: > I noticed with the working pdoseq I posted earlier that sometimes the > threads on one core get ahead of those on the others, for some reason, > and then that core is idle for the rest of a job -- Windows, at least, > doe

Re: Parallel doseq?

2012-05-26 Thread Cedric Greevey
I noticed with the working pdoseq I posted earlier that sometimes the threads on one core get ahead of those on the others, for some reason, and then that core is idle for the rest of a job -- Windows, at least, doesn't seem to reassign one or more threads to the freed core. So I wrote this version

Re: Parallel doseq?

2012-05-24 Thread Cedric Greevey
Sorry. *Something* is apparently messing with my outbound messages. I'm not sure what, why, or how. Characters are moved or substituted at random times, sometimes with unfortunate results. Meanwhile, I had tried using pcalls as well but was getting spurious behavior. I wound up with: (defmacro pd

Re: Unable to pass unboxed primitive to methods taking multiple numeric primitive types.

2012-05-24 Thread Cedric Greevey
On Thu, May 24, 2012 at 10:34 AM, Armando Blancas wrote: > Didn't you see that I pasted my sample from the repl? I saw that you wrote it in the style of a repl interaction, which could have been pasted or could have been synthesized by hand. Given that in the former case it should have been easy

Re: Unable to pass unboxed primitive to methods taking multiple numeric primitive types.

2012-05-24 Thread Cedric Greevey
On Thu, May 24, 2012 at 6:16 AM, John Szakmeister wrote: > On Wed, May 23, 2012 at 7:58 PM, Cedric Greevey wrote: >> (defn f [^java.awt.image.BufferedImage bi x] >>  (.setSample (.getRaster bi) 0 0 0 (double x))) >> #> matching method found: setSample, compiling:(NO_S

Re: Parallel doseq?

2012-05-24 Thread Cedric Greevey
On Thu, May 24, 2012 at 3:00 AM, Sean Corfield wrote: > On Wed, May 23, 2012 at 11:37 PM, Cedric Greevey wrote: >> Replacing (range 10) with (take 10 (iterate inc 0)) didn't change >> anything. It's still not parallelizing. > > My point was that when you replace

Re: Parallel doseq?

2012-05-23 Thread Cedric Greevey
Replacing (range 10) with (take 10 (iterate inc 0)) didn't change anything. It's still not parallelizing. I need it to parallelize even for low-length sequences because the individual elements may be expensive and there may be few of them. -- You received this message because you are subscribed

Parallel doseq?

2012-05-23 Thread Cedric Greevey
For some reason, this doesn't actually seem to be executing in parallel: (defmacro pdoseq "Bindings as for for, but parallel execution as per pmap, pcalls, pvalues; returns nil." [seq-exprs & body] `(do (doall (pmap identity (for ~seq-exprs (do ~@body))) nil)

Re: Unable to pass unboxed primitive to methods taking multiple numeric primitive types.

2012-05-23 Thread Cedric Greevey
On Wed, May 23, 2012 at 10:21 PM, Armando Blancas wrote: > Is this any better? > > user=> (defn f [^java.awt.image.BufferedImage bi x] >   (.setData (.getRaster bi) 0 0 0 ^double x)) > #'user/f Didn't have a repl handy? It's quick to check that it produces: Reflection warning, NO_SOURCE_PATH:2 -

Unable to pass unboxed primitive to methods taking multiple numeric primitive types.

2012-05-23 Thread Cedric Greevey
(defn f [^java.awt.image.BufferedImage bi x] (.setSample (.getRaster bi) 0 0 0 (double x))) # The only way I was able to find to fix this is (defn f [^java.awt.image.BufferedImage bi] (.setSample (.getRaster bi) 0 0 0 ^Double (double x))) which presumably forces x to be boxed and unboxed aga

Re: Help with #'

2012-04-23 Thread Cedric Greevey
On Mon, Apr 23, 2012 at 3:02 PM, David Simmons wrote: > Cedric - apologies - fat fingers on my mobile phone!! More likely, tiny keys. (Though how that generated a meaningful English sentence that just happened to be completely off topic, I don't know!) > To both Cedric and Meikel - thank you bot

Re: Help with #'

2012-04-23 Thread Cedric Greevey
On Mon, Apr 23, 2012 at 2:32 PM, shortlypor...@googlemail.com wrote: [in reply to my confirmation that vars referencing vars referencing functions are still callable as functions] > Sent from my HTC Beg pardon? -- You received this message because you are subscribed to the Google Groups "Cloj

Re: Help with #'

2012-04-23 Thread Cedric Greevey
On Mon, Apr 23, 2012 at 8:36 AM, Tassilo Horn wrote: > It seems that Clojure dereferences Var's automatically, possibly multiple > times, in case of function calls. Multiple times confirmed: user=> (defn foo [] "Boo!") #'user/foo user=> (type foo) user$foo user=> (def bar #'foo) #'user/bar user=

Re: Macros to help writing closures?

2012-04-22 Thread Cedric Greevey
On Sun, Apr 22, 2012 at 5:42 PM, timc wrote: > I often write functions like this: > > (defn foobar [] >   (let [log (makeLogger "foobar")] >     blah blah )) > > where makeLogger returns a logging function that prefixes all messages with > the name provided. > > It looks as though macros don'

Re: a library I'm working on for generating PDFs from Clojure

2012-04-22 Thread Cedric Greevey
On Sun, Apr 22, 2012 at 3:33 AM, David Jagoe wrote: > > On 21 April 2012 14:41, Dan Cross wrote: >> >> On Sat, Apr 21, 2012 at 6:20 AM, David Jagoe wrote: >> > Can anybody tell me whether wkhtmltopdf or flying-saucer deal with >> > pagination properly? I've been templating TeX to get properly la

Re: Macros to help writing closures?

2012-04-21 Thread Cedric Greevey
On Sat, Apr 21, 2012 at 11:27 AM, timc wrote: > Hello > > I am a beginner when it comes to writing macros, so there may be an easy way > to do this. > I have a number of 'state machines' which have this sort of appearance: > > (defn startFSM [eventQ] >   (let [state (atom :1) > going (ato

Re: [ANN] Finger trees in Clojurescript

2012-04-20 Thread Cedric Greevey
On Fri, Apr 20, 2012 at 8:13 AM, Chris Houser wrote: > Cool > > --Chouser > Laboriously typed on my mobile device. You really need a better "mobile device" if typing a four-letter message is "laborious". ;) -- You received this message because you are subscribed to the Google Groups "Clojure" g

Re: question about a macro

2012-04-20 Thread Cedric Greevey
On Thu, Apr 19, 2012 at 7:28 AM, Thomas wrote: > Hi, > > I'd like to write a macro which transforms > > (my-macro SomeClass. a b [x y] c [e f]) > > into > > (SomeClass. a b x y c e f) > > (the order of collections and single values in the arguments should be > arbitrary) > > The closest I came was

Re: Treatment of nil/null in a statically typed Clojure

2012-04-19 Thread Cedric Greevey
On Thu, Apr 19, 2012 at 2:46 PM, Ambrose Bonnaire-Sergeant wrote: > Hi, > > I've been doing some thinking about the treatment of nil in a > statically typed version of Clojure. > > It occurs to me that nil is significantly different to Java's null > reference, which > is almost a Bottom type. > >

Re: Clojure 1.4.0 released silently?

2012-04-17 Thread Cedric Greevey
On Tue, Apr 17, 2012 at 10:09 AM, Tim Visher wrote: > I saw quite a few announcements but they were all on twitter. Not sure > what it appears that it wasn't announced on the list. According to a colleague of mine, it was also announced on Facebook. My guess is it's been announced here, but Gigg

Re: Accessing defrecord from another namespace

2012-04-16 Thread Cedric Greevey
On Mon, Apr 16, 2012 at 7:30 PM, Adam Markham wrote: > I actually made an error when typing the code out in my message, so I > had no 'ns' in front of the namespace name. The issue was as you said > Mark I used hyphens but they needed to be underscores. I went into the > project classes folder and

Re: question about partial

2012-04-16 Thread Cedric Greevey
(-> 3 ((partial f 2))) should also work. -- 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 unsubsc

Re: Boolean

2012-04-13 Thread Cedric Greevey
What of the original issue, that deserializing a large nested datastructure with boxed booleans in it results in misbehaving Boolean "false" instances? -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@google

Re: == is not always transitive

2012-04-11 Thread Cedric Greevey
IME, it's almost never useful to perform equality tests on floating point values. Generally you want to know if they're near enough to one another without necessarily being exactly equal. For that something like (defn f= [f1 f2 threshold] (< (Math/abs (- f1 f2)) threshold)) is probably the sort of

Re: Subtle differences in quoted and backquoted forms

2012-04-11 Thread Cedric Greevey
On Wed, Apr 11, 2012 at 3:56 AM, Alex Shabanov wrote: > Here is the quick clojure sample: > > user=> (def p1 `(or a b)) > #'user/p1 > user=> (def p2 '(or a b)) > #'user/p2 > user=> (= (first p1) 'or) > false > user=> (= (first p2) 'or) > true > > At the same time this seems unique to clojure as th

Re: seeking a lazy way to interleave a constant

2012-04-09 Thread Cedric Greevey
On Mon, Apr 9, 2012 at 10:31 PM, Andrew wrote: > Given a lazy sequence of numbers is there a way to interleave a constant and > get another lazy sequence? Say the first sequence is 1 2 3 4 ... I'd like > the second sequence to be 1 0 2 0 3 0 4 0 > > Thanks in advance! user=> (interpose 0 [1

Re: Boolean

2012-04-08 Thread Cedric Greevey
I'd mostly be inclined to accept this quirk as odd and easily-avoidable behavior (just don't use (Boolean. false)) except that, according to the OP, serializing and deserializing an object with internal booleans can also cause a problem. Sure, they round-trip through prn/read properly, but Clojure

Re: Advice on style & implementation

2012-04-07 Thread Cedric Greevey
On Wed, Apr 4, 2012 at 4:11 PM, Alan Malloy wrote: > On Apr 4, 6:50 am, David Jagoe wrote: >> Particularly I very often find myself doing >> >> (apply hash-map (flatten (for [[k v] some-map] ...))) > > :( :( :( flatten is vile, never use it[1]. What if the value in the > map is a list, or the key

Re: Help with this error and comment.

2012-04-03 Thread Cedric Greevey
On Tue, Apr 3, 2012 at 11:39 PM, uMany wrote: > Hi everybody > Everything was working great and just today, while trying to make a simple > "lein new foobar" I got this error: > Exception in thread "main" java.lang.IllegalAccessError: render does not > exist (default.clj:1) The JVM is loading an

Re: Source code as metadata

2012-03-30 Thread Cedric Greevey
On Fri, Mar 30, 2012 at 6:17 PM, Lee Spector wrote: > > On Mar 30, 2012, at 5:11 PM, Cedric Greevey wrote: >> >> That opens a giant can of worms. How, for example, do we discover that >> (partial * 2) and #(* % 2) and (fn [x] (* 2 x)) and #(+ %1 %1) are all >> equ

Re: Source code as metadata

2012-03-30 Thread Cedric Greevey
2012/3/30 Vinzent : > Counter-example: one could write if-authenticated macro, which will take > fixed number of args, but should be indented as normal if. OK, check the macro structure to see if any args are incorporated as invokable forms -- so, in arguments in special forms and macros that are

Re: Source code as metadata

2012-03-30 Thread Cedric Greevey
On Fri, Mar 30, 2012 at 2:48 PM, Nathan Matthews wrote: > Also it bothers me that > > (= (partial * 2) (partial * 2)) > > is false. Logically it shouldn't be right?  If we captured the function > forms, that would enable better equality for functions. That opens a giant can of worms. How, for ex

Re: Source code as metadata

2012-03-30 Thread Cedric Greevey
On Fri, Mar 30, 2012 at 1:26 PM, Vinzent wrote: > Another idea is to put :indentation metadata on vars, so user-defined macros > could be indented properly. Currently I have (define-clojure-indent ...) > with a number of forms in my emacs config file, and it seems to be pretty > common solution. I

Re: Cheap way to find function (defn) name using a macro?

2012-03-30 Thread Cedric Greevey
On Thu, Mar 29, 2012 at 11:59 PM, Shantanu Kumar wrote: > The change needs to be least intrusive and doesn't justify exposing > more surface area than it should. It's a trade off. Injecting a version of defn that doesn't do anything different except make a new thing available inside the function

Re: partition-distinct

2012-03-29 Thread Cedric Greevey
On Thu, Mar 29, 2012 at 4:18 PM, David Jagoe wrote: > Hi all, > > I'm sure I'm missing a really simple way of doing this! > > Given a sequence like this: [1 2 1 2 1 1 2 1 2 2 2] > > partition it to get this: [(1 2) (1 2) (1) (1 2) (1 2) (2) (2)] > > I've been trying to write something generic like

Re: Cheap way to find function (defn) name using a macro?

2012-03-29 Thread Cedric Greevey
On Thu, Mar 29, 2012 at 2:36 PM, Shantanu Kumar wrote: >> 81  (defn foo [...] >> 82    (let [x (compute-something ...)] >> 83      (do-something x ...) >> 84      (calculate-whatever ...))) >> >> and you're able to edit lines 82, 83, and 84 but not line 81 (or >> whatever). But I can't see any pla

Re: Using the Clojure Logo

2012-03-29 Thread Cedric Greevey
On Thu, Mar 29, 2012 at 1:10 PM, Stuart Sierra wrote: > Rich's request is that people not use the logo for purposes other than to > represent the Clojure language. How does he define "represent the Clojure language"? Just that its use, in a particular instance, is to refer to Clojure? -- You re

Re: Using the Clojure Logo

2012-03-29 Thread Cedric Greevey
On Thu, Mar 29, 2012 at 1:07 PM, Daniel Gagnon wrote: >> First of all, one only has to police unauthorized use of the >> trademark. One can authorize its use under particular circumstances, >> and then those uses don't need to be policed to avoid losing the >> trademark. > > That's at the heart of

Re: Cheap way to find function (defn) name using a macro?

2012-03-29 Thread Cedric Greevey
On Thu, Mar 29, 2012 at 11:35 AM, Shantanu Kumar wrote: > > > On Mar 29, 5:50 pm, Cedric Greevey wrote: >> On Wed, Mar 28, 2012 at 11:48 PM, Shantanu Kumar >> >> wrote: >> >> If you control the third line of: >> >> >> (defn foo [x y] >

Re: Cheap way to find function (defn) name using a macro?

2012-03-29 Thread Cedric Greevey
On Wed, Mar 28, 2012 at 11:48 PM, Shantanu Kumar wrote: >> If you control the third line of: >> >> (defn foo [x y] >>   (let [z (bar y (next x))] >>     (println "Done in " (find-name) ".") >>     (* 4 z (count x >> >> then don't you control the first? > > Cedric – Unfortunately, no. The targe

Re: SubVec anomaly

2012-03-29 Thread Cedric Greevey
On Thu, Mar 29, 2012 at 5:15 AM, stirfoo wrote: > > user=> (nth (subvec [:??? 1 2] 1) -1) > :??? > > This could be a bug, not sure. > > Only the upper bound of the internal SubVec is being checked. Hmm. This also raises the specter of (let [a (some-very-large-vector-with-millions-of-elements)

Re: Cheap way to find function (defn) name using a macro?

2012-03-28 Thread Cedric Greevey
On Wed, Mar 28, 2012 at 10:58 PM, Shantanu Kumar wrote: > Rostislav and Cedric – I cannot supply my own version of defn; the > macro should work with the regular clojure.core/defn. If you control the third line of: (defn foo [x y] (let [z (bar y (next x))] (println "Done in " (find-name) "

Re: Polymorphic namespaces?

2012-03-28 Thread Cedric Greevey
On Wed, Mar 28, 2012 at 8:46 PM, Chris McBride wrote: > I'm not trying to do anything in particular. I do OO programming at work and > it's been pounded in my head that loose coupling is better than gift > coupling. I've found it useful on a few occasions. One example, in the > frontend we wrap

Re: motivation behind laziness of apply in ClojureScript

2012-03-28 Thread Cedric Greevey
On Wed, Mar 28, 2012 at 7:16 PM, Timothy Baldridge wrote: > "May be delayed" > > But I don't think they ever are: > > user=> (def oddseq (map #(do (print %) %) (range 30))) > #'user/oddseq > > user=> (defn foo [& args] 'd) > #'user/foo > > user=> (apply foo oddseq) > 012345678910111213141516171819

Re: motivation behind laziness of apply in ClojureScript

2012-03-28 Thread Cedric Greevey
On Wed, Mar 28, 2012 at 8:32 PM, Nathan Sorenson wrote: > >> I don't think it's possible to ever have apply not evaluate all its >> arguments? I think this is what Nathan was saying. > > Cedric is right that apply, itself, is strict and evaluates its arguments as > one might expect. But I'm not re

Re: Alternate set literal syntax?

2012-03-28 Thread Cedric Greevey
On Wed, Mar 28, 2012 at 7:36 PM, Timothy Baldridge wrote: > "not-unreasonable because otherwise people > will acquire a negative opinion of me." > > On the contrary...I find that people who admit that their "cool idea > after further thought probably isn't so cool" garner better respect > from the

Re: Alternate set literal syntax?

2012-03-28 Thread Cedric Greevey
On Wed, Mar 28, 2012 at 3:56 PM, Devin Walters wrote: > We have: '(), [], {}, #{} Not quite. '() isn't strictly analogous to #{}, because quote suppresses evaluation of what's inside. user=> (def foo 42) #'user/foo user=> (for [x ['(foo) [foo] {:a foo} #{foo}]] (println x)) (foo) [42]

Re: Cheap way to find function (defn) name using a macro?

2012-03-28 Thread Cedric Greevey
On Wed, Mar 28, 2012 at 3:30 PM, Rostislav Svoboda wrote: >> Steve – Your example is already compact, but maybe it can be made even >> cheaper by specifying maxDepth of 1: >> http://docs.oracle.com/javase/6/docs/api/java/lang/management/ThreadMXBean.html#getThreadInfo(long, >> int) > > @Shantanu:

Re: Using the Clojure Logo

2012-03-28 Thread Cedric Greevey
On Wed, Mar 28, 2012 at 2:32 PM, Daniel Gagnon wrote: > On Wed, Mar 28, 2012 at 1:40 PM, Chip Collier wrote: >> >> I was also intending on using the logo in such a way to communicate that >> a site I'm building is "powered by clojure" or something to that effect >> with a link to clojure.org. Is

Re: motivation behind laziness of apply in ClojureScript

2012-03-28 Thread Cedric Greevey
On Wed, Mar 28, 2012 at 2:13 PM, Timothy Baldridge wrote: >>>is there a use case behind apply being lazy when Clojure is otherwise a >>>strictly evaluating language > > In clojure-py we have to pass vararg arguments as tuples. So it ends > up a lot like > > (to-tuple (concat args seqarg)) > > I a

Re: Alternate set literal syntax?

2012-03-27 Thread Cedric Greevey
On Tue, Mar 27, 2012 at 3:05 PM, Herwig Hochleitner wrote: > 2012/3/26 Cedric Greevey : >> (comp <{:k1 5 :k2 6}), that is not used in production whereas (comp < >> {:k1 5 :k2 6}) (note spacing) is used in production but isn't broken. > > (comp <{:k1 5 :k2 6})

Re: can Clojure 1.3 code always be made as fast as Java for numeric computations?

2012-03-27 Thread Cedric Greevey
On Tue, Mar 27, 2012 at 5:28 PM, Armando Blancas wrote: > That's a distinction without a difference. I'm saying the host interop > overwhelms the cool stuff. That's the kind of code I find foolish to write > in product development. I don't advocate going back and forth to Java, but > when the host

Re: can Clojure 1.3 code always be made as fast as Java for numeric computations?

2012-03-27 Thread Cedric Greevey
On Mon, Mar 26, 2012 at 4:03 PM, Daniel Solano Gomez wrote: > On Mon Mar 26 15:15 2012, Cedric Greevey wrote: >> > What you're running into is the overhead of get the root value of vars >> > like swap! and move-up!.  The only way to avoid this is use something >> &

Re: Alternate set literal syntax?

2012-03-26 Thread Cedric Greevey
On Mon, Mar 26, 2012 at 3:22 PM, Devin Walters wrote: > Agree with Herwig 100%. That's rather odd, seeing as how Herwig didn't even participate in any reasoned debate in this thread; instead, he just threw a drive-by flame at me out of the blue and without provocation. > This conversation has be

Re: Alternate set literal syntax?

2012-03-26 Thread Cedric Greevey
On Mon, Mar 26, 2012 at 2:12 PM, Herwig Hochleitner wrote: > So to summarize: > > You suggest to > > a) Break expressions like (comp <{:k1 5 :k2 6}) or {{:foo 5} 4} which > are legal and therefore used in production; No. The first suggestion does not break {{:foo 5} 4}, which should have been cle

Re: can Clojure 1.3 code always be made as fast as Java for numeric computations?

2012-03-26 Thread Cedric Greevey
> What you're running into is the overhead of get the root value of vars > like swap! and move-up!.  The only way to avoid this is use something > like definline. I thought that in 1.3 those had been made much faster to access if they didn't have ^{:dynamic true} applied to them? -- You received

Re: Alternate set literal syntax?

2012-03-26 Thread Cedric Greevey
On Mon, Mar 26, 2012 at 5:29 AM, Ambrose Bonnaire-Sergeant wrote: > I will continue the debate with more class. Thank you. >>> Isn't this just another way of saying "humans will have to read to the >>> end to see what the form is?" > > No, this is a way of saying the {{}} proposal is very unlike

Re: Alternate set literal syntax?

2012-03-25 Thread Cedric Greevey
On Mon, Mar 26, 2012 at 12:45 AM, Ambrose Bonnaire-Sergeant wrote: > On Mon, Mar 26, 2012 at 12:22 PM, Cedric Greevey wrote: >> Isn't this just another way of saying "humans will have to read to the >> end to see what the form is?" I provided a response to that

Re: Alternate set literal syntax?

2012-03-25 Thread Cedric Greevey
On Sun, Mar 25, 2012 at 11:59 PM, Ambrose Bonnaire-Sergeant wrote: > On Mon, Mar 26, 2012 at 11:46 AM, Cedric Greevey wrote: >> >> So ... any further objections, other than "it's unlikely anyone cares >> enough to bother actually making such a change"? :) >

Re: core.logic now runs under ClojureScript

2012-03-25 Thread Cedric Greevey
On Sun, Mar 25, 2012 at 11:36 PM, Devin Walters wrote: > (inc 100) > > Well done, gents. 101? Or maybe you meant (partial + 100). :) -- 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

Re: Alternate set literal syntax?

2012-03-25 Thread Cedric Greevey
Embarrassingly, it took this long for me to realize there's a much tidier way to alter the reader: Where the exception throw is for map literals with odd numbers of key-or-value items, wrap the throw in a check that counts the number of additional consecutive } tokens, stopping when it hits a non-

Re: Alternate set literal syntax?

2012-03-25 Thread Cedric Greevey
On Sun, Mar 25, 2012 at 8:36 PM, Cedric Greevey wrote: > How often do we get "What are the differences among 100, 0144, and > 0x64, and which should I use when?" ;) Nevermind: #^{:foo 42} thingy vs. ^{:foo 42} thingy; (deref foo) vs. @foo; #'bar vs. (var bar); #(+ %2 (

Re: Alternate set literal syntax?

2012-03-25 Thread Cedric Greevey
On Sun, Mar 25, 2012 at 5:24 PM, Evan Mezeske wrote: > Is there anything I could do with Clojure with an aesthetically different > (but functionally identical ) set notation that I cannot do with Clojure > right now? Attract 0.7 more people per 1000 on average to adopt the language, perhaps. :)

Re: Alternate set literal syntax?

2012-03-25 Thread Cedric Greevey
On the contrary, discussing ideas relevant to Clojure is quite on topic here. Once again: if *you* find this thread useless or uninteresting, *you* can safely ignore it, but telling everyone else what to discuss and what not to discuss (when they're not straying from the list's official topic too

Re: New(er) Clojure cheatsheet hot off the presses

2012-03-25 Thread Cedric Greevey
On Sun, Mar 25, 2012 at 2:59 AM, Andy Fingerhut wrote: > I've tried again using links with doc strings as the values of the title > attribute, but when the text in Firefox 11.0 it does not honor the line > breaks in my text, but reflows it.  Try it out yourself at [1]: > > [1] > http://homepage

Re: 'contains?' on 'sorted-set-by' based on the comparator only? (possible bug?)

2012-03-24 Thread Cedric Greevey
On Sat, Mar 24, 2012 at 9:39 PM, Cedric Greevey wrote: > In increasing order of difficulty... > > Option 1: > > Extend your comparator to sort first on the key you're actually > interested in, then if that key isn't different on the others > more-or-less arbitrari

Re: Alternate set literal syntax?

2012-03-24 Thread Cedric Greevey
On Sat, Mar 24, 2012 at 6:38 PM, Scott Jaderholm wrote: > > Sorry to break it to you, but # is used in many places other than > lambdas, so even if you remove it from #{} you still have foo#, #^foo, > #^{foo bar}, #'foo, #"foo", #_foo, #foo{1 2}, #foo[1 2], and others > I've probably forgotten. I

Re: Alternate set literal syntax?

2012-03-24 Thread Cedric Greevey
On Sat, Mar 24, 2012 at 3:46 PM, Softaddicts wrote: > Hey, we all have our rough edges :) > > I'm 50, there's less life in front of me than behind. Debating about the sex > of > angels looks to me a bad way of using the not so many hours left in our lives > on significant problems before the fina

Re: 'contains?' on 'sorted-set-by' based on the comparator only? (possible bug?)

2012-03-24 Thread Cedric Greevey
In increasing order of difficulty... Option 1: Extend your comparator to sort first on the key you're actually interested in, then if that key isn't different on the others more-or-less arbitrarily. Option 2: Keep the data unsorted in a hash-set. Sort when you need sorted data, e.g. for user pr

Re: New(er) Clojure cheatsheet hot off the presses

2012-03-24 Thread Cedric Greevey
On Fri, Mar 23, 2012 at 4:43 PM, David Martin wrote: > I agree that title attribute is the way to go. You shouldn't use the alt > attribute for tooltips though, as this violates accessibility standards. Alt > should either contain a literal description of the image, or be left empty. Be sure to t

Re: Alternate set literal syntax?

2012-03-24 Thread Cedric Greevey
On Sat, Mar 24, 2012 at 1:28 AM, Sean Corfield wrote: > On Fri, Mar 23, 2012 at 8:44 PM, Cedric Greevey wrote: >> #{foo bar baz} is somewhat ugly. It occurs to me that one could modify >> the reader to additionally accept >> >> {{foo bar baz}} > > My concern

Alternate set literal syntax?

2012-03-23 Thread Cedric Greevey
#{foo bar baz} is somewhat ugly. It occurs to me that one could modify the reader to additionally accept {{foo bar baz}} without breaking anything. It's not possible for it to be a valid map literal, because the outer {...} pair has only one object inside it and a map literal requires an even num

Re: revisiting community funding?

2012-03-23 Thread Cedric Greevey
On Fri, Mar 23, 2012 at 7:35 PM, nchurch wrote: > I like BernardH's idea of doing it anonymously; if nobody from Core > minds, we could set up an anonymous survey to see how much interest > there is. > > cej38, your suggestions are very soundpersonally, I would love to > see curated, distilled

Re: New(er) Clojure cheatsheet hot off the presses

2012-03-23 Thread Cedric Greevey
On Fri, Mar 23, 2012 at 4:49 PM, Andy Fingerhut wrote: > I'm not putting the Declaration of Independence in the tooltips, but the > Clojure doc strings, with the same text width as they appear in the original, > which is nearly 80 characters wide. I'd suggest not using the full docstring, but som

Re: New(er) Clojure cheatsheet hot off the presses

2012-03-23 Thread Cedric Greevey
On Fri, Mar 23, 2012 at 3:57 PM, Andy Fingerhut wrote: > Thanks for the suggestions, folks. > > Cedric, have you tried your method before?  I'm not sure, but I think it was > the thing that I tried that led me to add (b) to my list of preference.  I > like anything that makes the development job e

Re: New(er) Clojure cheatsheet hot off the presses

2012-03-23 Thread Cedric Greevey
On Fri, Mar 23, 2012 at 10:58 AM, Andy Fingerhut wrote: > I definitely like the tooltip idea.  I like it so much that I've already > played with it a bit, looking at several web pages with instructions for how > to do it, but my knowledge of good ways to do this is zero except for the > results

Re: removing a hash-map from a set using hash-map's field.

2012-03-22 Thread Cedric Greevey
On Thu, Mar 22, 2012 at 10:32 PM, Cedric Greevey wrote: (into #{} (remove #(= (:id %) foo) input-set)) > You could stop when :id foo got hit by using a loop/recur, and save half the > iterations on average. Clarification: stop comparing to match the :id key against the target. You

Re: removing a hash-map from a set using hash-map's field.

2012-03-22 Thread Cedric Greevey
On Wed, Mar 21, 2012 at 5:00 PM, Leandro Oliveira wrote: > Hi all, > > I have a set of hash like this: > > #{{:id 1, :foo "bar"} {:id 2, :foo "car"}} > > and I'd like to remove an item based on its id value. > > Unfortunately, disj requires that I pass the whole map as key to remove it. > > Can I

<    1   2   3   4   5   6   >