Re: Clojure and introspection/reflection analysis?

2008-10-24 Thread mritun
Hi Take a look at btrace. It is DTrace like dynamic instrumentation tool for JVM (DTrace : System :: btrace : JVM, though DTrace is superset of btrace). It allows you to instrument JVM at bytecode level with no changes in code. It might also help going forward to enhance clojure to insert btrac

Re: Reader + Macros on untrusted S Expressions: Security considerations?

2008-10-24 Thread Brett Morgan
On Fri, Oct 24, 2008 at 5:16 PM, Adam Jones <[EMAIL PROTECTED]> wrote: > > > > On Oct 22, 6:17 am, Chouser <[EMAIL PROTECTED]> wrote: > > On Wed, Oct 22, 2008 at 4:30 AM, Brett Morgan <[EMAIL PROTECTED]> > wrote: > > > > > I understand the lisp way is to use the reader plus macros to interpret > t

Re: Modified doto

2008-10-24 Thread mac
On 23 Okt, 16:53, Rich Hickey <[EMAIL PROTECTED]> wrote: > On Oct 21, 10:30 am, mb <[EMAIL PROTECTED]> wrote: > > > Hi, > > > On 21 Okt., 14:41, mb <[EMAIL PROTECTED]> wrote:> (defmacro doto-> > > > The name is actually also up to discussion. doto is already > > in use and this change is incompa

Re: Modified doto

2008-10-24 Thread Christian Vest Hansen
On Thu, Oct 23, 2008 at 4:53 PM, Rich Hickey <[EMAIL PROTECTED]> wrote: > > > > On Oct 21, 10:30 am, mb <[EMAIL PROTECTED]> wrote: >> Hi, >> >> On 21 Okt., 14:41, mb <[EMAIL PROTECTED]> wrote:> (defmacro doto-> >> >> The name is actually also up to discussion. doto is already >> in use and this ch

Re: BUG? Can't bind a macro

2008-10-24 Thread MikeM
On Oct 23, 9:02 pm, "Mike Hinchey" <[EMAIL PROTECTED]> wrote: > Binding isn't suppose to work for macros.  Macros expand during > compile-time, and binding only affects vars at runtime.   Binding works on vars, and a macro is a function in a var, so binding does work on macros. But you hit the

Re: Weird exception behavior

2008-10-24 Thread Rich Hickey
On Oct 23, 10:11 pm, jim <[EMAIL PROTECTED]> wrote: > Rich, > > When I do the following: > > (gen-and-load-class 'user.UserException :extends Exception) > > (defn th [arg] > (throw (new user.UserException "thrown exception"))) > > (defn test-fn [] > (try >(dorun (

Re: Weird exception behavior

2008-10-24 Thread Paul Stadig
So the moral of the story (in terms of idiomatic clojure) is to declare RuntimeExceptions instead of Exceptions (if you need to declare an exception)? Or is there a better way to handle errors? Paul On Fri, Oct 24, 2008 at 7:39 AM, Rich Hickey <[EMAIL PROTECTED]> wrote: > > > > On Oct 23, 10:11

Re: Patch available: *print-length*, *print-level*

2008-10-24 Thread Rich Hickey
On Oct 24, 2:55 am, "Stephen C. Gilardi" <[EMAIL PROTECTED]> wrote: > Rich mentioned on #clojure that a patch to implement *print-length* > would be welcome. > > I've uploaded a patch that implements Common Lisp's *print-length* and > *print-level* for Clojure: > >http://clojure.googlegr

Re: Weird exception behavior

2008-10-24 Thread Rich Hickey
On Oct 24, 7:46 am, "Paul Stadig" <[EMAIL PROTECTED]> wrote: > So the moral of the story (in terms of idiomatic clojure) is to > declare RuntimeExceptions instead of Exceptions (if you need to > declare an exception)? Or is there a better way to handle errors? > You don't declare exceptions in

Re: BUG? Can't bind a macro

2008-10-24 Thread Rich Hickey
On Oct 24, 7:19 am, MikeM <[EMAIL PROTECTED]> wrote: > On Oct 23, 9:02 pm, "Mike Hinchey" <[EMAIL PROTECTED]> wrote: > > > Binding isn't suppose to work for macros. Macros expand during > > compile-time, and binding only affects vars at runtime. > > Binding works on vars, and a macro is a funct

Re: Debugging with JSwat

2008-10-24 Thread Craig Andera
[Tried sending this before. Never appears to have shown up. Trying again after mucking with my Google account some.] On Tue, Oct 21, 2008 at 11:11 AM, Allen Rohner <[EMAIL PROTECTED]> wrote: > >> I wonder if this doesn't have something to do with the fact that I'm >> doing everything via the REPL

playing with metadata

2008-10-24 Thread Jose A. Ortega Ruiz
Hi, In order to learn and experiment with clojure, i'm implementing a (for now, toy) build system. The idea is to replace makefiles or ant build files or your-favourite-make-replacement files by specifications written in a clojure-based embedded DSL (same thing as, for example, Rake or Scons).

use spit from clojure.contrib.duck_streams

2008-10-24 Thread stephan
Hello, I tried to use the duck_streams library from clojure-contrib. I downloaded the svn trunk of clojure-contrib, used ant to build the jar-file, and copied that into a directory included in the classpath. but: user> (use 'clojure.contrib.duck_streams) gives me this exception: java.lang.Excep

Re: Weird exception behavior

2008-10-24 Thread jim
Thanks Rich. --~--~-~--~~~---~--~~ 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 To unsubscribe from this group, send email to [EMAIL PROTECTED] For more op

Re: playing with metadata

2008-10-24 Thread Rich Hickey
On Oct 24, 7:58 am, "Jose A. Ortega Ruiz" <[EMAIL PROTECTED]> wrote: > Hi, > > In order to learn and experiment with clojure, i'm implementing a (for > now, toy) build system. The idea is to replace makefiles or ant build > files or your-favourite-make-replacement files by specifications written

Re: playing with metadata

2008-10-24 Thread Stuart Halloway
Hi Jose, The key determinant of metadata in Clojure is whether the data is orthogonal to equality. Would two tasks with identical behavior but different staleness predicates be equal? I would say no, hence a staleness predicate would be data, not metadata. I'll be interested to hear what o

Re: Weird exception behavior

2008-10-24 Thread Paul Stadig
Right, I meant derive. Sorry. I was just trying to understand the best way to deal with errors in Clojure. I thought what you were saying was that we could derive exceptions from RuntimeException and they wouldn't get wrapped. It seems to negate the value of try/catch if every exception (including

Re: use spit from clojure.contrib.duck_streams

2008-10-24 Thread J. McConnell
On Fri, Oct 24, 2008 at 9:44 AM, stephan <[EMAIL PROTECTED]> wrote: > > I downloaded the svn trunk of clojure-contrib, used ant to build the > jar-file, and copied that into a directory included in the classpath. Unfortunately, jars within directories in the classpath aren't picked up by the clas

Re: Debugging with JSwat

2008-10-24 Thread Bill Clementson
Hi Craig, On Fri, Oct 24, 2008 at 6:23 AM, Craig Andera <[EMAIL PROTECTED]> wrote: > > [Tried sending this before. Never appears to have shown up. Trying > again after mucking with my Google account some.] > > On Tue, Oct 21, 2008 at 11:11 AM, Allen Rohner <[EMAIL PROTECTED]> wrote: >> >>> I wond

Re: Debugging with JSwat

2008-10-24 Thread Craig Andera
> Are you doing all of the following: > > 1. Specify the appropriate debug options when you start Clojure (see > step #4 in my blog post) Yep. Here's the full command line: c:\WINDOWS\system32\java.exe -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n -cp "C:/bin/clojure/clojure/svn/cloju

Re: Debugging with JSwat

2008-10-24 Thread Bill Clementson
Hi Craig, On Fri, Oct 24, 2008 at 7:55 AM, Craig Andera <[EMAIL PROTECTED]> wrote: > >> Are you doing all of the following: >> >> 1. Specify the appropriate debug options when you start Clojure (see >> step #4 in my blog post) > > Yep. Here's the full command line: > > c:\WINDOWS\system32\java.ex

Re: Debugging with JSwat

2008-10-24 Thread Craig Andera
> No, that's not enough. You didn't specify the port that you want to > connect to JSwat on. add "address=" (or something similar) to this > to specify which port you want to use. In my blog example, I'm using > "": > -Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=n,address= >

Re: use spit from clojure.contrib.duck_streams

2008-10-24 Thread Stuart Sierra
On Oct 24, 9:44 am, stephan <[EMAIL PROTECTED]> wrote: > user> (use 'clojure.contrib.duck_streams) > gives me this exception: > java.lang.Exception: namespace 'clojure.contrib.duck_streams' not > found after loading '/clojure/contrib/duck_streams/ > duck_streams.clj' (NO_SOURCE_FILE:0) Hi Stephan

Re: use spit from clojure.contrib.duck_streams

2008-10-24 Thread stephan
Hi J. Thanks, that makes things a little bit clearer for a non-java- programmer. It was actually my fault to use the underscore in duck_streams instead of the minus sign. Best, Stephan On Oct 24, 4:20 pm, "J. McConnell" <[EMAIL PROTECTED]> wrote: > On Fri, Oct 24, 2008 at 9:44 AM, stephan <[EM

Re: use spit from clojure.contrib.duck_streams

2008-10-24 Thread Stephen C. Gilardi
On Oct 24, 2008, at 9:44 AM, stephan wrote: > user> (use 'clojure.contrib.duck_streams) > gives me this exception: > java.lang.Exception: namespace 'clojure.contrib.duck_streams' not > found after loading '/clojure/contrib/duck_streams/ > duck_streams.clj' (NO_SOURCE_FILE:0) - Lisps trad

Re: Patch available: *print-length*, *print-level*

2008-10-24 Thread Stuart Sierra
On Oct 24, 2:55 am, "Stephen C. Gilardi" <[EMAIL PROTECTED]> wrote: > I've uploaded a patch that implements Common Lisp's *print-length* and > *print-level* for Clojure: Really nice. Thanks, Stephen! Could the *print-level* cutoff indicator be something more visible than '#'? Maybe '#=(...)' o

Re: Patch available: *print-length*, *print-level*

2008-10-24 Thread Stuart Sierra
On Oct 24, 12:18 pm, "Stuart Sierra" <[EMAIL PROTECTED]> wrote: > I've attached a patch to add *print-str-length* that does the same > thing for strings: Okay, NOW I've attached a patch. -Stuart --~--~-~--~~~---~--~~ You received this message because you are subscr

Re: Debugging with JSwat

2008-10-24 Thread Bill Clementson
On Fri, Oct 24, 2008 at 8:16 AM, Craig Andera <[EMAIL PROTECTED]> wrote: > >> No, that's not enough. You didn't specify the port that you want to >> connect to JSwat on. add "address=" (or something similar) to this >> to specify which port you want to use. In my blog example, I'm using >> "88

Re: Patch available: *print-length*, *print-level*

2008-10-24 Thread Stephen C. Gilardi
On Oct 24, 2008, at 12:18 PM, Stuart Sierra wrote: > On Oct 24, 2:55 am, "Stephen C. Gilardi" <[EMAIL PROTECTED]> wrote: >> I've uploaded a patch that implements Common Lisp's *print-length* >> and >> *print-level* for Clojure: > > Really nice. Thanks, Stephen! Thanks! :-) > Could the *print

Re: Debugging with JSwat

2008-10-24 Thread Craig Andera
>> It's very likely/nearly certain I'm still doing something wrong - I >> appreciate the help. Indeed it was me: everything started working as soon as I made sure my .clj files were in CLASSPATH the way require describes they should be. I'm sure it doesn't help that I'm a Java n00b in addition to

Re: Patch available: *print-length*, *print-level*

2008-10-24 Thread Stuart Sierra
On Oct 24, 1:16 pm, "Stephen C. Gilardi" <[EMAIL PROTECTED]> wrote: > *print-length* and *print-level* do affect print and println as well   > as pr and prn and pr-str. Ah, my mistake. Never mind, then. -Stuart --~--~-~--~~~---~--~~ You received this message becaus

Re: Debugging with JSwat

2008-10-24 Thread Bill Clementson
On Fri, Oct 24, 2008 at 10:31 AM, Craig Andera <[EMAIL PROTECTED]> wrote: > >>> It's very likely/nearly certain I'm still doing something wrong - I >>> appreciate the help. > > Indeed it was me: everything started working as soon as I made sure my > .clj files were in CLASSPATH the way require des

Ideal Hash Trees (Bagwell paper)

2008-10-24 Thread rauhersu
Hi there, First, thanks for this great language and all the media available. Clojure talks are really good ! Just in one of these talks, Rich talks about "Array Mapped Trees" and I have read that Bagwell's paper : "Ideal Hash Trees". Maybe my question is pretty dummy but Bagwell talks about key

Re: Clojure and introspection/reflection analysis?

2008-10-24 Thread BerlinBrown
On Oct 24, 2:34 am, mritun <[EMAIL PROTECTED]> wrote: > Hi > > Take a look at btrace. It is DTrace like dynamic instrumentation tool > for JVM (DTrace : System :: btrace : JVM, though DTrace is superset of > btrace). > > It allows you to instrument JVM at bytecode level with no changes in > code

Re: Clojure and introspection/reflection analysis?

2008-10-24 Thread BerlinBrown
On Oct 24, 5:36 pm, BerlinBrown <[EMAIL PROTECTED]> wrote: > On Oct 24, 2:34 am, mritun <[EMAIL PROTECTED]> wrote: > > > > > Hi > > > Take a look at btrace. It is DTrace like dynamic instrumentation tool > > for JVM (DTrace : System :: btrace : JVM, though DTrace is superset of > > btrace). > >

Patch: supporting primitive and array classes in print-method

2008-10-24 Thread Chas Emerick
The existing implementation of print-method for Class objects emits unreadable representations for primitive classes (Float/TYPE, etc) and array classes (Object[], etc). Attached is a patch that results in both types of classes being printed readably. Rich, thanks for the feedback in irc...

take goes too far

2008-10-24 Thread Chouser
I ran into a problem with "take" today (thanks to wwmorgan on IRC for helping steer me away from blaming "filter"). My actual code had to do with computing a subset of primes, but let's take a simpler example. (defn painful-seq [] (lazy-cat [0 1 2] (comment lots of hard work here)

Re: (seq? "abc")

2008-10-24 Thread Stephen C. Gilardi
On Oct 2, 2008, at 2:58 PM, Stuart Halloway wrote: > Right. So, should sort work? > > user=> (sort "bca") > java.lang.IncompatibleClassChangeError: Class java.lang.String does > not implement the requested interface java.util.Collection It does work and returns a sorted seq of characters. I do

Re: playing with metadata

2008-10-24 Thread Jose A. Ortega Ruiz
Hi Stuart and Rich, Stuart Halloway <[EMAIL PROTECTED]> writes: > Hi Jose, > > The key determinant of metadata in Clojure is whether the data is > orthogonal to equality. Would two tasks with identical behavior but > different staleness predicates be equal? I would say no, hence a > stale

Re: Modified doto

2008-10-24 Thread CuppoJava
On non-backwards compatible language changes in general, isn't it trivial to write a source-code converter? Especially given the ease of Clojure's macro system, all you would need is a systematic find and replace on any code that uses the current doto right? That would save the manual labor of hav

Class generation

2008-10-24 Thread Stephen Wrobleski
On Oct 19, 1:12 pm, Rich Hickey <[EMAIL PROTECTED]> wrote: > At that point, I'll have some syntax for adorning defns with metadata   > that will do what was once the work of genclass, and I'll be able to   > incorporate in that the enhancements to genclass that have been   > requested. > > I hope