Re: math

2012-10-09 Thread Mark Engelberg
On Tue, Oct 9, 2012 at 9:03 PM, kovas boguta wrote: > The reality is that the function names and signatures are often > totally different. Just switching the namespaces ain't gonna work. > These are basically new libraries, that are thematically similar to > the old ones. > > The math library has

Re: math

2012-10-09 Thread Sean Corfield
On Tue, Oct 9, 2012 at 9:43 PM, kovas boguta wrote: > Actually all the examples I had in mind where from 1.2 (I migrated > from 1.1 so it all seemed part of a piece to me) > I think the migration from 1.2 to 1.3 is better documented than the migration from 1.1 to 1.2... > So should we expect t

Re: math

2012-10-09 Thread kovas boguta
Alright, you got me on that one. Actually all the examples I had in mind where from 1.2 (I migrated from 1.1 so it all seemed part of a piece to me) So should we expect the function and their signatures to be the same then? On Wed, Oct 10, 2012 at 12:34 AM, Sean Corfield wrote: > On Tue, Oct 9

Re: What is this function?

2012-10-09 Thread Larry Travis
Pursuing the thinking behind my original comment, I challenged myself to see how many ways I could write a function equivalent to list* without using _spread_ (assuming I had the full Clojure API available to me -- which, of course, the author of list* did not have). Here are four ways: *(def

Re: math

2012-10-09 Thread Sean Corfield
On Tue, Oct 9, 2012 at 9:23 PM, kovas boguta wrote: > The one that bit me specifically was clojure.contrib.string => > clojure.string . Not criticising the new design, its just a fact that > its not backwards compatible. > I believe that happened in Clojure 1.2, even before monolithic contrib wa

Re: math

2012-10-09 Thread Sean Corfield
On Tue, Oct 9, 2012 at 9:22 PM, Brian Craft wrote: > Top hits on google. "clojure math floor", top three hits are contrib docs. > Thanx. I Googled that phrased and the first result was the old richhickey repo. We should be able to get that fixed - or at least a notice added linking to the new co

Re: math

2012-10-09 Thread kovas boguta
The one that bit me specifically was clojure.contrib.string => clojure.string . Not criticising the new design, its just a fact that its not backwards compatible. Anyway the point is: we should make clear that this isn't a 1-to-1 migration. 50% (or even 90%) compatibility is not the same as 100%.

Re: math

2012-10-09 Thread Brian Craft
On Tuesday, October 9, 2012 8:35:28 PM UTC-7, Sean Corfield wrote: > > What would help us is knowing what path you took in looking for > information about the math functions that led you to old contrib... so we > can make adjustments to what documentation is out there to make the new > structu

Re: math

2012-10-09 Thread Sean Corfield
On Tue, Oct 9, 2012 at 9:03 PM, kovas boguta wrote: > Most of the time you are using the contrib for some convenience > function. Its way easier to just copy that function into your own > project, than to worry about tracking down the new library, and then > checking that the function in question

Re: math

2012-10-09 Thread kovas boguta
Honestly the best bet for migrating from old contrib: Find the old contrib on github, and just copy the function or 2 that you want. Anything else is gonna be a frustrating PITA. Its highly misleading to say that the old contrib was broken up to be more modular. The reality is that the function

Re: math

2012-10-09 Thread Sean Corfield
On Tue, Oct 9, 2012 at 7:38 PM, Brian Craft wrote: > I need some basic math functions, e.g. floor. I see there are some in > contrib, but I'm unable to figure out the status of contrib. Seems like > it's deprecated, or in transition, or something? Back with Clojure 1.3, the old monolithic contr

Re: Clojurejs: a lightweight clojure to javascript compiler

2012-10-09 Thread Hoàng Minh Thắng
On Monday, October 8, 2012 9:09:49 PM UTC+7, Jim foo.bar wrote: > > On 08/10/12 14:47, Mark Rathwell wrote: > > ClojureScript is a Clojure implementation that targets Javascript > > (meaning that Clojure core, et al, is also necessarily converted to > > Javascript in the build process and a pa

Re: math

2012-10-09 Thread Devin Walters
As long as we're talking about docs lately, I would like to underscore that the transition to modular contrib is still confusing to newcomers. Sorry to hijack the OP's thread, but I think this needs to be dealt with. Suggestions on how to make this more visible or negate the need for understandi

Re: math

2012-10-09 Thread Mark Engelberg
https://github.com/clojure/math.numeric-tower [org.clojure/math.numeric-tower "0.0.1"] On Tue, Oct 9, 2012 at 7:38 PM, Brian Craft wrote: > I need some basic math functions, e.g. floor. I see there are some in > contrib, but I'm unable to figure out the status of contrib. Seems like > it's de

math

2012-10-09 Thread Brian Craft
I need some basic math functions, e.g. floor. I see there are some in contrib, but I'm unable to figure out the status of contrib. Seems like it's deprecated, or in transition, or something? -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post t

Re: understanding 'binding' use in clojure.java.jdbc

2012-10-09 Thread Sean Corfield
On Tue, Oct 9, 2012 at 12:53 PM, Brian Craft wrote: > On Tuesday, October 9, 2012 12:11:28 PM UTC-7, Tassilo Horn wrote: > >> Yes, that's true. Maybe Korma [1] is better suited for this kind of >> operation. >> > Thanks for the link to korma. > Korma is built on c.j.jdbc and may suffer from the

Re: understanding 'binding' use in clojure.java.jdbc

2012-10-09 Thread Sean Corfield
No, the inner with-connection binds *db* to db1 so db2 is no longer accessible. This is why c.j.jdbc is getting an API overall that will expose functions that accept the connection or the db-spec directly (and the old API will be rewritten in terms of the new one for compatibility). Sean On Tue,

Re: adding clojure.test/assert-expr methods

2012-10-09 Thread Ryan Fowler
Thanks! It all works. Now I'm killing myself trying to figure out what the heck I was doing wrong. Ryan On Tuesday, October 9, 2012 7:44:06 PM UTC-5, Stuart Sierra wrote: > > clojure.test is weird (my fault) but I don't think it's that weird. > > Your 'defmethod' is correct, but it shouldn't ne

Re: adding clojure.test/assert-expr methods

2012-10-09 Thread Stuart Sierra
clojure.test is weird (my fault) but I don't think it's that weird. Your 'defmethod' is correct, but it shouldn't need the 'binding' around it. This works for me: user=> (require '[clojure.test :as t]) user=> (defmethod t/assert-expr 'fail [msg form] `(t/do-report {:type :fail :expected

adding clojure.test/assert-expr methods

2012-10-09 Thread Ryan Fowler
I'm trying to add some clojure.test/assert-expr methods to help with failure reporting and I can't find much information on the topic. I'm wondering if I'm on the right track. The only way I've been able to get it to work is if the defmethod happens with *ns* bound to 'clojure.test. The followi

Re: functional approach to algorithm

2012-10-09 Thread Brian Craft
:) Thanks On Tuesday, October 9, 2012 3:55:58 PM UTC-7, Ben wrote: > > user> (let [x '(a b c d e)] (map vector x (rest x))) > ([a b] [b c] [c d] [d e]) > > > On Tue, Oct 9, 2012 at 3:49 PM, Brian Craft > > wrote: > > I'm holding a list, say [a b c d e]. I need all the adjacent pairs, like >

Re: functional approach to algorithm

2012-10-09 Thread Jonathan Fischer Friberg
(partition 2 1 [a b c d e]) http://clojuredocs.org/clojure_core/clojure.core/partition On Wed, Oct 10, 2012 at 12:49 AM, Brian Craft wrote: > I'm holding a list, say [a b c d e]. I need all the adjacent pairs, like > [[a b] [b c] [c d] [d e]]. > > It's a bit like reduce, but I don't know how to

Re: What is this function?

2012-10-09 Thread Ben Wolfson
On Tue, Oct 9, 2012 at 10:33 AM, Tassilo Horn wrote: > Larry Travis writes: > >> and the definition of _list*_ seems to me to be complete without it. > > No. It makes > > (list* 1 2 3 4 5 [6 7] [8 9]) => (1 2 3 4 5 [6 7] 8 9) > > else it would result in (1 2 3 4 5 [6 7] [8 9]), i.e., it implem

Re: functional approach to algorithm

2012-10-09 Thread Ben Wolfson
user> (let [x '(a b c d e)] (map vector x (rest x))) ([a b] [b c] [c d] [d e]) On Tue, Oct 9, 2012 at 3:49 PM, Brian Craft wrote: > I'm holding a list, say [a b c d e]. I need all the adjacent pairs, like [[a > b] [b c] [c d] [d e]]. > > It's a bit like reduce, but I don't know how to accumulate

functional approach to algorithm

2012-10-09 Thread Brian Craft
I'm holding a list, say [a b c d e]. I need all the adjacent pairs, like [[a b] [b c] [c d] [d e]]. It's a bit like reduce, but I don't know how to accumulate the result with clojure's reduce. Anyone have a suggestion? -- You received this message because you are subscribed to the Google Group

Re: What is this function?

2012-10-09 Thread Larry Travis
Mark, Andy, Tassilo: Very helpful, gentlemen. You are kind and skillful tutors. Thank you much. --Larry -- 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 ar

Re: Parallelising reduce-kv

2012-10-09 Thread Jean Niklas L'orange
On Tuesday, October 9, 2012 9:14:51 PM UTC+2, Wolodja Wentland wrote: > > --- snip --- > (reduce-kv > (fn [ret k v] > (assoc ret k (func-that-does-something-with v))) > some-map)) > --- snip -- > > I am using reducers in other places, but am not entirely sure how to > employ > them her

Re: unexpected NaN behavior

2012-10-09 Thread Wes Freeman
I guess it really does do the same thing in Scala: scala> val f = Float.NaN f: Float = NaN scala> f == f res4: Boolean = false scala> f.equals(f) res5: Boolean = true I guess you really should use == in Clojure, when doing numerical equality. It even does dynamic typed comparisons better than =

Re: understanding 'binding' use in clojure.java.jdbc

2012-10-09 Thread gaz jones
Can you not simply: (jdbc/with-connection db2 (jdbc/with-query-results results query {:result-type :forward-only :fetch-size 1000} (jdbc/with-connection db1 ;; read and write? ))) ? On Tue, Oct 9, 2012 at 2:53 PM, Brian Craft wrote: > > On Tuesday, Oc

Re: unexpected NaN behavior

2012-10-09 Thread Brian Craft
On Tuesday, October 9, 2012 2:27:43 PM UTC-7, Aaron Cohen wrote: > > On Tue, Oct 9, 2012 at 5:20 PM, David Nolen > > > wrote: > > On Tue, Oct 9, 2012 at 4:38 PM, Brian Craft > > > > wrote: > >> Can someone explain the last result here? > >> > >>> [1 2 3 Float/NaN] > >> [1 2 3 NaN] > >>>

Re: unexpected NaN behavior

2012-10-09 Thread Aaron Cohen
On Tue, Oct 9, 2012 at 5:20 PM, David Nolen wrote: > On Tue, Oct 9, 2012 at 4:38 PM, Brian Craft wrote: >> Can someone explain the last result here? >> >>> [1 2 3 Float/NaN] >> [1 2 3 NaN] >>> (= Float/NaN Float/NaN) >> false This is a primitive comparison and follows IEEE floating point semanti

Re: unexpected NaN behavior

2012-10-09 Thread David Nolen
On Tue, Oct 9, 2012 at 4:38 PM, Brian Craft wrote: > Can someone explain the last result here? > >> [1 2 3 Float/NaN] > [1 2 3 NaN] >> (= Float/NaN Float/NaN) > false > (#(= Float/NaN Float/NaN)) > false > ; all is good so far, but... > (filter #(= % %) [1 2 3 Float/NaN 4]) > (1 2 3 NaN 4) > > Now

Re: unexpected NaN behavior

2012-10-09 Thread Michael Klishin
2012/10/10 Wes Freeman > Float/NaN must be instantiating something? See http://stackoverflow.com/a/1573715/1367685 and replies to it. NaN (and floating-point numbers in general) are tricky beasts. You get the same behavior in Scala and Java: scala> Float.NaN == Float.NaN res1: Boolean = false

Re: unexpected NaN behavior

2012-10-09 Thread Brian Craft
I every language I'm familiar with NaN tests unequal to all values, including itself. That's almost the definition of NaN. This looks like some kind of shortcut where clojure is not bothering to test equality of a symbol with itself. On Tuesday, October 9, 2012 1:48:54 PM UTC-7, Wes Freeman wro

Re: unexpected NaN behavior

2012-10-09 Thread Wes Freeman
Float/NaN must be instantiating something? user=> (def y Float/NaN) #'user/y user=> (= x y) false On Tue, Oct 9, 2012 at 4:48 PM, Wes Freeman wrote: > Possibly a simpler example: > > user=> (def x Float/NaN) > #'user/x > user=> (= x x) > true > > I'm not sure whether true or false makes more se

Re: unexpected NaN behavior

2012-10-09 Thread Wes Freeman
Possibly a simpler example: user=> (def x Float/NaN) #'user/x user=> (= x x) true I'm not sure whether true or false makes more sense, personally. Wes On Tue, Oct 9, 2012 at 4:38 PM, Brian Craft wrote: > Can someone explain the last result here? > > > [1 2 3 Float/NaN] > [1 2 3 NaN] > > (= Fl

unexpected NaN behavior

2012-10-09 Thread Brian Craft
Can someone explain the last result here? > [1 2 3 Float/NaN] [1 2 3 NaN] > (= Float/NaN Float/NaN) false (#(= Float/NaN Float/NaN)) false ; all is good so far, but... (filter #(= % %) [1 2 3 Float/NaN 4]) (1 2 3 NaN 4) Now I'm lost. What just happened? -- You received this message because you

Re: understanding 'binding' use in clojure.java.jdbc

2012-10-09 Thread Brian Craft
On Tuesday, October 9, 2012 12:11:28 PM UTC-7, Tassilo Horn wrote: > > Brian Craft > writes: > > Hi Brian, > > > If (read-stuff) is not lazy, then this looks pretty simple: all the > > data is loaded in memory & returned to (write-stuff). If the data is > > large you wouldn't want it all in m

Parallelising reduce-kv

2012-10-09 Thread Wolodja Wentland
Hi all, I've noticed that I wrote the following recently and wonder if this can be done in a more succinct/idiomatic way and also if it can be parallelised: --- snip --- (reduce-kv (fn [ret k v] (assoc ret k (func-that-does-something-with v))) some-map)) --- snip -- I am using reducers in ot

Re: understanding 'binding' use in clojure.java.jdbc

2012-10-09 Thread Tassilo Horn
Brian Craft writes: Hi Brian, > If (read-stuff) is not lazy, then this looks pretty simple: all the > data is loaded in memory & returned to (write-stuff). If the data is > large you wouldn't want it all in memory. What then? Could you make > read-stuff return a lazy sequence? My impression aft

Re: understanding 'binding' use in clojure.java.jdbc

2012-10-09 Thread Brian Craft
On Tuesday, October 9, 2012 11:32:18 AM UTC-7, Tassilo Horn wrote: > > Brian Craft > writes: > > > How would I do an operation involving two databases? I'd need to call > > with-connection* from with-connection*? How would I then read from one > > & write to the other? > > I've never used the

Re: Slightly updated Clojure cheatsheet available

2012-10-09 Thread Sergey Didenko
Thank you, 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, se

Re: understanding 'binding' use in clojure.java.jdbc

2012-10-09 Thread Tassilo Horn
Brian Craft writes: > How would I do an operation involving two databases? I'd need to call > with-connection* from with-connection*? How would I then read from one > & write to the other? I've never used the jdbc lib, but essentially it should be something along the lines of (let [db1 (conne

understanding 'binding' use in clojure.java.jdbc

2012-10-09 Thread Brian Craft
I'm trying to understand how 'binding' works, looking at the jdbc lib. with-connection* binds *db* and then invokes a function. That function will invoke other jdbc methods which do not take a connection parameter, so I presume they are pulling the connection from *db*. As I understand it, the

Re: *foo*

2012-10-09 Thread Mark Rathwell
> It's in there, search Asterisks: Variants, Internal Routines, Mutable Globals Should have noted that's not how it is used in Clojure though On Tue, Oct 9, 2012 at 2:00 PM, Mark Rathwell wrote: > It's in there, search Asterisks: Variants, Internal Routines, Mutable Globals > > On Tue, Oct 9, 20

Re: *foo*

2012-10-09 Thread Tamreen Khan
Asterisks are valid characters for names, just like alphanumeric characters, dashes, question marks, etc. According to Practical Clojure (http://books.google.com/books?id=4QacPa1vwMUC&pg=PA24&lpg=PA24&dq=clojure+star+character&source=bl&ots=2yDJkpf6ni&sig=2bV8rr5qpn-ev5Y50MW9XpE5fKA&hl=en&sa=X&ei=

Re: *foo*

2012-10-09 Thread Softaddicts
I would think that since we now live in an era were emphasis is put on neutral wording that *foo* is an accepted replacement for fubar which does not need any special markers to be understood by everyone :) Luc P. > I know I saw an explanation of this on some obscure page, but I can't find > i

Re: Interest in Scribble for Clojure?

2012-10-09 Thread Michael Fogus
> Any existing solutions or interest in something like this? There are no _public_ solutions as far as I know, although I think it can be done fairly trivially (famous last words) using the existing ClojureScript compiler. I'd love to see it done as an open source project. -- You received this

Re: *foo*

2012-10-09 Thread Mark Rathwell
It's in there, search Asterisks: Variants, Internal Routines, Mutable Globals On Tue, Oct 9, 2012 at 1:58 PM, Grant Rettke wrote: > Gosh I thought it was in there... maybe it is not. Sorry. > > On Tue, Oct 9, 2012 at 12:55 PM, Grant Rettke wrote: >> On Tue, Oct 9, 2012 at 12:54 PM, Brian Craft

Re: *foo*

2012-10-09 Thread Tassilo Horn
Brian Craft writes: > I know I saw an explanation of this on some obscure page, but I can't > find it now. What's up with the symbols with stars at front & end? It's a convention that dynamic vars have "hearmuffs". (def ^:dynamic *foo*) Not everyone uses it, and the earmuffs themselves have

Re: *foo*

2012-10-09 Thread Grant Rettke
Gosh I thought it was in there... maybe it is not. Sorry. On Tue, Oct 9, 2012 at 12:55 PM, Grant Rettke wrote: > On Tue, Oct 9, 2012 at 12:54 PM, Brian Craft wrote: >> I know I saw an explanation of this on some obscure page, but I can't find >> it now. What's up with the symbols with stars at f

Re: *foo*

2012-10-09 Thread Grant Rettke
On Tue, Oct 9, 2012 at 12:54 PM, Brian Craft wrote: > I know I saw an explanation of this on some obscure page, but I can't find > it now. What's up with the symbols with stars at front & end? http://mumble.net/~campbell/scheme/style.txt -- You received this message because you are subscribed t

*foo*

2012-10-09 Thread Brian Craft
I know I saw an explanation of this on some obscure page, but I can't find it now. What's up with the symbols with stars at front & end? -- 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 Not

Re: Bug: incorrect stack trace for function names containing ->

2012-10-09 Thread Tassilo Horn
Mauricio Aldazosa writes: > According to the reader documentation (http://clojure.org/reader), it > seems that '>' is not a valid character for a symbol name: > > Symbols begin with a non-numeric character and can contain > alphanumeric characters and *, +, !, -, _, and ? (other characters > will

Re: What is this function?

2012-10-09 Thread Tassilo Horn
Larry Travis writes: > user> (source list*) > (defn list* > "Creates a new list containing the items prepended to the rest, the > last of which will be treated as a sequence." > {:added "1.0" >:static true} > ([args] (seq args)) > ([a args] (cons a args)) > ([a b args] (cons a (co

Re: What is this function?

2012-10-09 Thread Andy Fingerhut
It is not in the Clojure API because it is declared private in the source file core.clj where it is defined. If you want to study Clojure's core code, it is essential in cases like this that you get a full source tree and search through it for such things: git clone git://github.com/clojure/cl

Re: What is this function?

2012-10-09 Thread Mark Rathwell
https://github.com/clojure/clojure/blob/master/src/clj/clojure/core.clj#L588 On Tue, Oct 9, 2012 at 1:03 PM, Larry Travis wrote: > As participants in this googlegroup have often observed, an excellent way to > learn Clojure is to study the source definitions of its API functions. > This advice wo

Re: Bug: incorrect stack trace for function names containing ->

2012-10-09 Thread Andy Fingerhut
Clojure itself creates symbols with -> in them (I think defrecord creates functions named by such symbols). Andy On Oct 9, 2012, at 6:12 AM, Mauricio Aldazosa wrote: > Hi there. > > According to the reader documentation (http://clojure.org/reader), it seems > that '>' is not a valid character

Re: ANN clojure-doc.org (aka CDS), a new community-driven Clojure documentation site

2012-10-09 Thread Michael Klishin
2012/10/9 Brent Millare > 1. Front Page Design > > Currently, it looks like the front page has a bunch of miniature slides. > Do we want the front page to mainly be the focus of advertisement and have > a separate navigation system (aka "see all contents")? Or do we want > navigation to be the fr

Re: lein run deadlocking?

2012-10-09 Thread Andy Fingerhut
I'm not sure what the issue is. I'd suggest contacting gloss's author Zach Tellman. Several github tickets seem to suggest some kind of problem with Clojure 1.3 and using import-fn from the potemkin library, which gloss uses. I don't know if that problem leads to this behavior, though: https

What is this function?

2012-10-09 Thread Larry Travis
As participants in this googlegroup have often observed, an excellent way to learn Clojure is to study the source definitions of its API functions. This advice works better for learners who know Java, which I don't. I sometimes think that, if I were to teach a "Clojure Programming" course, I

Re: Bug: incorrect stack trace for function names containing ->

2012-10-09 Thread Mauricio Aldazosa
Hi there. According to the reader documentation (http://clojure.org/reader), it seems that '>' is not a valid character for a symbol name: Symbols begin with a non-numeric character and can contain alphanumeric characters and *, +, !, -, _, and ? (other characters will be allowed eventually, but

Re: Slightly updated Clojure cheatsheet available

2012-10-09 Thread Grant Rettke
Thanks! On Mon, Oct 8, 2012 at 11:34 PM, Andy Fingerhut wrote: > I haven't created an info format version of it, nor am I aware of anyone else > who has. > > I have a Clojure program that starts from a data structure and generates > LaTeX and HTML versions of the cheatsheet from that. It is av

Re: Bug: incorrect stack trace for function names containing ->

2012-10-09 Thread Alex Nixon
I've created a Jira issue CLJ-1083 and linked this conversation. I don't think there's anything else I can add to the discussion so I'll leave it to the clojure team to take from here. Thanks for the responses, On 9 October 2012 15:03, Jay Fields wro

Re: ANN clojure-doc.org (aka CDS), a new community-driven Clojure documentation site

2012-10-09 Thread Brent Millare
As a start for my contributions, I want to open up some topics for discussion. 1. Front Page Design Currently, it looks like the front page has a bunch of miniature slides. Do we want the front page to mainly be the focus of advertisement and have a separate navigation system (aka "see all co

Re: lein run deadlocking?

2012-10-09 Thread Brian Craft
This is reproducible on ubuntu with a different jre: java version "1.6.0_24" OpenJDK Runtime Environment (IcedTea6 1.11.4) (6b24-1.11.4-1ubuntu0.12.04.1) OpenJDK Server VM (build 20.0-b12, mixed mode) On Monday, October 8, 2012 10:00:37 PM UTC-7, Brian Craft wrote: > > It's something to do with

Re: ANN: polyfn

2012-10-09 Thread Paul Stadig
On Tuesday, October 9, 2012 9:37:20 AM UTC-4, tbc++ wrote: > > >> Polyfns are exactly as fast as protocol functions (I am using the same > >> caching and dispatch code), but they do not generate a Java interface, > >> and they are slightly simpler to define. > > So I guess I have to ask the questio

Re: ANN: polyfn

2012-10-09 Thread Tassilo Horn
Tassilo Horn writes: > But on the other hand, many of my protocols aren't open but merely an > implementation detail, and they are extended upon only a few java > classes (many only 2). For those it seems to be more efficient to use > a plain function explicitly dispatching on type using `instan

Re: ANN: polyfn

2012-10-09 Thread Tassilo Horn
David Nolen writes: Hi David, >> I think it might be a good idea to discuss why the Java interfaces >> are created for protocols. > > I don't see how polyfns can be as fast as protocol functions that are > defined inline and thus backed by an Java interface. It has not been > my experience that

Re: Bug: incorrect stack trace for function names containing ->

2012-10-09 Thread Chas Emerick
The classname backing the function in question is still named e.g. user$a__GT_b. You'll always see that in debuggers and other tools that use classnames. The arity mismatch exception message is the issue. You have to go back to Clojure 1.1.0 to see user$a__GT_b in such messages instead of use

Re: Bug: incorrect stack trace for function names containing ->

2012-10-09 Thread Jay Fields
Fair enough. I never noticed it before, and I know I've seen -> converted to something similar to __GT_ in the debugger, so I (mistakenly) thought it had something to do with the repl. Looks like this has been around for awhile, or I'm doing something wrong. jfields@wud-jfields01:~$ lein repl REP

Re: ANN: polyfn

2012-10-09 Thread David Nolen
On Tue, Oct 9, 2012 at 9:36 AM, Timothy Baldridge wrote: >>> Polyfns are exactly as fast as protocol functions (I am using the same >>> caching and dispatch code), but they do not generate a Java interface, >>> and they are slightly simpler to define. > > I think it might be a good idea to discuss

Re: Bug: incorrect stack trace for function names containing ->

2012-10-09 Thread Chas Emerick
The message is produced in AFn.throwArity: https://github.com/clojure/clojure/blob/master/src/jvm/clojure/lang/AFn.java#L434 It looks like any name that contains a hyphen followed by a "special character" (w.r.t. allowable chars in Java classnames) will result in a munged (i.e. Compiler.munge()

Re: ANN: polyfn

2012-10-09 Thread Timothy Baldridge
>> Polyfns are exactly as fast as protocol functions (I am using the same >> caching and dispatch code), but they do not generate a Java interface, >> and they are slightly simpler to define. I think it might be a good idea to discuss why the Java interfaces are created for protocols. Before we h

Re: Bug: incorrect stack trace for function names containing ->

2012-10-09 Thread Jay Fields
I noticed something similar, but I'm using 1.3. Maybe it's a bug in nrepl? On Tue, Oct 9, 2012 at 6:39 AM, Alex Nixon wrote: > Hey all, > > I believe I've come across a minor bug in Clojure 1.4.0 (and I see the same > behaviour in 1.5.0-alpha5): > > user=> (defn a->b []) > #'user/a->b > user=> (a

Bug: incorrect stack trace for function names containing ->

2012-10-09 Thread Alex Nixon
Hey all, I believe I've come across a minor bug in Clojure 1.4.0 (and I see the same behaviour in 1.5.0-alpha5): user=> (defn a->b []) #'user/a->b user=> (a->b 1) ArityException Wrong number of args (1) passed to: user$a clojure.lang.AFn.throwArity (AFn.java:437) Note that the reported function

Re: ANN: polyfn

2012-10-09 Thread Paul Stadig
On Tuesday, October 9, 2012 7:24:57 AM UTC-4, Tassilo Horn wrote: > > I'm happy to have complemented my questions with at least a bit useful > feedback and pointers. :-) At least this latter point is a blocker for > trying to replace my protocols with polyfns right now. > Yeah, thanks for the f

Re: ANN: polyfn

2012-10-09 Thread Tassilo Horn
Paul Stadig writes: > Recompiling a polyfn definition 50 times will only end up with a > dispatch table of one entry. The multiple entries get added when you > recompile defrecord and defprotocol. When you recompile a defrecord > form 50 times you get 50 different types which is why the dispatch

Re: ANN: polyfn

2012-10-09 Thread Paul Stadig
On Tue, Oct 9, 2012 at 2:40 AM, Tassilo Horn wrote: > Ah, so if I change a polyfn for a type X, the new behavior will only be > available to new X instances, right? If you change a polyfn implementation for a type X, then the new behavior will be available to all instances of X, even those create

Re: ANN: polyfn

2012-10-09 Thread Paul Stadig
On Mon, Oct 8, 2012 at 10:46 PM, Frank Siebenlist wrote: > Interesting project, although I'm still a little unclear about the > "convincing" use cases where you would choose polyfn over protocols... > > Also, how does the polyfn implementation compare to the clojurescript > protocol implementati

Re: compiler: throw Error instead of a string?

2012-10-09 Thread Michal Gornisiewicz
Thanks try* would do the trick. Though note that catch js/String won't catch strings, as: > "foo" instanceof String false Michal On Monday, 8 October 2012 01:18:54 UTC+2, Herwig Hochleitner wrote: > > Javascript native try-catch is available as the compiler builtin try* > form. cljs.core/try

Re: reading binary blob

2012-10-09 Thread Steffen
Hi, I wrote a binary parser combinator(ish) library that uses java's input/outputstreams (https://github.com/smee/binary) that may help (add [org.clojars.smee/binary "0.2.0"] to your project's leiningen dependencies). As I use streams, I have no way of knowing the size of a binary blob beforeh