Re: clojure-jsr223 and shibboleth ScriptedAttributeDefinition

2011-11-14 Thread Armando Blancas
The compile call is a no-op and makes no difference since the engine
evaluates the script. That looks like a bug in getAttribute(). I use
put and get from the engine directly and may have overlooked something
in the attr calls. I'll upload a fix in google code asap.

On Nov 13, 9:52 am, Francesco  wrote:
> I was trying to write a simple script attribute definition for
> shibboleth as 
> in:https://wiki.shibboleth.net/confluence/display/SHIB2/ResolverScriptAt...
> with the help of clojure-jsr223.
>
> I included both clojure.jar and clojure-jsr223.jar in classpath and
> voila my script in attribute-resolver.xml:
>
>  language="Clojure" xmlns="urn:mace:shibboleth:2.0:resolver:ad">
>         
>          xmlns="urn:mace:shibboleth:2.0:attribute:encoder"
>             name="urn:mace:dir:attribute-def:cljattr" />
>          xmlns="urn:mace:shibboleth:2.0:attribute:encoder"
>             name="urn:mace:unimore.it:attribute-def:cljattr"
> friendlyName="cljattr" />
>         
>            (ns user)
> (import org.slf4j.LoggerFactory)
> (import
> edu.internet2.middleware.shibboleth.common.attribute.provider.BasicAttribut e)
> (import
> edu.internet2.middleware.shibboleth.common.attribute.BaseAttribute)
> (def logger (. org.slf4j.LoggerFactory getLogger
> "edu.internet2.middleware.shibboleth.resolver.Script.cljattr"))
> (def cljattr (BasicAttribute. "cljattr"))
> (.add (.getValues cljattr) "CLOJURE")
> (.info logger (str "cljattr: " (.getValues cljattr)))
>           ]]>
>         
>     
>
> But shibboleth returns:
>
> 18:44:18.771 - INFO
> [edu.internet2.middleware.shibboleth.resolver.Script.cljattr:-2] -
> cljattr: [CLOJURE]
> 18:44:18.772 - ERROR
> [edu.internet2.middleware.shibboleth.common.attribute.resolver.provider.att 
> ributeDefinition.ScriptedAttributeDefinition:
> 129] - user/cljattr produced a null attribute
> 18:44:18.778 - ERROR
> [edu.internet2.middleware.shibboleth.common.attribute.AttributeAuthorityCLI :
> 392] - Error encountered during attribute resolution and filtering
> edu.internet2.middleware.shibboleth.common.attribute.resolver.AttributeReso 
> lutionException:
> user/cljattr produced a null attributes
>         at
> edu.internet2.middleware.shibboleth.common.attribute.resolver.provider.attr 
> ibuteDefinition.ScriptedAttributeDefinition.doResolve(ScriptedAttributeDefi 
> nition.java:
> 130) ~[shibboleth-common-1.3.2.jar:na]
>         at
> edu.internet2.middleware.shibboleth.common.attribute.resolver.provider.attr 
> ibuteDefinition.BaseAttributeDefinition.resolve(BaseAttributeDefinition.jav a:
> 108) ~[shibboleth-common-1.3.2.jar:na]
>
> This means script is logging ok and attribute has a value but fails to
> export value to attribute resolver.
>
> Shibboleth source 
> codehttp://svn.shibboleth.net/view/java-shib-common/tags/1.3.4/src/main/j...
> seems to use the getAttribute method of class
> javax.script.SimpleScriptContext, which I could not find in clojure-
> jsr223 source.
>
> Am I missing something?
>
> Can you spot obvious mistakes? Please note changing attribute id from
> 'user/cljattr' to 'cljattr' does not change anything.
>
> thank you for your attention,
>
> Francesco
>
> PS:
> shibboleth claims it is able to compile script:
> 18:44:12.237 - WARN
> [edu.internet2.middleware.shibboleth.common.attribute.resolver.provider.att 
> ributeDefinition.ScriptedAttributeDefinition:
> 153] - user/cljattr unable to compile even though the scripting engine
> supports this functionality.
> actually it is only a warn. Can be important?

-- 
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


java logging properties and lein

2011-11-14 Thread labwork07
I'm interfacing with a java library. I'm getting logging info messages.  
Where do I put the logging.properties file in a lein project?


--
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

java logging properties and lein

2011-11-14 Thread labwork07
I'm interfacing with a java library. I'm getting logging info messages.  
Where do I put the logging.properties file in a lein project?


--
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-jsr223 and shibboleth ScriptedAttributeDefinition

2011-11-14 Thread Armando Blancas
Here's a patch:
http://code.google.com/p/clojure-jsr223/downloads/list

Feel free to file bugs here:
http://code.google.com/p/clojure-jsr223/issues/list

On Nov 13, 9:52 am, Francesco  wrote:
> I was trying to write a simple script attribute definition for
> shibboleth as 
> in:https://wiki.shibboleth.net/confluence/display/SHIB2/ResolverScriptAt...
> with the help of clojure-jsr223.
>
> I included both clojure.jar and clojure-jsr223.jar in classpath and
> voila my script in attribute-resolver.xml:
>
>  language="Clojure" xmlns="urn:mace:shibboleth:2.0:resolver:ad">
>         
>          xmlns="urn:mace:shibboleth:2.0:attribute:encoder"
>             name="urn:mace:dir:attribute-def:cljattr" />
>          xmlns="urn:mace:shibboleth:2.0:attribute:encoder"
>             name="urn:mace:unimore.it:attribute-def:cljattr"
> friendlyName="cljattr" />
>         
>            (ns user)
> (import org.slf4j.LoggerFactory)
> (import
> edu.internet2.middleware.shibboleth.common.attribute.provider.BasicAttribut e)
> (import
> edu.internet2.middleware.shibboleth.common.attribute.BaseAttribute)
> (def logger (. org.slf4j.LoggerFactory getLogger
> "edu.internet2.middleware.shibboleth.resolver.Script.cljattr"))
> (def cljattr (BasicAttribute. "cljattr"))
> (.add (.getValues cljattr) "CLOJURE")
> (.info logger (str "cljattr: " (.getValues cljattr)))
>           ]]>
>         
>     
>
> But shibboleth returns:
>
> 18:44:18.771 - INFO
> [edu.internet2.middleware.shibboleth.resolver.Script.cljattr:-2] -
> cljattr: [CLOJURE]
> 18:44:18.772 - ERROR
> [edu.internet2.middleware.shibboleth.common.attribute.resolver.provider.att 
> ributeDefinition.ScriptedAttributeDefinition:
> 129] - user/cljattr produced a null attribute
> 18:44:18.778 - ERROR
> [edu.internet2.middleware.shibboleth.common.attribute.AttributeAuthorityCLI :
> 392] - Error encountered during attribute resolution and filtering
> edu.internet2.middleware.shibboleth.common.attribute.resolver.AttributeReso 
> lutionException:
> user/cljattr produced a null attributes
>         at
> edu.internet2.middleware.shibboleth.common.attribute.resolver.provider.attr 
> ibuteDefinition.ScriptedAttributeDefinition.doResolve(ScriptedAttributeDefi 
> nition.java:
> 130) ~[shibboleth-common-1.3.2.jar:na]
>         at
> edu.internet2.middleware.shibboleth.common.attribute.resolver.provider.attr 
> ibuteDefinition.BaseAttributeDefinition.resolve(BaseAttributeDefinition.jav a:
> 108) ~[shibboleth-common-1.3.2.jar:na]
>
> This means script is logging ok and attribute has a value but fails to
> export value to attribute resolver.
>
> Shibboleth source 
> codehttp://svn.shibboleth.net/view/java-shib-common/tags/1.3.4/src/main/j...
> seems to use the getAttribute method of class
> javax.script.SimpleScriptContext, which I could not find in clojure-
> jsr223 source.
>
> Am I missing something?
>
> Can you spot obvious mistakes? Please note changing attribute id from
> 'user/cljattr' to 'cljattr' does not change anything.
>
> thank you for your attention,
>
> Francesco
>
> PS:
> shibboleth claims it is able to compile script:
> 18:44:12.237 - WARN
> [edu.internet2.middleware.shibboleth.common.attribute.resolver.provider.att 
> ributeDefinition.ScriptedAttributeDefinition:
> 153] - user/cljattr unable to compile even though the scripting engine
> supports this functionality.
> actually it is only a warn. Can be important?

-- 
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: java logging properties and lein

2011-11-14 Thread joegallo
You could drop it into the root of src, or you can add a :resources-path 
"etc" in your project.clj and then put it in the root of that.  Some 
purists would probably argue that the latter is better, but the former 
should work just fine, too.

-- 
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: java logging properties and lein

2011-11-14 Thread Phil Hagelberg
On Mon, Nov 14, 2011 at 9:22 AM, joegallo  wrote:
> You could drop it into the root of src, or you can add a :resources-path
> "etc" in your project.clj and then put it in the root of that.  Some purists
> would probably argue that the latter is better, but the former should work
> just fine, too.

Actually if the resources/ dir exists in the project root you don't
have to add anything to project.clj; it will use it by default.

-Phil

-- 
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: Re: java logging properties and lein

2011-11-14 Thread labwork07
I put a logging.properties file in the resources directory of the project  
but it does not seem to pick it up. Do I have to do something else to  
override the default logging from the java library I am using?


On , Phil Hagelberg  wrote:

On Mon, Nov 14, 2011 at 9:22 AM, joegallo joega...@gmail.com> wrote:



> You could drop it into the root of src, or you can add a :resources-path


> "etc" in your project.clj and then put it in the root of that. Some  
purists


> would probably argue that the latter is better, but the former should  
work



> just fine, too.





Actually if the resources/ dir exists in the project root you don't



have to add anything to project.clj; it will use it by default.





-Phil





--



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

Re: Re: java logging properties and lein

2011-11-14 Thread Mark Rathwell
> I put a logging.properties file in the resources directory of the project
> but it does not seem to pick it up. Do I have to do something else to
> override the default logging from the java library I am using?

You still need to load the properties and tell the logger to use them.
 Assuming it is using log4j, something like the following should do
that (completely untested though):

...
  (:require [clojure.java.io :as io])
...
(with-open [s (io/input-stream (io/resource "logging.properties"))]
  (org.apache.log4j.PropertyConfigurator/configure
(doto (java.util.Properties.)
  (.load s


On Mon, Nov 14, 2011 at 4:19 PM,   wrote:
> I put a logging.properties file in the resources directory of the project
> but it does not seem to pick it up. Do I have to do something else to
> override the default logging from the java library I am using?
>
> On , Phil Hagelberg  wrote:
>> On Mon, Nov 14, 2011 at 9:22 AM, joegallo joega...@gmail.com> wrote:
>>
>> > You could drop it into the root of src, or you can add a :resources-path
>>
>> > "etc" in your project.clj and then put it in the root of that.  Some
>> > purists
>>
>> > would probably argue that the latter is better, but the former should
>> > work
>>
>> > just fine, too.
>>
>>
>>
>> Actually if the resources/ dir exists in the project root you don't
>>
>> have to add anything to project.clj; it will use it by default.
>>
>>
>>
>> -Phil
>>
>>
>>
>> --
>>
>> 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

-- 
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: Re: java logging properties and lein

2011-11-14 Thread Mark Rathwell
> You still need to load the properties and tell the logger to use them.
>  Assuming it is using log4j, something like the following should do
> that (completely untested though):
>
> ...
>  (:require [clojure.java.io :as io])
> ...
> (with-open [s (io/input-stream (io/resource "logging.properties"))]
>  (org.apache.log4j.PropertyConfigurator/configure
>    (doto (java.util.Properties.)
>      (.load s

I should have noted:  Unless the library you're using is already
checking for and loading a resource called "logging.properties", in
which case it should work just by dropping in the properties file in
the resources directory.

-- 
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


where is defvar?

2011-11-14 Thread Brad
I'm working on moving to Clojure 1.3

Some code is using defvar which use to be in clojure.contrib.def

http://dev.clojure.org/display/design/Where+Did+Clojure.Contrib+Go
mentions that contrib.def partially migrated to clojure.core.incubator
but this new library doesn't  appear to have it.

Is there somewhere else I should look?




-- 
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-in-CommonLisp?

2011-11-14 Thread daly
It seems to me that a Clojure in Common Lisp might be the
easiest non-JVM port. It would be a DSL within Common Lisp.
A CL implementation would even allow rewriting the normal
COND syntax. Is there an obvious reason why this would be
a bad idea?

Heck, it might even be possible to make the port literate :-)

Tim Daly


-- 
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: where is defvar?

2011-11-14 Thread Alan Malloy
(def name doc init)

On Nov 14, 4:03 pm, Brad  wrote:
> I'm working on moving to Clojure 1.3
>
> Some code is using defvar which use to be in clojure.contrib.def
>
> http://dev.clojure.org/display/design/Where+Did+Clojure.Contrib+Go
> mentions that contrib.def partially migrated to clojure.core.incubator
> but this new library doesn't  appear to have it.
>
> Is there somewhere else I should look?

-- 
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-in-CommonLisp?

2011-11-14 Thread Phil Hagelberg
On Mon, Nov 14, 2011 at 4:18 PM, daly  wrote:
> It seems to me that a Clojure in Common Lisp might be the
> easiest non-JVM port. It would be a DSL within Common Lisp.
> A CL implementation would even allow rewriting the normal
> COND syntax. Is there an obvious reason why this would be
> a bad idea?

The biggest problem I can see is that if you do this I will be tempted
to port it to Emacs Lisp as well, the thought of which is slightly
disturbing.

-Phil

-- 
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


Leiningen and Cake

2011-11-14 Thread Phil Hagelberg
Hello folks.

You may have heard some rumours and/or tweetage about Cake and
Leiningen. During the Conj I met with Justin Balthrop and some of the
other Cake developers. They were interested in joining forces to
develop a single unified build tool for Clojure. We talked it through
and I think Leiningen could definitely benefit on the one hand from
having a few of Cake's features ported over and on the other hand from
gaining a bunch of new developers. This will mean Cake may see another
few releases but will have its development efforts directed to
Leiningen.[1]

In particular I'm thinking of two or three things that make sense to
take from Cake for Leiningen 2.0. Firstly there's the use of
in-process classloaders for project execution. I've wanted this for a
while, and they've got a nice well-tested implementation they're
offering to have ported right over. This should speed things up and
offer fairly significant memory savings. The other definite win would
be taking the SCP implementation for Clojars uploads. There is a
lein-clojars plugin, but it has some issues with keys that have
prevented it from being considered for inclusion.

Another thing we may take is the notion of "profiles" or environments
in which tasks execute. Right now Leiningen has a notion of dev time
vs production, which is just a single bit that determines whether
dev-dependencies, tests, and test resources are on the classpath. Cake
(and Maven IIUC) expand on this and allow various config options to be
grouped and activated on a per-profile basis. I'll start a separate
thread discussing this since there's still a fair bit more I'd like to
understand about how people are using this in Cake and how simply it
could be implemented.

We're still thinking through whether it makes sense for Leiningen to
offer persistent/daemonized JVMs to reduce execution time; it may be
simpler to delegate this to Jark[2] instead since it could be
considered fairly orthogonal. If you use Cake and Leiningen and have
some other features you would miss, please mention them.

So I'm excited to welcome them to the team.

Happy Hacking.

-Phil

[1] - 
https://groups.google.com/group/clojure-cake/browse_thread/thread/186ec36c2426996e
[2] - http://icylisper.in/jark

-- 
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-in-CommonLisp?

2011-11-14 Thread daly

On Mon, 2011-11-14 at 16:26 -0800, Phil Hagelberg wrote:
> On Mon, Nov 14, 2011 at 4:18 PM, daly  wrote:
> > It seems to me that a Clojure in Common Lisp might be the
> > easiest non-JVM port. It would be a DSL within Common Lisp.
> > A CL implementation would even allow rewriting the normal
> > COND syntax. Is there an obvious reason why this would be
> > a bad idea?
> 
> The biggest problem I can see is that if you do this I will be tempted
> to port it to Emacs Lisp as well, the thought of which is slightly
> disturbing.
> 
> -Phil
> 
I knocked together a REPL in its own package.

Is there a spec somewhere of the exact syntax accepted by
the Clojure reader?

Tim Daly


-- 
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: where is defvar?

2011-11-14 Thread Brad
Thanks. I couldn't find this mentioned anywhere so I added a comment
on clojuredocs

http://clojuredocs.org/clojure_contrib/clojure.contrib.def/defvar



On Nov 14, 7:26 pm, Alan Malloy  wrote:
> (def name doc init)
>
> On Nov 14, 4:03 pm, Brad  wrote:
>
>
>
>
>
>
>
> > I'm working on moving to Clojure 1.3
>
> > Some code is using defvar which use to be in clojure.contrib.def
>
> >http://dev.clojure.org/display/design/Where+Did+Clojure.Contrib+Go
> > mentions that contrib.def partially migrated to clojure.core.incubator
> > but this new library doesn't  appear to have it.
>
> > Is there somewhere else I should look?

-- 
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: where is defvar?

2011-11-14 Thread Sean Corfield
I've updated Where Did Clojure Contrib Go to indicate this. Happy to
take other suggestions for updates!

On Mon, Nov 14, 2011 at 6:36 PM, Brad  wrote:
> Thanks. I couldn't find this mentioned anywhere so I added a comment
> on clojuredocs
>
> http://clojuredocs.org/clojure_contrib/clojure.contrib.def/defvar

-- 
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


Why no anonymous record types, or (defstruct, create-struct) vs (defrecord, ???)

2011-11-14 Thread John McDonald
Structmaps can be defined either named, thru the defstruct macro, or
anonymously, thru the create-struct function call. Record  types must
be named and defined thru a call to defrecord.

This seems to contradict one of the Clojure library coding standards
(http://dev.clojure.org/display/design/Library+Coding+Standards):
"Don't use a macro when a function can do the job. If a macro is
important for ease-of-use, expose the function version as well."

My particular problem is the following: I read a set of data, say from
a CSV file with column headers. I  produce a representation of the
data as a sequence of cases where each case is a a collection of
annotated key-value pairs. The annotation describes the possible
values that can be associated with a given key, and is usually
determined by introspection on the values that I just read. The
annotation is used to determine details of how certain machine
learning methods can be applied to that data.

I want the case representation to be as compact and speedy as
possible.
The number of cases x number of keys may exceed 10^9, so I don't want
to repeat the actual keys and annotation with each case, and so using
bare maps seems unlikely to be a good solution.

So it looks like the choice is between struct-maps and records. Many
of the values are likely to be byte, short, etc., and it will be
important to save space with an un-boxed representation.

It seem record plus type hints would be the best choice. I can work
around the missing function, by writing my own macro that calls eval,
but that doesn't smell nice.

(PS: 'create-struct' is an unfortunately confusing name. It sounds
more like instantiation of an existing structure definition than a new
definition.  I'd suggest 'define-record' or 'create-record-definition'
for the function equivalent of 'defrecord'.)

-- 
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: where is defvar?

2011-11-14 Thread Phil Hagelberg
On Mon, Nov 14, 2011 at 4:26 PM, Alan Malloy  wrote:
> (def name doc init)

Actually defvar is more like defonce.

-Phil

-- 
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


How cool is tree-seq?

2011-11-14 Thread stevelewis
I discovered tree-seq the other day and it seems like a nice little
function for elegantly dealing with a tree of values. In standard OO,
I would use autocompletion to find the right variable as I loop over
an OO data structure, but tree-seq seems very flexible and generic.

That's all I wanted to say. :)

-- 
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: where is defvar?

2011-11-14 Thread Alan Malloy
On Nov 14, 7:44 pm, Phil Hagelberg  wrote:
> On Mon, Nov 14, 2011 at 4:26 PM, Alan Malloy  wrote:
> > (def name doc init)
>
> Actually defvar is more like defonce.

Huh? I don't see any defonce semantics at
https://github.com/clojure/clojure-contrib/blob/master/modules/def/src/main/clojure/clojure/contrib/def.clj#L23

(defmacro defvar
  "Defines a var with an optional intializer and doc string"
  ;; ...extra arities elided...
  ([name init doc]
 (list `def (with-meta name (assoc (meta name) :doc doc)) init)))

-- 
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: where is defvar?

2011-11-14 Thread Phil Hagelberg
Oh, I was thinking of defvar from Common Lisp. I didn't realize contrib's
version was different; curious.

-Phil
On Nov 14, 2011 8:37 PM, "Alan Malloy"  wrote:

> On Nov 14, 7:44 pm, Phil Hagelberg  wrote:
> > On Mon, Nov 14, 2011 at 4:26 PM, Alan Malloy  wrote:
> > > (def name doc init)
> >
> > Actually defvar is more like defonce.
>
> Huh? I don't see any defonce semantics at
>
> https://github.com/clojure/clojure-contrib/blob/master/modules/def/src/main/clojure/clojure/contrib/def.clj#L23
>
> (defmacro defvar
>  "Defines a var with an optional intializer and doc string"
>  ;; ...extra arities elided...
>  ([name init doc]
> (list `def (with-meta name (assoc (meta name) :doc doc)) init)))
>
> --
> 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

Re: Clojure-in-CommonLisp?

2011-11-14 Thread Cyrus Harmon

Tim,

I've been wanting this for some time. Obviously the java interop stuff poses 
challenges, but the clojure data types, protocols, immutable objects, clojure 
syntax, etc... would make for a nice dialect of lisp to be used alongside other 
CL code. (I guess I'm in the small minority of folks that is much more 
interested in interacting with existing Common Lisp code than with existing 
Java libraries.)

Cyrus

On Nov 14, 2011, at 4:18 PM, daly wrote:

> It seems to me that a Clojure in Common Lisp might be the
> easiest non-JVM port. It would be a DSL within Common Lisp.
> A CL implementation would even allow rewriting the normal
> COND syntax. Is there an obvious reason why this would be
> a bad idea?
> 
> Heck, it might even be possible to make the port literate :-)
> 
> Tim Daly
> 
> 
> -- 
> 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


swank, clojure.repl and my fading sanity

2011-11-14 Thread Yaron
So when I start a repl from the command line things like doc and
source work just fine.

But when I start a repl inside of aquamacs and swank clojure (1.3.3)
(installed via lein plugin) and clojure (1.3.0) via m-x clojure-jack-
in those function/macros don't work at all. For example, if I try (doc
str) I get the error "unable to resolve symbol: doc in this
context" [Thrown class java.lang.RuntimeException].

I tried (ns-all) but it doesn't show clojure.repl as being available.
(use clojure.repl) just gets me a [Thrown class
java.lang.ClassNotFoundException].

Note that the REPL in SWANK works in general. I can evaluate my
functions and they work.

So how do I get clojure.repl to load in SWANK?

 Thanks,

   Yaron

-- 
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: swank, clojure.repl and my fading sanity

2011-11-14 Thread Sean Corfield
Add the following to your ~/.lein/user.clj:

;; ~/.lein/user.clj
(if (>= (.compareTo (clojure-version) "1.3.0") 0)
  (do (use 'clojure.repl)
  (use 'clojure.java.javadoc)))

On Mon, Nov 14, 2011 at 10:57 PM, Yaron  wrote:
> So when I start a repl from the command line things like doc and
> source work just fine.
>
> But when I start a repl inside of aquamacs and swank clojure (1.3.3)
> (installed via lein plugin) and clojure (1.3.0) via m-x clojure-jack-
> in those function/macros don't work at all. For example, if I try (doc
> str) I get the error "unable to resolve symbol: doc in this
> context" [Thrown class java.lang.RuntimeException].
>
> I tried (ns-all) but it doesn't show clojure.repl as being available.
> (use clojure.repl) just gets me a [Thrown class
> java.lang.ClassNotFoundException].
>
> Note that the REPL in SWANK works in general. I can evaluate my
> functions and they work.
>
> So how do I get clojure.repl to load in SWANK?
>
>     Thanks,
>
>       Yaron
>
> --
> 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



-- 
Sean A Corfield -- (904) 302-SEAN
An Architect's View -- http://corfield.org/
World Singles, LLC. -- http://worldsingles.com/

"Perfection is the enemy of the good."
-- Gustave Flaubert, French realist novelist (1821-1880)

-- 
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