clj-nativedep version 0.2.0 released

2015-12-21 Thread Ralph Ritoch
Hi,

A new version of the clj-nativedep library has been released to clojars. 
The library provides a "standard" way to handle native library dependencies 
and OS detection. This version adds support for explicit mac detection via 
the (mac?) function.

See: https://github.com/rritoch/clj-nativedep

Clojars/Leiningen dependency:

[clj-nativedep "0.2.0"]

Best Regards,
  Ralph Ritoch

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Clojure OSGI (Java 9?) support library ready for review

2015-07-06 Thread Ralph Ritoch
Hi,

   I created a library on github 
https://github.com/rritoch/clj-osgi-namespaces which facilitates "namespace 
isolation" and clojure namespace imports and exports for OSGI environments. 
Since this library and related libraries produce bundles it doesn't seem 
appropriate for Clojars. Both a hello world bundle and a hello world user 
bundle which imports from hello world have been tested and appear to be 
fully functional. Feel free to use and extend this code at will as I'm 
releasing it under the MIT license.

Best Regards,
  Ralph Ritoch

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Lein-SableCC 1.0.0 is released

2015-01-01 Thread Ralph Ritoch
This is the first release of the lein-sablecc leiningen plugin.

This project is on github at https://github.com/rritoch/lein-sablecc

It has been released to clojars at https://clojars.org/lein-sablecc

Description:

This plugin integrates the SableCC Compiler Compiler with a leiningen 
project. The primary purpose of this plugin is to simplify the task of 
developing compilers and interpreters in Clojure. The plugin facilitates 
compilation of SableCC grammar files via the command line and provides a 
hook to the leiningen javac task to integrate SableCC generation and 
compilation with the normal leiningen compilation process.

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: For review: Clojure Namespace Isolation

2014-12-08 Thread Ralph Ritoch
One important piece of information about this feature is that it doesn't 
manipulate classloaders.  This feature was designed to be used with OSGi or 
applications that handle their own classloading issues.  In a typical 
application when entering a namespace isolation you may also need to bind a 
separate Compiler/LOADER and Thread context loader, but those classloaders 
can, and should, have common parent classloaders to load clojure from the 
same classloader. This feature simply isolates clojure namespaces, it 
doesn't manipulate the underlying Java support systems which can already be 
manipulated with existing clojure features.  The benefit of this feature is 
that you can create separate namespace environments with different copies 
of the same namespace names without needing to run separate run-times 
making it possible for them to directly share all clojure data types via 
shared namespaces since they're loaded by the same classloader. A side 
effect of the implementation is that it is possible to copy namespaces from 
one environment to another if you have the pointer returned from creating 
the environment. I have considered adding automatic creation of dynamic 
classloaders and associating them with isolation environments but that can 
be done from libraries using existing clojure features. 

For future reference since additional features will likely be added to this 
fork, this feature is implemented via the git commit 
https://github.com/rritoch/clojure/commit/0f4804bbf584049fd85ffa872f10522cc41eff9a






-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: For review: Clojure Namespace Isolation

2014-12-08 Thread Ralph Ritoch
Gary,

  One additional note. When your about to use a dependency you will still 
need to enter into the isolation of that dependency for any feature that 
accesses namespaces not in your current environment (such as any call to 
the dependency which uses conflicting namespaces). Not every feature of a 
dependency will require the conflicting dependencies, but some will. It 
wouldn't be easy, or automatic, but it would become possible.

Best Regards,
  Ralph Ritoch

On Monday, December 8, 2014 9:23:12 PM UTC+8, Ralph Ritoch wrote:
>
> Gary,
>
>What your stating is possible with this, but it wouldn't be automatic. 
> You could load the one dependency in one isolation, and load the second 
> dependency in a second isolation.  This is where a bit of "hard work" would 
> be needed to keep the pointers returned when you create the two 
> environments, Go into each environment to grab pointers to the namespace(s) 
> you depend on. Then you need to create your own instance of a namespace 
> container (clojure.lang.NamespaceContainer.) which gives you the capability 
> of calling it's putIfAbsent method to import object references of those 
> namespaces from the two environments.  This was not an intended feature, 
> but it is a feature that can be accessed.
>
> Best Regards,
>   Ralph Ritoch
>
> On Monday, December 8, 2014 8:39:29 PM UTC+8, Gary Verhaegen wrote:
>>
>> Naive question: does that solve the dependency problem where two explicit 
>> dependencies depend on different versions of a transitive one and something 
>> breaks because of it?
>>
>> On Monday, 8 December 2014, Ralph Ritoch  wrote:
>>
>>> Thank you. I have signed the contributor agreement and applied to join 
>>> clojure-dev (request pending).
>>>
>>> On Monday, December 8, 2014 3:38:15 AM UTC+8, Alan Forrester wrote:
>>>>
>>>> On 7 December 2014 at 19:27, Fluid Dynamics  wrote: 
>>>> > On Sunday, December 7, 2014 11:12:37 AM UTC-5, Bozhidar Batsov wrote: 
>>>> >> 
>>>> >> I think you should post this to cloju...@googlegroups.com 
>>>> > 
>>>> > 
>>>> > To where? Your post displayed like that, and I couldn't get a usable 
>>>> tooltip 
>>>> > expanding the address by mousing over it either. 
>>>>
>>>> clojure slash dev at googlegroups dot com 
>>>>
>>>> with no spaces and with @ and - in place of slash and at. 
>>>>
>>>> Alan 
>>>>
>>>  -- 
>>> 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, send email to
>>> clojure+unsubscr...@googlegroups.com
>>> For more options, visit this group at
>>> http://groups.google.com/group/clojure?hl=en
>>> --- 
>>> You received this message because you are subscribed to the Google 
>>> Groups "Clojure" group.
>>> To unsubscribe from this group and stop receiving emails from it, send 
>>> an email to clojure+unsubscr...@googlegroups.com.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: For review: Clojure Namespace Isolation

2014-12-08 Thread Ralph Ritoch
Gary,

   What your stating is possible with this, but it wouldn't be automatic. 
You could load the one dependency in one isolation, and load the second 
dependency in a second isolation.  This is where a bit of "hard work" would 
be needed to keep the pointers returned when you create the two 
environments, Go into each environment to grab pointers to the namespace(s) 
you depend on. Then you need to create your own instance of a namespace 
container (clojure.lang.NamespaceContainer.) which gives you the capability 
of calling it's putIfAbsent method to import object references of those 
namespaces from the two environments.  This was not an intended feature, 
but it is a feature that can be accessed.

Best Regards,
  Ralph Ritoch

On Monday, December 8, 2014 8:39:29 PM UTC+8, Gary Verhaegen wrote:
>
> Naive question: does that solve the dependency problem where two explicit 
> dependencies depend on different versions of a transitive one and something 
> breaks because of it?
>
> On Monday, 8 December 2014, Ralph Ritoch > 
> wrote:
>
>> Thank you. I have signed the contributor agreement and applied to join 
>> clojure-dev (request pending).
>>
>> On Monday, December 8, 2014 3:38:15 AM UTC+8, Alan Forrester wrote:
>>>
>>> On 7 December 2014 at 19:27, Fluid Dynamics  wrote: 
>>> > On Sunday, December 7, 2014 11:12:37 AM UTC-5, Bozhidar Batsov wrote: 
>>> >> 
>>> >> I think you should post this to cloju...@googlegroups.com 
>>> > 
>>> > 
>>> > To where? Your post displayed like that, and I couldn't get a usable 
>>> tooltip 
>>> > expanding the address by mousing over it either. 
>>>
>>> clojure slash dev at googlegroups dot com 
>>>
>>> with no spaces and with @ and - in place of slash and at. 
>>>
>>> Alan 
>>>
>>  -- 
>> 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, send email to
>> clojure+unsubscr...@googlegroups.com
>> For more options, visit this group at
>> http://groups.google.com/group/clojure?hl=en
>> --- 
>> You received this message because you are subscribed to the Google Groups 
>> "Clojure" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to clojure+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
>

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: For review: Clojure Namespace Isolation

2014-12-08 Thread Ralph Ritoch
Thank you. I have signed the contributor agreement and applied to join 
clojure-dev (request pending).

On Monday, December 8, 2014 3:38:15 AM UTC+8, Alan Forrester wrote:
>
> On 7 December 2014 at 19:27, Fluid Dynamics  > wrote: 
> > On Sunday, December 7, 2014 11:12:37 AM UTC-5, Bozhidar Batsov wrote: 
> >> 
> >> I think you should post this to cloju...@googlegroups.com 
> > 
> > 
> > To where? Your post displayed like that, and I couldn't get a usable 
> tooltip 
> > expanding the address by mousing over it either. 
>
> clojure slash dev at googlegroups dot com 
>
> with no spaces and with @ and - in place of slash and at. 
>
> Alan 
>

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


For review: Clojure Namespace Isolation

2014-12-06 Thread Ralph Ritoch
Hello,

   I have created a way to create namespace isolation within clojure. The 
code is available on github @ https://github.com/rritoch/clojure .  What 
this new code does is it replaces the clojure.lang.Namespace/namespaces 
static property with a clojure.lang.NamespaceContainer object that is a 
version which utilizes thread local memory and facilitates creating 
separate namespace environments within a single Runtime.

To create and enter a new environment.

(clojure.lang.NamespaceContainer/enter)

This returns a pointer which can later be used to re-enter the namespace as 
the enter method also takes a single argument of that pointer.

To leave the isolation environment ...

(clojure.lang.NamespaceContainer/exit)

When used with OSGi this should make it possible to maintain a single 
Runtime per clojure version running on a system. 

To ensure maximum stability, the current namespace and all of it's 
dependent namespaces are copied into the newly created container. Once 
inside a new container, changes can be made without any risk of namespace 
conflicts with other parts of the system.

I would like to submit these features for addition to Clojure.

Best Regards,
  Ralph Ritoch

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ANN] Clojure 1.4 Released

2012-04-18 Thread Ralph Moritz
clojure.org needs to be updated with a release announcement for 1.4.

On Wednesday, April 18, 2012 4:05:15 AM UTC+2, Alan Dipert wrote:
>
> We are pleased to announce the release of Clojure 1.4:
>
>   http://clojure.org/downloads
>
> For maven/leiningen users, your settings are now:
>
>   :dependencies [[org.clojure/clojure "1.4.0"]]
>
> This release includes significant features and bug fixes, documented
> here:
>
>   https://github.com/clojure/clojure/blob/master/changes.md
>
> The number of Clojure contributors continues to grow. Thanks to all
> the people whose code is included in this release:
>
>   Aaron Bedra
>   Aaron Cohen
>   Achim Passen
>   Alan Dipert
>   Alexander Taggart
>   Alex Miller
>   Alex Osborne
>   Alex Ott
>   Alex Redington
>   Allen Rohner
>   Andy Fingerhut
>   Baishampayan Ghose
>   Benjamin Teuber
>   Ben Smith-Mannschott
>   Brian Hurt
>   Chas Emerick
>   Chris Houser
>   Chris Perkins
>   Christophe Grand
>   Christopher Redinger
>   Clinton R. Nixon
>   Colin Jones
>   Cosmin Stejerean
>   Daniel Solano Gómez
>   David Liebke
>   David McNeil
>   David Miller
>   David Powell
>   David Rupp
>   Devender Gollapally
>   Dimitry Gashinsky
>   Drew Raines
>   Eric Schoonover
>   Michael Fogus
>   Frantisek Sodomka
>   George Jahad
>   Jarkko Oranen
>   Jason Wolfe
>   James Reeves
>   Juha Arpiainen
>   Justin Balthrop
>   Kevin Downey
>   Konrad Hinsen
>   Kurt Harriger
>   Lauri Pesonen
>   Luke VanderHart
>   Matt Revelle
>   Meikel Brandmeyer
>   Micah Martin
>   Michał Marczyk
>   Mike Hinchey
>   Nicolas Buduroi
>   Paul Michael Bauer
>   Paul Stadig
>   Phil Hagelberg
>   Rasmus Svensson
>   Richard Newman
>   Rich Hickey
>   Robert Lachlan
>   Sean Corfield
>   Stephen C. Gilardi
>   Steve Gilardi
>   Steve Miner
>   Stuart Halloway
>   Stuart Sierra
>   Tassilo Horn
>   Tim Dysinger
>   Timothy Pratley
>   Tom Faulhaber
>
> Thanks to all involved!
>
> Alan
> Clojure/core
>
>

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Explanation of with-resource

2011-11-21 Thread Ralph Moritz
Brilliant, thanks Meikel! Quite a complex macro, that.

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Proposal: libraries should have type hints

2011-11-21 Thread Ralph
I want to propose that Clojure libraries should be fully "type-hinted"
-- that is, they should be compiled with the "*warn-on-reflection*"
option turned on and type hints place wherever possible.

I understand the argument against type-hinting end-user code until a
performance problem is demonstrated, and then only adding the hints
where needed to fix the performance problems.

Library writers, however, should add them wherever possible. The
library writer has no way of knowing if his/her library will be used
in a time-critical part of the application.

If the application writer has to modify each library to add these type
hints, long-term maintenance will be a nightmare. With each release of
the library, the developer will have to re-check the performance and
fix the library source code to add these hints.

Am I way off base?

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Explanation of with-resource

2011-11-21 Thread Ralph Moritz
Hi Clojurians!

Please could somebody explain the code highlighted expression below to me? 
(Adapted from *The Joy of Clojure*, listing 8.9)

(defmacro with-resource [bindings close-fn & body]
>   `(let ~bindings
>  (try
>~@body
>(finally
> (~close-fn ~(bindings 0))


I've changed the name of the variable from binding to bindings as I 
originally thought this was calling the function binding! I've also removed 
the redundant do loop. Using macroexpand-1 on the code yields the following:

user> (macroexpand-1 '(with-resource [x 1] #(println %)))
> (clojure.core/let [x 1] (try (finally ((fn* [p1__1605#] (println 
> p1__1605#)) x


 It seems like the highlighted expression is indexing into the let vector 
at position 0.  Neat trick, but this doesn't seem to work when multiple 
variables are being bound by the let. So how would one modify with-resource to 
call close-fn with multiple variables?

Regards,
Ralph

 

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Re: Guidelines for contributing?

2011-09-01 Thread Ralph Moritz
Thanks, If I'd read that page carefully & done a search in JIRA I
would've seen that CLJS-24 already addresses this. Doh!

On Sep 1, 4:26 pm, Luc Prefontaine 
wrote:
> Look at this:
>
> http://clojure.org/contributing
>
> Luc P.
>
> On Thu, 1 Sep 2011 04:53:20 -0700 (PDT)
>
> Ralph Moritz  wrote:
> > Hi Clojurians!
>
> > I created my first JIRA issue today (CLJ-834), but I didn't assign it
> > to anyone, because I didn't know who to assign it to! Also, I'm not
> > sure what the procedure is for submitting code - do you generally post
> > to this group & JIRA or just create an issue? Any guidelines would be
> > welcome.
>
> > Regards,
> > Ralph
>
> --
> Luc P.
>
> 
> The rabid Muppet

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Guidelines for contributing?

2011-09-01 Thread Ralph Moritz
Hi Clojurians!

I created my first JIRA issue today (CLJ-834), but I didn't assign it
to anyone, because I didn't know who to assign it to! Also, I'm not
sure what the procedure is for submitting code - do you generally post
to this group & JIRA or just create an issue? Any guidelines would be
welcome.

Regards,
Ralph

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


ClojureCLR NotImplementedException

2011-08-02 Thread Ralph Moritz
I can compile the following simple program, but when I try to run it
I get an error:

Unhandled Exception: System.NotImplementedException: details
at ClrExperiments.Employee.details()
at ClojureClrExperiment.Program.Main()

Here is the Clojure code:

(ns clr-experiments.core)

(defn details []
  (let [hash (System.Collections.Hashtable.)]
(doto hash
  (. Add "Name" "Ralph")
  (. Add "Age" 27))
hash))


(gen-class :name "ClrExperiments.Employee"
   :methods [[details [] System.Collections.Hashtable]])

And the C# calling code:

using System;
using ClrExperiments;

namespace ClojureClrExperiment {
  class Program {
static void Main() {
  var emp = new Employee();
  var hash = emp.details();

  foreach (var key in hash) {
Console.WriteLine("{0}: {1}", key, hash[key]);
  }
  Console.ReadKey();
}
  }
}

Looking at the generated assembly `ClrExperiments.Employee.dll` with
ILSpy,
I see that `details()` contains the following code:

public override Hashtable details() {
  Var expr_05 = Employee.details__var;
  object expr_16 = (!expr_05.isBound) ? null : expr_05.get();
  if (expr_16 != null) {
return ((IFn)expr_16).invoke(this);
  }
  throw new NotImplementedException("details");
}

So it would appear that `clr-experiments.core/details` isn't being
bound. Could someone please help me figure out what's going wrong?

I'm using clojure-clr-1.3.0-alpha6-Debug-4.0 from GitHub.

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: #= reader macro

2011-06-21 Thread Ralph
I realized that I got the anaphora idiom wrong after I posted. I
changed it in my test code.

Thanks.

On Jun 20, 6:31 am, Jonathan Fischer Friberg 
wrote:
> You should use ~' for anaphora.
>
> If for example `~this is used, 'this' is going to be unquoted, and the
> content of "this" will be backquoted.
> With ~'this , the symbol "this" is first quoted, and then that symbol is
> unquoted, resulting in the symbol "this".
>
> Backquote should by the way definitely not be used since it resolves the
> symbol to the current namespace, which is not what you want.
>
> Jonathan
>
> On Mon, Jun 20, 2011 at 3:42 AM, Anthony Grimes 
> wrote:
>
>
>
> > Check out Seesaw . It's a Clojure Swing
> > wrapper that really cuts back on boilerplate, and will probably serve you
> > better than rolling your own making-swing-manageable macros.
>
> > Happy hacking!
>
> >  --
> > 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, send email to
> > clojure+unsubscr...@googlegroups.com
> > For more options, visit this group at
> >http://groups.google.com/group/clojure?hl=en

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


#= reader macro

2011-06-19 Thread Ralph
I just "discovered" the "#=" reader macro from a post on Stackoverflow
and it solves a problem. How likely is this reader macro to become an
official (documented) part of the language? How about deprecated or
changed behavior?

I am trying to use Stuart Sierra's "do-template" inside a
"defprotocol" to declare multiple similar methods:

(defprotocol AProtocol
  (a-method [this])
  #=(do-template [name]
`(~(symbol (str name "-method")) [`~this `~that])
foo bar baz))

should expand to

(defprotocol AProtocol
  (a-method [this])
  (foo-method [this that])
  (bar-method [this that])
  (baz-method [this that]))

When I tried the "do-template" without the "#=" macro, the compiler
complained that I was redefining "do-template", so I need the "do-
template" expanded *before* the "defprotocol". Is there any other way?

Is the "do-template" correct to expand to what I need? I tried testing
it with "macroexpand" and "macroexpand-1", but got:

(do (clojure.core/seq (clojure.core/concat (clojure.core/list (symbol
(str foo "-method"))) (clojure.core/list (clojure.core/apply
clojure.core/vector (clojure.core/seq (clojure.core/concat
(clojure.core/list (quote user/this)) (clojure.core/list (quote user/
that (clojure.core/seq (clojure.core/concat (clojure.core/list
(symbol (str bar "-method"))) (clojure.core/list (clojure.core/apply
clojure.core/vector (clojure.core/seq (clojure.core/concat
(clojure.core/list (quote user/this)) (clojure.core/list (quote user/
that (clojure.core/seq (clojure.core/concat (clojure.core/list
(symbol (str baz "-method"))) (clojure.core/list (clojure.core/apply
clojure.core/vector (clojure.core/seq (clojure.core/concat
(clojure.core/list (quote user/this)) (clojure.core/list (quote user/
that)

Nice! :-).

Are my anaphora (`~this `~that) correct?

Thanks.

BTW, I am writing my first large (several KLOC) Clojure program using
Swing -- I need to set similar actionListeners on several JButtons
(mondayButton, tuesdayButton, etc.) and thought that "do-template"
would be the perfect tool.

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Idiomatic way to document defn's

2011-05-13 Thread Ralph
What is the idiomatic way to document defn's? In particular, should we use 
"@param", "@returns", etc. to document parameters, return values, etc.

It might be good to have some standard way to specify expected parameter 
types (other that type hints), especially for a dynamically typed language.

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Lazy Programming

2010-12-15 Thread Ralph
I'm not sure what all the hype is about lazy programming.

I've been a lazy programmer for more than 30 years. :-)

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Doc string removed from clojure.xml/emit

2010-12-14 Thread Ralph
Any reason why the doc string has been removed from clojure.xml/emit
(and emit-element)? Are these functions deprecated?

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Message to Rich Hickey: Post Hammock-driven development slides

2010-12-05 Thread Ralph
Rich-

Could you post the slides from your "Hammock-driven development" talk?

Most excellent! Awesome in fact :-).

Thanks.

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Clojure vs F# performance

2010-11-23 Thread Ralph
Maybe Microsoft has tuned the CLR for those particular benchmarks
(think "IE9" - not that anyone is accusing them of anything :-)).

On Nov 22, 6:01 pm, Isaac Gouy  wrote:
> On Nov 22, 12:54 pm, Ralph  wrote:
>
> > That is almost certainly true, since the Microsoft have probably done
> > extensive optimization on the CLR.
>
> > On Nov 22, 1:18 pm, Mark Engelberg  wrote:
>
> > > I doubt that F# Mono benchmarks are representative of F#'s performance on
> > > Windows.
>
> If Microsoft have only "*probably* done extensive optimization on the
> CLR" you're better off staying away from "almost certainly true" - how
> about probably true?
>
> http://shootout.alioth.debian.org/demo/compare.php?lang=fsc

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Clojure vs F# performance

2010-11-22 Thread Ralph
That is almost certainly true, since the Microsoft have probably done
extensive optimization on the CLR.

On Nov 22, 1:18 pm, Mark Engelberg  wrote:
> I doubt that F# Mono benchmarks are representative of F#'s performance on
> Windows.

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Clojure vs F# performance

2010-11-22 Thread Ralph
On the Programming Languages Comparison Site (http://
shootout.alioth.debian.org/u64/benchmark.php?
test=all&lang=clojure&lang2=fsharp), if you run the Clojure vs. F#
comparison, Clojure scores about the same in speed as F# (but does use
more memory).

At first this surprised me, since Clojure is dynamically typed, while
F# is statically typed. After some thought, however, it occurred to me
that Clojure can generate code very similar to statically typed
languages using type hints. Of course, as soon as you add type hints,
the code is no longer dynamically typed, but rather statically type.
You lose the ability to do duck-typing on the arguments to a function.

For those cases where performance is more important than flexibility,
Clojure offers an advantage over "traditional" dynamic languages
(Ruby, Python, etc.) in that the programmer can choose.

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Setting Clojure “constants” at runtime (cros sposted to Stackoverflow)

2010-10-25 Thread Ralph
That's interesting... Hadn't thought of using delay. A user on
Stackoverflow (kotarak) suggested using alter-var-root. This method
will also support setting values for command line arguments.

On Oct 24, 3:33 pm, Stuart Sierra  wrote:
> Here's one way:
>
>     (def version (delay (... read the JAR ...))
>
>     (defn get-version [] (force version))
>
> -S
>
> On Oct 22, 11:56 am, Ralph  wrote:
>
>
>
> > I have a Clojure program that I build as a JAR file using Maven.
> > Embedded in the JAR Manifest is a build-version number, including the
> > build timestamp.
>
> > I can easily read this at runtime from the JAR Manifest using the
> > following code:
>
> > (defn set-version
> >   "Set the version variable to the build number."
> >   []
> >   (def version
> >     (-> (str "jar:" (-> my.ns.name (.getProtectionDomain)
> >                                    (.getCodeSource)
> >                                    (.getLocation))
> >                     "!/META-INF/MANIFEST.MF")
> >       (URL.)
> >       (.openStream)
> >       (Manifest.)
> >       (.. getMainAttributes)
> >       (.getValue "Build-number"
> > but I've been told that it is bad karma to use def inside defn.
>
> > What is the Clojure-idiomatic way to set a constant at runtime? I
> > obviously do not have the build-version information to embed in my
> > code as a def, but I would like it set once (and for all) from the
> > main function when the program starts. It should then be available as
> > a def to the rest of the running code.

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Setting Clojure “constants” at runtime (cros sposted to Stackoverflow)

2010-10-23 Thread Ralph
Won't work. The "def" gets executed at compile time, before the JAR
file exists.

On Oct 22, 3:55 pm, ataggart  wrote:
> (defn get-version []
>   (-> (str "jar:" (-> my.ns.name (.getProtectionDomain)
>                                  (.getCodeSource)
>                                  (.getLocation))
>                   "!/META-INF/MANIFEST.MF")
>     (URL.)
>     (.openStream)
>     (Manifest.)
>     (.. getMainAttributes)
>     (.getValue "Build-number")))
>
> (def *version* (get-version))
>
> On Oct 22, 11:56 am, Ralph  wrote:
>
>
>
> > I have a Clojure program that I build as a JAR file using Maven.
> > Embedded in the JAR Manifest is a build-version number, including the
> > build timestamp.
>
> > I can easily read this at runtime from the JAR Manifest using the
> > following code:
>
> > (defn set-version
> >   "Set the version variable to the build number."
> >   []
> >   (def version
> >     (-> (str "jar:" (-> my.ns.name (.getProtectionDomain)
> >                                    (.getCodeSource)
> >                                    (.getLocation))
> >                     "!/META-INF/MANIFEST.MF")
> >       (URL.)
> >       (.openStream)
> >       (Manifest.)
> >       (.. getMainAttributes)
> >       (.getValue "Build-number"
> > but I've been told that it is bad karma to use def inside defn.
>
> > What is the Clojure-idiomatic way to set a constant at runtime? I
> > obviously do not have the build-version information to embed in my
> > code as a def, but I would like it set once (and for all) from the
> > main function when the program starts. It should then be available as
> > a def to the rest of the running code.

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Setting Clojure “constants” at runtime (cros sposted to Stackoverflow)

2010-10-22 Thread Ralph
Yes. I does not work. The "def" gets evaluated at compile-time, not
run-time. The JAR file that the code is reading does not exist until
after the program is compiled.

On Oct 22, 12:28 pm, James Reeves  wrote:
> Is there a reason why you can't (def version ...) directly, without
> calling it via a set-version function?
>
> - James
>
> On 22 October 2010 16:56, Ralph  wrote:
>
>
>
> > I have a Clojure program that I build as a JAR file using Maven.
> > Embedded in the JAR Manifest is a build-version number, including the
> > build timestamp.
>
> > I can easily read this at runtime from the JAR Manifest using the
> > following code:
>
> > (defn set-version
> >  "Set the version variable to the build number."
> >  []
> >  (def version
> >    (-> (str "jar:" (-> my.ns.name (.getProtectionDomain)
> >                                   (.getCodeSource)
> >                                   (.getLocation))
> >                    "!/META-INF/MANIFEST.MF")
> >      (URL.)
> >      (.openStream)
> >      (Manifest.)
> >      (.. getMainAttributes)
> >      (.getValue "Build-number"
> > but I've been told that it is bad karma to use def inside defn.
>
> > What is the Clojure-idiomatic way to set a constant at runtime? I
> > obviously do not have the build-version information to embed in my
> > code as a def, but I would like it set once (and for all) from the
> > main function when the program starts. It should then be available as
> > a def to the rest of the running code.
>
> > --
> > 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, send email to
> > clojure+unsubscr...@googlegroups.com
> > For more options, visit this group at
> >http://groups.google.com/group/clojure?hl=en

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Setting Clojure “constants” at runtime (crosspos ted to Stackoverflow)

2010-10-22 Thread Ralph
I have a Clojure program that I build as a JAR file using Maven.
Embedded in the JAR Manifest is a build-version number, including the
build timestamp.

I can easily read this at runtime from the JAR Manifest using the
following code:

(defn set-version
  "Set the version variable to the build number."
  []
  (def version
(-> (str "jar:" (-> my.ns.name (.getProtectionDomain)
   (.getCodeSource)
   (.getLocation))
"!/META-INF/MANIFEST.MF")
  (URL.)
  (.openStream)
  (Manifest.)
  (.. getMainAttributes)
  (.getValue "Build-number"
but I've been told that it is bad karma to use def inside defn.

What is the Clojure-idiomatic way to set a constant at runtime? I
obviously do not have the build-version information to embed in my
code as a def, but I would like it set once (and for all) from the
main function when the program starts. It should then be available as
a def to the rest of the running code.

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


RFE: modify description of "assoc"

2010-10-14 Thread Ralph
First, how do I submit a request for enhancement?

Second, the documentation for "assoc" in clojure.core should probably
include "(assoc vector index val)" and "(assoc vector index val &
ivs)" in the usage line.

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Wrapping lines in the REPL

2010-05-16 Thread Ralph
I am using La Clojure (IntelliJ) for editing my programs.

Is there any way (pseudo-variable, perhaps) to get the REPL to wrap
lines after a specified number of characters? If I print a sequence
containing a large number of items, I have to scroll right to see the
whole thing.

Thanks, Ralph

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: Reading the manifest file

2010-05-03 Thread Ralph
Yes, but I don't believe that it guarantees that you will get the
manifest for the enclosing JAR file if you have more than one.

On May 3, 10:28 am, Nurullah Akkaya  wrote:
> (let [url (ClassLoader/getSystemResource "META-INF/MANIFEST.MF")
>       manifest (java.util.jar.Manifest. (.openStream url))]
>   (println (.entrySet (.getMainAttributes manifest
>
> ClassLoader/getSystemResource does allow you to get rid of
> Class/forName...
>
> --
> Nurullah Akkayahttp://nakkaya.com
>
> --
> 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, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group 
> athttp://groups.google.com/group/clojure?hl=en

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Reading the manifest file

2010-05-03 Thread Ralph
Crossposted to StackoverFlow.

How can a Clojure program find its own MANIFEST.MF (assuming it is
packaged in a JAR file).

I am trying to do this from my "-main" function, but I can't find a
class to use in the following code:

  (.getValue
(..
  (java.util.jar.Manifest.
(.openStream
  (java.net.URL.
(str
  "jar:"
  (..
(class **WHAT-GOES-HERE**)
getProtectionDomain
getCodeSource
getLocation)
  "!/META-INF/MANIFEST.MF"
  getMainAttributes)
"Build-number"))

I have found an answer that works, however I am open to suggestions
for improving it, particularly replacing the call to Class/forName.

(defn -main [& args]
  (println "Version "
(.getValue
  (..
(Manifest.
  (.openStream
(URL.
  (str
"jar:"
(..
  (Class/forName "org.example.myproject.thisfile")
  getProtectionDomain
  getCodeSource
  getLocation)
"!/META-INF/MANIFEST.MF"
getMainAttributes)
  "Build-number")))

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


Re: finding sequential items from a sequence

2010-04-27 Thread Ralph
I must clarify my question: I need the longest INITIAL sequence where
the items are sequential.

One solution offered by "cgrand" at stackoverflow is

(defn longest-initial-sequence [[x :as s]]
  (take-while identity (map #(#{%1} %2) s (iterate inc x

On Apr 27, 2:59 pm, CuppoJava  wrote:
> Here's an attempt, but it's not my best work. =)
>
> (def temp [2 3 4 6 8 1])
>
> (let [l (filter identity
>           (for [[a b c] (map vector temp (rest temp))]
>             (if (= (- b a) 1)
>               a
>               nil)))]
>   (concat l [(+ (last l) 1)]))
>
>   -Patrick
>
> --
> 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, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group 
> athttp://groups.google.com/group/clojure?hl=en

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en


finding sequential items from a sequence

2010-04-27 Thread Ralph
Crossposted to stackoverflow.

In a Clojure program, I have a sequence of numbers:

(2 3 4 6 8 1)

I want to find the longest sub-sequence where the items are
sequential:

(2 3 4)

I am assuming that it will involve (take-while ...) or (reduce ...).

Any ideas?

-- 
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, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en