Re: Macros applied to entire programs

2009-05-11 Thread Konrad Hinsen
On 12.05.2009, at 05:42, Mark Reid wrote: > I'm quite new to macros so forgive me if this is a naïve question, but > is it possible to write macros that are applied to an entire Clojure > program? It depends on what you call a "program". Clojure code is structured in the form of namespaces, an

Re: More trouble with m-seq in a macro

2009-05-11 Thread Konrad Hinsen
On 11.05.2009, at 23:17, samppi wrote: > user=> (defmacro b [& xs] > `(with-monad maybe-m (m-seq ~xs))) > #'user/b > user=> (b [1 2 3]) > java.lang.IllegalArgumentException: Wrong number of args passed to: > LazilyPersistentVector (NO_SOURCE_FILE:0) > > So there's something wrong with how I'm phr

Re: Macros applied to entire programs

2009-05-11 Thread Mark Reid
Hi, I have read Graham's "On Lisp". That, and my background in Java and Haskell programming were the main reasons I was drawn to Clojure. Based on that article and others like it I had the impression that program transformations like the one I suggested were relatively easy in homoiconic language

Re: Macros applied to entire programs

2009-05-11 Thread Sean Devlin
Macros are definitely the tool to do this. Take a look here at Paul Graham's "The Roots of Lisp". In it you'll get an idea of why eval is so powerful, and why macros are exactly the tool for the job you're thinking of. http://lib.store.yahoo.net/lib/paulgraham/jmc.ps I'll let someone else answ

Macros applied to entire programs

2009-05-11 Thread Mark Reid
Hi, I'm quite new to macros so forgive me if this is a naïve question, but is it possible to write macros that are applied to an entire Clojure program? The reason I ask is that, in other threads in this group, some simple transformations to improve efficiency of Clojure programs were mentioned.

Re: Yet Another Swing Example

2009-05-11 Thread Curran Kelleher
Aha! I discovered a solution to the window-closing problem mentioned above: calling (.dispose frame) on the window closing event will cause the application to exit when running independently (I guess because it causes everything to be garbage collected thus the VM terminates (?) ) , but doesn't ki

Re: stumped by class not found (vista)

2009-05-11 Thread Terry Hannant
On Tue, May 12, 2009 at 8:43 AM, tarvydas wrote: > > - Why does closing the test gui cause slime to stop? Most likely because your app has the default close operation to be JFrame.EXIT_ON_CLOSE Thus when you close the gui the JVM exits, which is the same JVM that slime is using Terry Hannant

Re: stumped by class not found (vista)

2009-05-11 Thread Shawn Hoover
On Mon, May 11, 2009 at 7:13 PM, tarvydas wrote: > > - Where does the output from println go? I put println's in the proxy > callbacks, but I don't see the output in the slime repl nor in the > *Messages* buffer (I know that the callbacks are working, because they > also alter components of the g

Re: stumped by class not found (vista)

2009-05-11 Thread tarvydas
On May 11, 2:07 am, Terry Hannant wrote: > Hi > > You can use > > (. System getProperty "java.class.path") - To check class path > > (. System getProperty "user.dir") - Current working directory > > from your Slime REPL to check Thanks. For future reference: my problem was based on a misunde

CANCELED: Clojure talk at LispNYC May 12

2009-05-11 Thread Stuart Sierra
Hi folks, I just found out that my presentation for tomorrow has been canceled, due to problems with the venue. But LispNYC will still be meet at the Sunburnt Cow, 137 Avenue C between 9th & 10th Streets. I'll be there to talk about Clojure over drinks. My presentation has been postponed to Jun

More trouble with m-seq in a macro

2009-05-11 Thread samppi
I'm having trouble using clojure.contrib.monads/m-seq in a macro. Let's say that I just want to create a macro version of m-seq. Clojure 1.0.0- user=> (use 'clojure.contrib.monads) nil user=> (with-monad maybe-m (m-seq [1 2 3])) (1 2 3) user=> (defn a [& xs] (with-monad maybe-m (m-seq [1 2 3])))

Re: Yet Another Swing Example

2009-05-11 Thread Curran Kelleher
l code is posted here for those interested: http://curransoft.com/code/clj-grapher-20090511.zip It's an intermediate stage of a larger project which will eventually involve parsing a simple math language and rendering a 3D surface using OpenGL. I've learned a lot from progressing thus far

Re: Yet Another Swing Example

2009-05-11 Thread billh04
Not sure about the "alt+f4", but to have the application quit when the last window is closed, look at "achiFrameAdapter" in the code at the following url: http://tiny.cc/2FkMf. The application is setup to track multiple windows being opened, and when there are no more windows, the app

Re: binding inside loop

2009-05-11 Thread Rich Hickey
On May 11, 2:20 pm, Vincent Akkermans wrote: > Hi all, > > I'm building an application in which I want some function calls to be > logged. However, when I have function A and B (both will be logged) > and A is called from B, I want the log to show this relation. I > defined a small macro for th

Re: Clojure talk in NYC May 12

2009-05-11 Thread Stuart Sierra
The official announcement: Stuart Sierra presents: Implementing AltLaw.org in Clojure This talk demonstrates the power of combining Clojure with large Java frameworks, such as: * Hadoop - distributed map/reduce processing * Solr - text indexing/searching * Restlet - REST-orien

Re: Symbol macros and local macros

2009-05-11 Thread Tom Faulhaber
Konrad, Your post didn't get any feedback, but I wanted to say that this is a very nice piece of functionality and will be a great help when creating DSLs in Clojure. I look forward to taking advantage of it. Thanks, Tom Konrad, Your post didn't get any feedback, but I wanted to say that this

Does ProGuard work with clojure?

2009-05-11 Thread Andreas Franke
Hello! Since I'm new to this group, let me say that recently I got interested in clojure, coming from Mozart/Oz, Common Lisp, and scheme. And I like it. A lot, in fact.:) Now... does anyone know whether ProGuard works with clojure? (I'm using proguard4.4beta2 with clojure 1.0.0.RC1.) In the fol

binding inside loop

2009-05-11 Thread Vincent Akkermans
Hi all, I'm building an application in which I want some function calls to be logged. However, when I have function A and B (both will be logged) and A is called from B, I want the log to show this relation. I defined a small macro for this purpose: (def *hierarchy* []) (def *action-id* nil) (d

Re: Designing an SQL-based application

2009-05-11 Thread Sean Devlin
Okay, good point about approach #2. As I mentioned earlier, I'd use approach #3 first. Here's how I'd write your macro as a function (defn process-feeds [feeds body] (body feeds)) And I'd call it like this (process-feeds (get-feeds-s-exp ...) (fn [feeds] body)) The first thing I'd like t

[ANN] Moustache, a micro web framework

2009-05-11 Thread Christophe Grand
Hi all! I'm happy to announce the public release of Moustache a micro web framework whose sole purpose is to ease composing Ring handlers and middlewares (hence you can mix Compojure and Moustache). The mandatory hello-world: (app ["hi"] {:get "Hello group!"}) I wrote a quick walk-through: ht

Re: Designing an SQL-based application

2009-05-11 Thread Victor Rodriguez
On Mon, May 11, 2009 at 11:32 AM, Sean Devlin wrote: > > Here are my thoughts on the three approaches: > > Approach #1:  This seems the most straightforward.  I'd write a > function that takes a map of conditions, and returns a list of > tuples.  You can then do what you want with the list of tup

Re: Designing an SQL-based application

2009-05-11 Thread Sean Devlin
Here are my thoughts on the three approaches: Approach #1: This seems the most straightforward. I'd write a function that takes a map of conditions, and returns a list of tuples. You can then do what you want with the list of tuples. Approach #2: Remember the first rule of macro club: Don't

Re: Add JNDI lookup support for contrib/sql

2009-05-11 Thread Stephen C. Gilardi
On May 9, 2009, at 2:33 AM, Mark Derricutt wrote: Can we add the following to contrib's sql namespace, it simply adds "jndi" as a db-spec scheme ( I also raised this as http://code.google.com/p/clojure-contrib/issues/detail?id=39 , which google decided to set as a defect and I can't change):

Re: HTTP clients in clojure

2009-05-11 Thread Perry Trolard
> Let me know if you find it useful. I would love to get some comments. > -Phil Hi Phil, I'm trying out clojure-http-client, & thus far I like the idea of it quite a bit: a simple but clever wrapper on built-in JDK APIs, so provides convenience w/o the burden of external jars. Quickly, I ran in

Re: Clojure talk in NYC May 12

2009-05-11 Thread Tom Hickey
In case anyone was looking for updated info, it can be found here: http://www.lispnyc.org/home.clp On Apr 29, 11:16 am, Stuart Sierra wrote: > Hi, Clojurians, > I'll be talking about my work with Clojure at LispNYC on Tuesday, May > 12. Time (evening) & location to be announced. Slides and >

Re: Using a monad's m-plus function inside a macro

2009-05-11 Thread Konrad Hinsen
On May 11, 2009, at 15:03, Rich Hickey wrote: > I have to admit to not having had time to go through your monad code > in detail, but I'd like to ask the general question: > > Why not use dynamic binding in a Clojure implementation of monads? That is an option I had considered, but quickly aband

Re: Using a monad's m-plus function inside a macro

2009-05-11 Thread Rich Hickey
On May 11, 2:40 am, Konrad Hinsen wrote: > On 11.05.2009, at 03:00, Rich Hickey wrote: > > > Could you explain a bit why you needed to do this? I'm a bit concerned > > about libraries requiring symbol-macros. > > Here is a simplified view of how my monad library works. Each monad > is an object

Re: Getting slime-edit-definition to work with Clojure

2009-05-11 Thread Shawn Hoover
On Fri, May 8, 2009 at 5:43 AM, Baishampayan Ghose wrote: > > Stephen C. Gilardi wrote: > > > I've simplified my .emacs file and clojure launch script to only what's > > required for my slime setup to work with swank-clojure. With this > > simplified setup, I confirmed that slime's repl works and

Re: implicit dosync?

2009-05-11 Thread Rich Hickey
On May 11, 3:13 am, Mark Engelberg wrote: > I'm curious, wouldn't it be possible for every ref-set to be > implicitly wrapped in a dosync? That way, you wouldn't have to > explictly wrap ref-set in a dosync for the times where you just want > to change one ref. You'd only need to explicitly c

Re: Yet Another Swing Example

2009-05-11 Thread fendres
On May 8, 4:25 am, Curran Kelleher wrote: > Hello, > > I've posted an example of a simple model-view-controller GUI skeleton > in Clojure > here:http://lifeofaprogrammergeek.blogspot.com/2009/05/model-view-controll... > > The GUI has a text box and a panel which draws what you type. It's not > m

Re: stumped by class not found (vista)

2009-05-11 Thread Terry Hannant
Hi You can use (. System getProperty "java.class.path") - To check class path (. System getProperty "user.dir") - Current working directory from your Slime REPL to check For using Slime and Clojure I recommend Bill Clementson's blog entry here: http://bc.tech.coop/blog/081205.html which ha

Re: stumped by class not found (vista)

2009-05-11 Thread James Reeves
On May 11, 4:42 am, tarvydas wrote: > I added a full path to my working directory in the CLASSPATH > environment variable (using the control panel) and that didn't appear > to help. In order for gui.Mainframe to work, there needs to be a directory $d in your classpath such that the file $d/gui/M

Re: implicit dosync?

2009-05-11 Thread B Smith-Mannschott
On Mon, May 11, 2009 at 09:13, Mark Engelberg wrote: > > I'm curious, wouldn't it be possible for every ref-set to be > implicitly wrapped in a dosync?  That way, you wouldn't have to > explictly wrap ref-set in a dosync for the times where you just want > to change one ref.  You'd only need to e

Designing an SQL-based application

2009-05-11 Thread Janico Greifenberg
Hi, I'm writing an RSS-reader using compojure and clojure.contrib.sql. As this is my first project in a functional language, I'm not sure about how to design the application. The concrete question I'm having right now, is how to encapsulate database queries in functions. For my RSS-reader, a basi

implicit dosync?

2009-05-11 Thread Mark Engelberg
I'm curious, wouldn't it be possible for every ref-set to be implicitly wrapped in a dosync? That way, you wouldn't have to explictly wrap ref-set in a dosync for the times where you just want to change one ref. You'd only need to explicitly call dosync when you need to wrap more than one ref-se

Re: Concerns About Pushing Clojure 1.0.0 to Maven Central Repo?

2009-05-11 Thread Stefan Hübner
On 10 Mai, 22:17, d...@kronkltd.net (Daniel E. Renfer) wrote: > Phil Hagelberg writes: > > Howard Lewis Ship writes: > > >> clojure-lang because there will be a clojure-contrib artifact for the > >> same group. > > > And this is ... a bad thing? I'm lost. > > > -Phil > > Good, at least I'm not t