Re: Spec without global registry?

2017-06-12 Thread Mark Addleman
Yes, I think most of the problems can be solved through prefixing (although the solution is a bit hacky, IMO) but the real problem with the global registry is that its not based on an abstraction but a concrete implementation. The only specific problem I can think of right now is the incidental

Re: A macro for writing defn-like macros?

2013-09-06 Thread Mark Addleman
That's cool. Thanks! On Fri, Sep 6, 2013 at 7:17 AM, Phillip Lord phillip.l...@newcastle.ac.ukwrote: Mark markaddle...@gmail.com writes: I find the vast majority of the time I'm tempted to write a macro (yeah, yeah, I know the first rule of macro club), is to defn-like things. Writing

Re: Request for Discussion: user created reader macros

2009-08-14 Thread Mark Addleman
I suspect that reader macros are necessary to fully realize named- argument message passing. --~--~-~--~~~---~--~~ 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

Re: partition-like function

2009-08-05 Thread Mark Addleman
Try partition-all in clojure.contrib.seq-utils On Aug 5, 10:38 am, Sean Devlin francoisdev...@gmail.com wrote: Hey all, I'm looking for a variation on partition. user=(def my-vec [:a :b :c :d :e]) ;normal behavior user=(partition 2 my-vec) ((:a :b) (:c :d)) The behavior I want is

Improving Clojure's primitive handling (warning: not thought through)

2009-08-04 Thread Mark Addleman
I think there may be a somewhat straightforward solution to improving Clojure's performance when passing primitives between functions. Here's my understanding of the problem: The IFn interface is a series of invoke method signatures that take a number of java.lang.Objects as parameters and

Improving Clojure's primitive handling (warning: not thought through)

2009-08-04 Thread Mark Addleman
I think there may be a somewhat straightforward solution to improving Clojure's performance when passing primitives between functions. Here's my understanding of the problem: The IFn interface is a series of invoke method signatures that take a number of java.lang.Objects as parameters and

Re: Improving Clojure's primitive handling (warning: not thought through)

2009-08-04 Thread Mark Addleman
to a java.lang.Number is likely no worse than the cost of standard Java boxing. What do people think? Those of you familiar with the Clojure compiler, does this approach make sense? On Aug 4, 8:02 am, Mark Addleman mark_addle...@bigfoot.com wrote: I think there may be a somewhat straightforward solution

Re: Improving Clojure's primitive handling (warning: not thought through)

2009-08-04 Thread Mark Addleman
, Mark Addleman mark_addle...@bigfoot.com wrote: Whoops, submitted that a bit too soon. I guess only couple of things to add: (1)  The cost of obtaining the primitive array and returning it to the cache is likely no worse than operations on an ArrayList, so those should be very cheap. (2

Re: Improving Clojure's primitive handling (warning: not thought through)

2009-08-04 Thread Mark Addleman
On Aug 4, 8:12 am, Boris Mizhen - 迷阵 bo...@boriska.com wrote: You are suggesting creating mutable boxed numbers with an object pool. You might want to do this with a custom classes, not a one-element array, because you want to be able to tell if this is your hack or just someone is passing

Re: Improving Clojure's primitive handling (warning: not thought through)

2009-08-04 Thread Mark Addleman
On Aug 4, 8:21 am, Rich Hickey richhic...@gmail.com wrote: On Tue, Aug 4, 2009 at 11:02 AM, Mark Addlemanmark_addle...@bigfoot.com wrote: I think there may be a somewhat straightforward solution to improving Clojure's performance when passing primitives between functions. Here's my

gen-class bytecode for method implementation

2009-07-27 Thread Mark Addleman
I have written some Clojure code to implement java.lang.CharSequence that is constructed with a length and an ISeq of strings. I need this because I want to pass the resulting CharSequence into Java's regex library. I got the thing working (thanks to the docs and some good examples that I found

Re: Improved Error Messages - Part XXXVIII

2009-07-21 Thread Mark Addleman
Here's another one: java.lang.IllegalArgumentException: Wrong number of args passed to: db $table It would be more helpful if the message included the number of actual versus expected arguments. For example: java.lang.IllegalAgumentException: Wrong number of args passed to :db $table.

Re: Experiment with named args

2009-07-17 Thread Mark Addleman
The sufficiently smart compiler argument comes to mind: if the arglist of a function is known, then surely the compiler should be able to automatically translate named/keyword arguments into an appropriate simple call? That is exactly what motivated me to write this macro. I was pretty sure

Re: Experiment with named args

2009-07-17 Thread Mark Addleman
On Jul 16, 11:50 pm, Laurent PETIT laurent.pe...@gmail.com wrote: 2009/7/17 Mark Addleman mark_addle...@bigfoot.com The sufficiently smart compiler argument  comes to mind: if the arglist of a function is known, then surely the  compiler should be able to automatically translate

Re: Experiment with named args

2009-07-17 Thread Mark Addleman
Chouser - Can you describe definline and how that differs from defmacro? I'm not sure I understand it from reading the docs. On Jul 17, 10:06 am, Chouser chou...@gmail.com wrote: On Fri, Jul 17, 2009 at 12:17 PM, Laurent PETITlaurent.pe...@gmail.com wrote: 2009/7/17 Chouser

Experiment with named args

2009-07-16 Thread Mark Addleman
A few days ago, Chouser and I had a discussion on IRC about the viability of named arguments (a la Smalltalk) for Clojure. In clojure- contrib, there is the macro defnk which provides this sort of capability, but it's performance characteristics are worse than than normal function call. I

Re: Improved Error Messages - Part XXXVIII

2009-06-25 Thread Mark Addleman
java.lang.UnsupportedOperationException: nth not supported on this type: Symbol (db.clj:101) The line number isn't very useful because it is always the first line of the definition. To help me locate the error, it would be helpful to list the specific symbol such as nth not supported on

Re: Improved Error Messages - Part XXXVIII

2009-06-25 Thread Mark Addleman
On Jun 25, 4:15 am, Mark Addleman mark_addle...@bigfoot.com wrote: java.lang.UnsupportedOperationException: nth not supported on this type: Symbol (db.clj:101) It turns out this error was due to not specifying my macro's arg list within brackets: (defmacro with-table table rows

Re: Improved Error Messages - Part XXXVIII

2009-06-25 Thread Mark Addleman
On Jun 25, 4:26 am, Rich Hickey richhic...@gmail.com wrote: On Thu, Jun 25, 2009 at 7:03 AM, James Reevesweavejes...@googlemail.com wrote: On Jun 25, 10:02 am, James Reeves weavejes...@googlemail.com wrote: Here's one that regularly confuses me:   (prn [10)   =

Improved Error Messages - Part XXXVIII

2009-06-24 Thread Mark Addleman
Searching through this forum, I found many posts relating to improving Clojure's error messages. I stumbled across one where Rich makes a plea for concrete suggestions to specific cases. I'm very sympathetic to that, so I'd like to start a thread of specific coding errors that I've run across

Re: off topic - sending and receiving raw Ethernet frames from clojure/java

2009-05-21 Thread Mark Addleman
Can't be done using the standard Java library. You'll have to write some JNI code or find a JNI library. On May 20, 4:32 am, prhlava prhl...@googlemail.com wrote: Hello, Apologies for off topic post. I would like to send and receive raw ethernet frames from Clojure. So far, I found:

Re: OutOfMemoryError with clojure.contrib.sql and large result sets

2009-05-18 Thread Mark Addleman
The problem is likely in the MySQL's JDBC driver. Some retrieve the entire result set from the database on statement execute while others are more true to the notion of a remote database cursor. The JDBC API has a workaround for this problem: Use Statement.setFetchSize(int) to limit the number

Re: The Path to 1.0

2009-04-16 Thread Mark Addleman
OSGi is becoming the de facto standard for solving the runtime issues around versioning and classpath management in the standard Java world. As for development versioning issues, Maven is the de facto standard. While I certainly don't think that Clojure 1.0 should have any dependency on OSGi,

Re: Bytecode optimization

2009-03-12 Thread Mark Addleman
On Mar 12, 10:56 am, Stuart Sierra the.stuart.sie...@gmail.com wrote: On Mar 12, 4:46 am, Joshua Fox joshuat...@gmail.com wrote: wondering: Does Clojure's pure-functional design enhance VM-level bytecode optimization by simplifying escape analysis? Functional design doesn't necessarily

Re: Clojure Library Documentation

2009-02-01 Thread Mark Addleman
More as a note to future Clojure doc'ers than anything else: It seems that noobies (including myself) get bitten by the lazy versus immediate evaluation functions all the time (e.g. for versus doseq/ doall). If this problem isn't solved through naming conventions (probably way too tedious to be