Re: Example use of agent with macro

2009-02-19 Thread Laurent PETIT
Ah, the array was a trick I used in java code : because I want to get a value from another thread, the reference passed to the Runnable must be final, and the Runnable can't change it, but it can "act on it". So I could also have created a little class with a field, and the Runnable would have chan

Re: Bug with clojure eval: ExceptionInInitializerError

2009-02-19 Thread wlr
On Feb 19, 8:18 pm, Jeffrey Chu wrote: > user=> (eval (lazy-identity '(apply + '(1 2 3 > java.lang.ExceptionInInitializerError (NO_SOURCE_FILE:0) ~/java/clojure $ svn info Path: . URL: http://clojure.googlecode.com/svn/trunk Repository Root: http://clojure.googlecode.com/svn Repository UUID:

Re: Example use of agent with macro

2009-02-19 Thread Berlin Brown
On Feb 19, 6:24 pm, Laurent PETIT wrote: > Yes, thank you, I did the simplification. > > I couldn't resist continue to do some work around the problem, and I finally > got both a working version of : > > swt-wrapper/sync-exec : a (debugged) macro that does what the initial thread > was about >

Bug with clojure eval: ExceptionInInitializerError

2009-02-19 Thread Jeffrey Chu
Hi, Okay, I'm reasonably sure this is a bug with clojure's eval. Here's an even more succinct version: (defn lazy-identity [a] (if (seq? a) (map lazy-identity a) a)) user=> (lazy-identity '(apply + '(1 2 3))) (apply + (quote (1 2 3))) user=> (eval (lazy-identity '(apply + '(1 2 3

Re: how can i do this in clojure

2009-02-19 Thread Nathan Kitchen
On Feb 19, 2:39 pm, Phil Hagelberg wrote: > linh writes: > > # ruby code > > def foo(x, y) > > x + y > > end > > > def bar > > [1, 2] > > end > > > foo(*bar) # this is fine, the result will be 3 > > foo(bar) # this is not ok, will raise exception > > > bar returns an array of size 2, but foo

Re: VerifyError overrides final method / forwarding interface calls to multimethods

2009-02-19 Thread Eric Thorsen
Thanks for this. I was steered fowards proxy-super and was all set. On Feb 19, 11:19 am, Chouser wrote: > On Thu, Feb 19, 2009 at 9:09 AM, Eric Thorsen wrote: > > > In some cases, the Java classes give you an interface where you have > > to do all kinds of shenanigans to handle various cases (

Re: compiling a GUI app and also: interference of Java's built-in architechture

2009-02-19 Thread Kevin Albrecht
I can vouch for using SWT with Clojure. There is also no need to compile you application to distribute it. I posted a little example program on my blog here: http://kevinoncode.blogspot.com/2009/01/creating-clojure-gui-application-with.html -- Kevin Albrecht http://www.kevinalbrecht.com/ --~-

Re: Example use of agent with macro

2009-02-19 Thread Laurent PETIT
Yes, thank you, I did the simplification. I couldn't resist continue to do some work around the problem, and I finally got both a working version of : swt-wrapper/sync-exec : a (debugged) macro that does what the initial thread was about swt-wrapper/swt-app : a macro to be called from the -main m

Re: Newbie: Where is clojure.jar?

2009-02-19 Thread Telman Yusupov
A little bit of shameless plug here: I wrote a small article on my Clojure setup - it could be useful: http://telmanyusupov.wordpress.com/2009/02/16/basic-clojure-setup-part-1/ Parts 2 & 3 are coming very soon. Cheers, Telman On Feb 19, 5:37 pm, samppi wrote: > Oh, of course. Thanks for the

Re: Error Handling paradigms in Clojure

2009-02-19 Thread David Nolen
Check out Chouser's error-kit in clojure-contrib. It borrows from the condition/restart system of Common Lisp. On Thu, Feb 19, 2009 at 5:25 PM, levand wrote: > > So, my project is reaching a sufficient level of complexity where I > really need good error tracking - when something goes wrong, I n

Re: how can i do this in clojure

2009-02-19 Thread Phil Hagelberg
linh writes: > # ruby code > def foo(x, y) > x + y > end > > def bar > [1, 2] > end > > foo(*bar) # this is fine, the result will be 3 > foo(bar) # this is not ok, will raise exception > > bar returns an array of size 2, but foo expects 2 parameters not an > array. In Clojure, this would lo

Re: Newbie: Where is clojure.jar?

2009-02-19 Thread samppi
Oh, of course. Thanks for the help. On Feb 19, 2:22 pm, Vincent Foley wrote: > Run ant > > On Feb 19, 4:00 pm, samppi wrote: > > > So I've downloaded the latest, lazier version of Clojure. But I'm > > having trouble; there used to be a clojure.jar file in the folder, and > > it's not there anym

Re: how can i do this in clojure

2009-02-19 Thread Mark Volkmann
On Thu, Feb 19, 2009 at 4:28 PM, linh wrote: > > hi, > how can i do this in clojure? > > # ruby code > def foo(x, y) > x + y > end (defn foo [x y] (+ x y)) > def bar > [1, 2] > end (def bar [1 2]) > foo(*bar) # this is fine, the result will be 3 (apply foo bar) > foo(bar) # this is not ok

how can i do this in clojure

2009-02-19 Thread linh
hi, how can i do this in clojure? # ruby code def foo(x, y) x + y end def bar [1, 2] end foo(*bar) # this is fine, the result will be 3 foo(bar) # this is not ok, will raise exception bar returns an array of size 2, but foo expects 2 parameters not an array. --~--~-~--~~

Error Handling paradigms in Clojure

2009-02-19 Thread levand
So, my project is reaching a sufficient level of complexity where I really need good error tracking - when something goes wrong, I need to know exactly what it was. I have programmed in Java for a long time, and my first instinct is to simply use the try and throw special forms more or less as I

Re: Yet another "how do I make gen-class work?" thread

2009-02-19 Thread mikel
On Feb 19, 11:07 am, Chouser wrote: > On Thu, Feb 19, 2009 at 11:34 AM, mikel wrote: > > > I did consider it, and am still considering. I'd be interested to know > > other people's opinions about the best (that is, most comfortable for > > users, least out-of-place) way of providing GFs in lib

Re: Newbie: Where is clojure.jar?

2009-02-19 Thread Vincent Foley
Run ant On Feb 19, 4:00 pm, samppi wrote: > So I've downloaded the latest, lazier version of Clojure. But I'm > having trouble; there used to be a clojure.jar file in the folder, and > it's not there anymore. The distribution's readme.txt still says: "To > Run java -cp clojure.jar clojure.lang.R

Newbie: Where is clojure.jar?

2009-02-19 Thread samppi
So I've downloaded the latest, lazier version of Clojure. But I'm having trouble; there used to be a clojure.jar file in the folder, and it's not there anymore. The distribution's readme.txt still says: "To Run java -cp clojure.jar clojure.lang.Repl", but I only see a clojure.iml file. --~--~-

Re: clojure.contrib.math: lcm

2009-02-19 Thread Stephen C. Gilardi
On Feb 19, 2009, at 3:31 PM, Vincent Foley wrote: I've added a lcm function the clojure.contrib.math. I sent my CA form to Rich this afternoon. Where should I submit the patch? (is it possible to attach it using the Google groups interface?) There's an issues tab here: http://code

clojure.contrib.math: lcm

2009-02-19 Thread Vincent Foley
I've added a lcm function the clojure.contrib.math. I sent my CA form to Rich this afternoon. Where should I submit the patch? (is it possible to attach it using the Google groups interface?) Vincent --~--~-~--~~~---~--~~ You received this message because you ar

Re: Fully lazy sequences are here!

2009-02-19 Thread Arthur Ulfeldt
I would like to second this :) it just looks good! On Wed, Feb 18, 2009 at 8:49 PM, mifrai wrote: > > Thanks Rich! > > Do you think it's worthwhile to add `not-empty?' in the core? > > It just feels more natural to go: > (when (not-empty? (filter even? [1 2])) >...) > over > (when (seq (fil

Re: clojure and embedded derby

2009-02-19 Thread BrianS
First of all, I was able to shutdown derby within clojure, to remove the lock files. I execute this code: (defn shutdown-derby [dbspec] (try (java.sql.DriverManager/getConnection (str "jdbc:derby:" (:subname dbspec) ";shutdown=true")) (catch java.sql.SQLException sqle (if (= "08006

Is it possible to use clojure to build NetBeans rich client application?

2009-02-19 Thread prhlava
Hello, I am thinking of using NetBeans RCP and clojure to build an application. The clojure would be used for as much application logic as possible... Has anyone else attemted this? How would I go about it? I know that it is possible with e.g. groovy, but with clojure? Kind regards, Vlad --~

Possible bug? ExceptionInInitializerError

2009-02-19 Thread Jeffrey Chu
Hi, After updating to r1295, I'm hitting an error in swank-clojure I can't seem to fix. Here's a micro test: (ns jochu.micro-test) (defn deep-replace [smap coll] (map #(if (or (seq? %) (vector? %)) (deep-replace smap %) %) (replace smap coll))) (defn t-to-true [for

Re: Example use of agent with macro

2009-02-19 Thread Stephen C. Gilardi
On Feb 19, 2009, at 1:10 PM, Laurent PETIT wrote: Interesting, but is that an implementation detail, or an exposed feature ? It's documented at: http://clojure.org/special_forms#fn (at the bottom) --Steve smime.p7s Description: S/MIME cryptographic signature

Feedback sought on yet another cells implementation!

2009-02-19 Thread Anand Patil
Hi all, I would really appreciate some comments and criticism on my cells implementation, which I've uploaded to this group's files as dataflow.clj . My goal was to fully exploit the available concurrency, but not do any unnecessary cell evaluations. My solution is lazy rather than push-based;

Re: compiling a GUI app and also: interference of Java's built-in architechture

2009-02-19 Thread Dan
Unfortunately, it seems that Jambi is going to be discontinued: http://www.qtsoftware.com/about/news/preview-of-final-qt-jambi-release-available There will be a 4.5 release and it will be maintained for a year. Since Jambi is open source, its survival depend on the community picking up the proje

Re: Creating executable Jars?

2009-02-19 Thread Emeka
Kev Are you using ms windows? Emeka --~--~-~--~~~---~--~~ 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 clojur

Re: how to learn clojure ?

2009-02-19 Thread Luc Prefontaine
Hey David, do you mean that these concepts are only present in Lisp :))) ?!?!? Good old interpreted Basic, APL, ... -> dynamic global variables, functions, assembly languages in general, C, C++, m4, ... -> macros not as cute as Lisp maybe but still macros, some have very sophisticated fea

Re: Example use of agent with macro

2009-02-19 Thread Laurent PETIT
Interesting, but is that an implementation detail, or an exposed feature ? 2009/2/19 Stephen C. Gilardi > > On Feb 19, 2009, at 12:57 PM, Laurent PETIT wrote: > > (. *swt-display* syncExec (proxy [Runnable] [] (run [] (aset >> val-res# 0 (do ~...@body) >> > > A possible simplificati

Re: Example use of agent with macro

2009-02-19 Thread Stephen C. Gilardi
On Feb 19, 2009, at 12:57 PM, Laurent PETIT wrote: (. *swt-display* syncExec (proxy [Runnable] [] (run [] (aset val-res# 0 (do ~...@body) A possible simplification is that Clojure functions implement Runnable (and Callable) directly. I don't think a proxy is required. --Stev

Re: Bug in clojure.contrib.lazy-xml: apostrophe not escaped correctly

2009-02-19 Thread Isak Hansen
On Thu, Feb 19, 2009 at 12:20 AM, Stephan Mühlstrasser wrote: > > Hi, > > I believe the following is a bug in clojure.contrib.lazy-xm: > > user=> (use 'clojure.contrib.lazy-xml) > nil > user=> (emit { :tag :a, :attrs { :b "bloody apostrophe's :-)" }}) > > > nil > > The XML is broken, because th

Re: Example use of agent with macro

2009-02-19 Thread Laurent PETIT
Hello, It sounds a little weird to me that you use a synchronous call to the UI thread (via syncExec and not asyncExec), but then use an asynchronous call to an agent ? I don't have repl here to test it, but could you make something simpler, like creating a mutable structure in the let - an array

Re: how to learn clojure ?

2009-02-19 Thread David Nolen
Great list. On Thu, Feb 19, 2009 at 11:39 AM, Stuart Halloway wrote: > > Thanks for the kind words, David. I hope many people will like > Programming Clojure and find it useful. > > Clojure has a *ton* of goodness in it. I think many of the chapters in > Programming Clojure book could usefully b

Re: how to learn clojure ?

2009-02-19 Thread David Nolen
> > No offense here to Lispers but when I learn a new language, I try to learn > it as it is and I make parallels > and connections with what I know at the moment. Otherwise you end up > learning more than one thing > at the same time and it can get quite confusing. > > If your experience is made m

Re: Example use of agent with macro

2009-02-19 Thread BerlinBrown
On Feb 19, 11:58 am, BerlinBrown wrote: > I am working with this SWT application. For most calls with SWT, if > you want to request data from a widget, then you must do so through > the syncExec or asynExec. These methods require an implementation of > runnable as an argument. > > This works

Re: Yet another "how do I make gen-class work?" thread

2009-02-19 Thread Chouser
On Thu, Feb 19, 2009 at 11:34 AM, mikel wrote: > > I did consider it, and am still considering. I'd be interested to know > other people's opinions about the best (that is, most comfortable for > users, least out-of-place) way of providing GFs in library code. I'm not your target audience for th

Re: how to learn clojure ?

2009-02-19 Thread Luc Prefontaine
The second step could be Lisp to Clojure code translation (Clojure Programming/Further Reading) and the third could be on Lisp itself and functional language concepts if the need arises. Reading Clojure code translates from Lisp is not so much to learn Lisp concepts but to see how real problems ca

Re: how to learn clojure ?

2009-02-19 Thread BerlinBrown
On Feb 19, 11:39 am, Stuart Halloway wrote: > Thanks for the kind words, David. I hope many people will like > Programming Clojure and find it useful. > > Clojure has a *ton* of goodness in it. I think many of the chapters in > Programming Clojure book could usefully be followed with an entire

Example use of agent with macro

2009-02-19 Thread BerlinBrown
I am working with this SWT application. For most calls with SWT, if you want to request data from a widget, then you must do so through the syncExec or asynExec. These methods require an implementation of runnable as an argument. This works fine for 'setting' a value, but I have trouble when I

Re: how to learn clojure ?

2009-02-19 Thread Stuart Halloway
Thanks for the kind words, David. I hope many people will like Programming Clojure and find it useful. Clojure has a *ton* of goodness in it. I think many of the chapters in Programming Clojure book could usefully be followed with an entire book. Here is a partial list of recommendations fo

Re: Yet another "how do I make gen-class work?" thread

2009-02-19 Thread mikel
On Feb 19, 9:21 am, Chouser wrote: > On Wed, Feb 18, 2009 at 6:16 PM, mikel wrote: > > > Now, of course I could write GenericFunction in Java, just as MultiFn > > is written in Java, but I thought it would be nice to use Clojure's > > Java interop features to do it. > > Not to spoil all your g

Re: compiling a GUI app and also: interference of Java's built-in architechture

2009-02-19 Thread Dan
On Wed, Feb 18, 2009 at 11:46 AM, samppi wrote: > > My impression is that if you build and compile whatever application > you're making and deploy it using something like Java Web Start, the > user usually doesn't have to do anything with regards to manually > getting other libraries like Jambi;

Re: VerifyError overrides final method / forwarding interface calls to multimethods

2009-02-19 Thread Chouser
On Thu, Feb 19, 2009 at 9:09 AM, Eric Thorsen wrote: > > In some cases, the Java classes give you an interface where you have > to do all kinds of shenanigans to handle various cases (like the cell > renderer) where a call to a multi-method would be so much cleaner > (IMO). I really just wanted

Re: how to learn clojure ?

2009-02-19 Thread MLowman
Programming Clojure is a good start. I have a copy myself. If there were a second book on Clojure, what approach would you like to see? On Feb 19, 6:46 am, Rayne wrote: > Telling someone to read a book that isn't even focused on the language > he's trying to learn isn't a great way to help them.

Re: Yet another "how do I make gen-class work?" thread

2009-02-19 Thread Chouser
On Wed, Feb 18, 2009 at 6:16 PM, mikel wrote: > > Now, of course I could write GenericFunction in Java, just as MultiFn > is written in Java, but I thought it would be nice to use Clojure's > Java interop features to do it. Not to spoil all your gen-class fun, but did you consider using proxy in

Re: Clojure.contrib: name changes in monads

2009-02-19 Thread jim
Konrad, As long as your breaking things in monads, what would you think of changing m-seq to this. (defmonadfn m-seq "'Executes' the monadic values in ms and returns a sequence of the basic values contained in them." [& ms] (reduce (fn [q p] (m-bind p (fn [x]

Re: Contributing

2009-02-19 Thread Joshua
Yep, I needed to get the ok from my professor. He thinks its a good idea, so I'll send in my CA. Joshua On Feb 19, 9:47 am, Shawn Hoover wrote: > On Thu, Feb 19, 2009 at 9:44 AM, Joshua wrote: > > > Thanks, Ill see what I can do. > > > Joshua > > If you decide to pitch in, be sure to readhttp:

Re: how to learn clojure ?

2009-02-19 Thread David Nolen
Of course I beg to differ. The Stuart Halloway's book is fantastic of course, I have it myself. It's absolutely required reading. Stuart does his best to describe the ins and outs of the language while giving a crash course on the Lisp philosophy. And yes Clojure is syntactically different from

Re: Contributing

2009-02-19 Thread Shawn Hoover
On Thu, Feb 19, 2009 at 9:44 AM, Joshua wrote: > > Thanks, Ill see what I can do. > > Joshua > If you decide to pitch in, be sure to read http://clojure.org/contributing. Discuss on this list before getting too far into something, to make sure the direction is acceptable and that there's no dupl

Re: Contributing

2009-02-19 Thread Joshua
No, we have not covered logic programming yet. Joshua Jeffrey Straszheim wrote: > Did you cover logic programming? Any bottom up logic query techniques? > (My motives are probably transparent.) > > On Wed, Feb 18, 2009 at 2:34 PM, Joshua wrote: > > > > > I am currently in a masters level Compi

Re: Contributing

2009-02-19 Thread Joshua
Thanks, Ill see what I can do. Joshua On Feb 18, 4:02 pm, Chouser wrote: > On Wed, Feb 18, 2009 at 2:34 PM, Joshua wrote: > > > I am currently in a masters level Compiler class. We have a final > > project for the class and I was wondering if there would be any > > defects/enhancements that I

VerifyError overrides final method / forwarding interface calls to multimethods

2009-02-19 Thread Eric Thorsen
I wanted to expose a method in the super class and use this generated class as a stub to derive from and forward calls to multimethods etc. I was hoping doing just this would work: (ns test.CLjTreeCellRenderer (:gen-class :extends javax.swing.tree.DefaultTreeCellRenderer :exposes-methods

Re: how to learn clojure ?

2009-02-19 Thread Rayne
Telling someone to read a book that isn't even focused on the language he's trying to learn isn't a great way to help them. Tell him to read Programming Clojure or something, anything but Common Lisp and Scheme books, he isn't learning those languages he's learning Clojure. There is enough informa

Clojure documentation problems

2009-02-19 Thread David Sletten
The macros page at clojure.org (http://clojure.org/macros) has links to several points in the API page. The link to the "if-not" macro appears to be broken (http://clojure.org/api#if-not). There is no such entry in the API. The same holds true for the "condp" macro (http://clojure.org/api#

Re: My SLIME installation diary

2009-02-19 Thread David
On Feb 18, 6:34 pm, Phil Hagelberg wrote: > David writes: > The Elisp CL emulation package is documented in its own top-level Info > node for some reason rather than in the Elisp manual. Almost certainly historical -- it must be a later, separate development. It really should be listed in the