Re: last-var-wins: a simple way to ease upgrade pain

2010-05-06 Thread Richard Newman

(+ today (- 14 remind-prior))
= 2 weeks from today - a fixed remind before days
= a date when I am going to be reminded for an event 2 weeks from  
today


I'm deeply suspicious of such a behaviour. Why would + on a
date mean adding days?


Frink (as one example) resolves this through unit tracking. Examples  
from http://futureboy.homeip.net/frinkdocs/#DateTimeHandling:


#1969-08-19 16:54 Mountain# + 1 billion seconds
AD 2001-04-27 06:40:40.000 PM (Fri) Mountain Daylight Time

#2002-12-25# - now[] - days
105.70975056709

--
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: last-var-wins: a simple way to ease upgrade pain

2010-05-06 Thread gary ng
On Wed, May 5, 2010 at 10:34 PM, Meikel Brandmeyer m...@kotka.de wrote:

 I'm deeply suspicious of such a behaviour. Why would + on a
 date mean adding days? Why not hours? minutes? seconds?
 months? years? I would always prefer plus-days over such a
 behaviour, because I wouldn't have to think everytime, what +
 adds.

 But that is only a matter of taste, I fancy.


Convention, mostly. Say in the security trading settlement world, they use
terms like T+3 to mean transaction date + 3 days. Which is why I said, toy
DSL. It is used in an implicit context. Everyone in that business knows what
T+3 means. Just like we know what CC means when looking at email.

-- 
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: last-var-wins: a simple way to ease upgrade pain

2010-05-06 Thread Meikel Brandmeyer
Hi,

On 6 Mai, 08:22, gary ng garyng2...@gmail.com wrote:

 Convention, mostly. Say in the security trading settlement world, they use
 terms like T+3 to mean transaction date + 3 days. Which is why I said, toy
 DSL. It is used in an implicit context. Everyone in that business knows what
 T+3 means. Just like we know what CC means when looking at email.

Well, then you might want to look into multimethods (or Protocols if
you
follow the edge).

(ns my.name.space
  (:refer-clojure :as core :exclude (+)))

(defmulti + (fn [x  _] (type x)))

(defmethod + Integer
  [ args]
  (apply core/+ args))

(defmethod + org.joda.time.DateTime
  [date  days]
  (reduce #(.plusDays %1 %2) date days))

Sincerely
Meikel

-- 
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: last-var-wins: a simple way to ease upgrade pain

2010-05-06 Thread Michael Wood
On 6 May 2010 03:38, gary ng garyng2...@gmail.com wrote:

 On Wed, May 5, 2010 at 3:18 PM, Meikel Brandmeyer m...@kotka.de wrote:

 On Wed, May 05, 2010 at 02:56:09PM -0700, gary ng wrote:
 Right now, this can be handled as:
 (ns foo
  (:refer-clojure :as core :exclude (+)))

 (defn +
  [matrix1 matrix2]
  ... (core/+ num1 num2) ...)

 Thanks. though it is still a bit limited in the sense that in each ns, there
 can only be one implementation of a symbol,  though I think that is the
 characteristic of all symbol based dynamic language.
 I am writing a toy DSL where I would like it to be able to do something like
 this:
 (+ today 3) = a date which is 3 days from today
 (+ 1 2) = 3
 such that the following is possible
 (+ today (- 14 remind-prior))
 = 2 weeks from today - a fixed remind before days
 = a date when I am going to be reminded for an event 2 weeks from today

Perhaps this is something like what you're looking for?

http://richhickey.github.com/clojure-contrib/generic.arithmetic-api.html

-- 
Michael Wood esiot...@gmail.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 at
http://groups.google.com/group/clojure?hl=en


Restricted eval

2010-05-06 Thread Mibu
So far I have delightfully used Clojure's reader-evaluator-printer to
store and load data, as an ad-hoc scripting language and command line
interface, as a configuration language, and as an RPC protocol. It's
all simple and great when those interfaces are trusted.

Now I want to do it with untrusted interfaces. Is there a simple way
to reuse Clojure facilities to create an eval function restricted to
predefined namespaces and without the javaop special forms?

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


Can't defalias a macro in clojure 1.2?

2010-05-06 Thread Joost
In clojure 1.1 you can use defalias on macros, but as far as I can
tell, in the current 1.2 branch, this won't work anymore.

Is this intentional, and if so, how can I work around it once I start
porting stuff to 1.2?

Regards,
Joost Diepenmaat.

-- 
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: Restricted eval

2010-05-06 Thread Meikel Brandmeyer
Hi,

maybe this can help: http://github.com/licenser/clj-sandbox

Sincerely
Meikel

-- 
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: Restricted eval

2010-05-06 Thread Mibu
As far as I can tell, clj-sandbox works by a set whitelist of
arbitrary functions, which is not a very generic approach. It works
for sandboxes like clojurebot, but not for other stuff.

A restricted eval in all likelihood will not refer directly to
clojure.core, and it's much better allowing the caller to specify by
namespaces which functions are accessible. Maybe in the future
clojure.core functions could be tagged depending on whether they are
purely-functional or have side-effects, and a caller to a restricted
eval will be able to automatically generate a new safe-core
namespace based on this division.


On May 6, 1:37 pm, Meikel Brandmeyer m...@kotka.de wrote:
 Hi,

 maybe this can help:http://github.com/licenser/clj-sandbox

 Sincerely
 Meikel

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


Re: given a java.lang.Class, accessing a static field of the associated class

2010-05-06 Thread Stuart Halloway
Reflection is slow, there are less than ten of these, and the possible  
set ain't gonna change.


I would write a function that looks them up from a map.

Stu


This post originally started as a question, but I've since found a
solution. I thought I'd post it anyway, perhaps someone knows of a
nicer approach.

I'd like a function which maps from a boxed type as represented by a
java.lang.Class (i.e. Integer, Boolean, Float) to the associated
unboxed type. If no such unboxed doppelgänger exists, this function
should be identity.

This works:

(. java.lang.Integer TYPE)
= int

Here's my attempt:

(defn unbox
 [class]
 (try (. class TYPE)
  (catch NoSuchFieldException e class)))

(unbox Integer)
; Evaluation aborted.
No matching field found: TYPE for class java.lang.Class
[Thrown class java.lang.IllegalArgumentException]

It's (naturally) trying to find TYPE in the class java.lang.Class,
which is the actual runtime type of the object that represents the
class Integer, as opposed to the class Integer itself.

This isn't Clojure's fault, it's just yet another consequence of Java
Classes not being objects in their own right. (Smalltalk, Objective-C,
Python, ... all do in one form or another.) No, the java.lang.Class,
which represents a class for purposes of reflection doesn't count.

With that insight, the following solution presents itself:

(defn unbox
 [class]
 (try (.. class (getField TYPE) (get nil))
  (catch NoSuchFieldException e class)))

Thoughts?

// Ben

--
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: Dumbest test Q you ever heard

2010-05-06 Thread Sean Devlin
Can you just use a local let in the specific test?

On May 6, 6:41 am, Quzanti quza...@googlemail.com wrote:
 Sorry about this, but after an hour's googling I have drawn a blank.

 For clojure.test fixtures I understand you use :each for doing
 something around each and every test, and :once for doing it once
 around all the tests in that namespace

 What happens if you want to do some setup just for one particular test
 that you want to use a with-test structure for? Can you put non-
 assertion lines outside the scope of the function being tested, but
 within the scope of with-test

 I though of going an (is (= nil (mysetup-stuff))) but that is quite a
 hack

 I know also that I may be being obsessive as normally all tests on a
 namespace will get run together so :once will do the job, but I have
 this hitch to put setup code that only applies to testing that
 function within the with-test for that fn.

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


Re: labrepl updated

2010-05-06 Thread Craig Andera
So if someone produces a fork of incanter that doesn't have the
warning (or David fixes up Incanter), then the problem goes away?
Because the other place I see the warnings coming out of is swank
itself.

On Thu, May 6, 2010 at 9:33 AM, Stuart Halloway
stuart.hallo...@gmail.com wrote:
 This is another variant of the Swank likes StringWriters, everybody else
 likes PrintWriters problem, see e.g. [1]

 I would love to see somebody fix this, and I think it is simpler (and
 probably conceptually correct) to make swank use a PrintWriter, instead of
 requiring all possible tools to do a check for swank's sake. See [2]

 Until this is fixed, swank is busted for any app that produces a
 last-var-wins warning.

 [1] https://www.assembla.com/spaces/clojure-contrib/tickets/55
 [2]
 http://groups.google.com/group/clojure-dev/browse_thread/thread/369734ff42cbb06a/adbeb8d031a990d2?lnk=gstq=printwriter#adbeb8d031a990d2

 Update: Using the latest labrepl commit (fa89411ae use private
 compojure snapshot), I'm now able to pull in incanter and use it
 (albeit with tons of warnings about group-by and flatten from both
 incanter and swank)...but only if I use script/repl via inferior-lisp.
 I still can't get swank to work. It fails with the same error as
 before [1].

 But at least I'm unblocked.

 [1]
 swank.util.io.proxy$java.io.StringWriter$0 cannot be cast to
 java.io.PrintWriter
  [Thrown class java.lang.ClassCastException]

 Restarts:
 0: [ABORT] Return to SLIME's top level.

 Backtrace:
  0: clojure.lang.Namespace.warnOnReplace(Namespace.java:85)
  1: clojure.lang.Namespace.reference(Namespace.java:106)
  2: clojure.lang.Namespace.refer(Namespace.java:164)
  3: clojure.core$refer__4606.doInvoke(core.clj:3175)
  4: clojure.lang.RestFn.invoke(RestFn.java:411)
  5: clojure.lang.AFn.applyToHelper(AFn.java:163)
  6: clojure.lang.RestFn.applyTo(RestFn.java:133)
  7: clojure.core$apply__3769.invoke(core.clj:537)
  8: clojure.core$load_lib__5243.doInvoke(core.clj:4693)
  9: clojure.lang.RestFn.applyTo(RestFn.java:143)
 10: clojure.core$apply__3769.invoke(core.clj:537)
 11: clojure.core$load_libs__5259.doInvoke(core.clj:4712)
 12: clojure.lang.RestFn.applyTo(RestFn.java:138)
 13: clojure.core$apply__3769.invoke(core.clj:539)
 14: clojure.core$use__5283.doInvoke(core.clj:4792)
 15: clojure.lang.RestFn.invoke(RestFn.java:409)
 16: user$eval__9709.invoke(NO_SOURCE_FILE:1)
 17: clojure.lang.Compiler.eval(Compiler.java:5344)
 18: clojure.lang.Compiler.eval(Compiler.java:5312)
 19: clojure.core$eval__4343.invoke(core.clj:2362)
 20: swank.commands.basic$eval_region__677.invoke(basic.clj:40)
 21: swank.commands.basic$eval_region__677.invoke(basic.clj:31)
 22: swank.commands.basic$eval__690$listener_eval__691.invoke(basic.clj:54)
 23: clojure.lang.Var.invoke(Var.java:365)
 24: user$eval__9707.invoke(Unknown Source)
 25: clojure.lang.Compiler.eval(Compiler.java:5344)
 26: clojure.lang.Compiler.eval(Compiler.java:5312)
 27: clojure.core$eval__4343.invoke(core.clj:2362)
 28: swank.core$eval_in_emacs_package__324.invoke(core.clj:59)
 29: swank.core$eval_for_emacs__387.invoke(core.clj:128)
 30: clojure.lang.Var.invoke(Var.java:373)
 31: clojure.lang.AFn.applyToHelper(AFn.java:169)
 32: clojure.lang.Var.applyTo(Var.java:482)
 33: clojure.core$apply__3769.invoke(core.clj:535)
 34: swank.core$eval_from_control__326.invoke(core.clj:66)
 35: swank.core$eval_loop__328.invoke(core.clj:71)
 36: swank.core$spawn_repl_thread__438$fn__468$fn__469.invoke(core.clj:183)
 37: clojure.lang.AFn.applyToHelper(AFn.java:159)
 38: clojure.lang.AFn.applyTo(AFn.java:151)
 39: clojure.core$apply__3769.invoke(core.clj:535)
 40: swank.core$spawn_repl_thread__438$fn__468.doInvoke(core.clj:180)
 41: clojure.lang.RestFn.invoke(RestFn.java:398)
 42: clojure.lang.AFn.run(AFn.java:24)
 43: java.lang.Thread.run(Thread.java:636)

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

Re: labrepl updated

2010-05-06 Thread Stuart Halloway

You would have to fix *all* warnings.

If there is not a principled reason swank works the way it does, let's  
fix it. I'll get to it eventually myself if nobody else does, but it  
isn't near the top of my list.


Stu


So if someone produces a fork of incanter that doesn't have the
warning (or David fixes up Incanter), then the problem goes away?
Because the other place I see the warnings coming out of is swank
itself.

On Thu, May 6, 2010 at 9:33 AM, Stuart Halloway
stuart.hallo...@gmail.com wrote:
This is another variant of the Swank likes StringWriters,  
everybody else

likes PrintWriters problem, see e.g. [1]

I would love to see somebody fix this, and I think it is simpler (and
probably conceptually correct) to make swank use a PrintWriter,  
instead of

requiring all possible tools to do a check for swank's sake. See [2]

Until this is fixed, swank is busted for any app that produces a
last-var-wins warning.

[1] https://www.assembla.com/spaces/clojure-contrib/tickets/55
[2]
http://groups.google.com/group/clojure-dev/browse_thread/thread/369734ff42cbb06a/adbeb8d031a990d2?lnk=gstq=printwriter#adbeb8d031a990d2


Update: Using the latest labrepl commit (fa89411ae use private
compojure snapshot), I'm now able to pull in incanter and use it
(albeit with tons of warnings about group-by and flatten from both
incanter and swank)...but only if I use script/repl via inferior- 
lisp.

I still can't get swank to work. It fails with the same error as
before [1].

But at least I'm unblocked.

[1]
swank.util.io.proxy$java.io.StringWriter$0 cannot be cast to
java.io.PrintWriter
 [Thrown class java.lang.ClassCastException]

Restarts:
0: [ABORT] Return to SLIME's top level.

Backtrace:
 0: clojure.lang.Namespace.warnOnReplace(Namespace.java:85)
 1: clojure.lang.Namespace.reference(Namespace.java:106)
 2: clojure.lang.Namespace.refer(Namespace.java:164)
 3: clojure.core$refer__4606.doInvoke(core.clj:3175)
 4: clojure.lang.RestFn.invoke(RestFn.java:411)
 5: clojure.lang.AFn.applyToHelper(AFn.java:163)
 6: clojure.lang.RestFn.applyTo(RestFn.java:133)
 7: clojure.core$apply__3769.invoke(core.clj:537)
 8: clojure.core$load_lib__5243.doInvoke(core.clj:4693)
 9: clojure.lang.RestFn.applyTo(RestFn.java:143)
10: clojure.core$apply__3769.invoke(core.clj:537)
11: clojure.core$load_libs__5259.doInvoke(core.clj:4712)
12: clojure.lang.RestFn.applyTo(RestFn.java:138)
13: clojure.core$apply__3769.invoke(core.clj:539)
14: clojure.core$use__5283.doInvoke(core.clj:4792)
15: clojure.lang.RestFn.invoke(RestFn.java:409)
16: user$eval__9709.invoke(NO_SOURCE_FILE:1)
17: clojure.lang.Compiler.eval(Compiler.java:5344)
18: clojure.lang.Compiler.eval(Compiler.java:5312)
19: clojure.core$eval__4343.invoke(core.clj:2362)
20: swank.commands.basic$eval_region__677.invoke(basic.clj:40)
21: swank.commands.basic$eval_region__677.invoke(basic.clj:31)
22: swank.commands.basic 
$eval__690$listener_eval__691.invoke(basic.clj:54)

23: clojure.lang.Var.invoke(Var.java:365)
24: user$eval__9707.invoke(Unknown Source)
25: clojure.lang.Compiler.eval(Compiler.java:5344)
26: clojure.lang.Compiler.eval(Compiler.java:5312)
27: clojure.core$eval__4343.invoke(core.clj:2362)
28: swank.core$eval_in_emacs_package__324.invoke(core.clj:59)
29: swank.core$eval_for_emacs__387.invoke(core.clj:128)
30: clojure.lang.Var.invoke(Var.java:373)
31: clojure.lang.AFn.applyToHelper(AFn.java:169)
32: clojure.lang.Var.applyTo(Var.java:482)
33: clojure.core$apply__3769.invoke(core.clj:535)
34: swank.core$eval_from_control__326.invoke(core.clj:66)
35: swank.core$eval_loop__328.invoke(core.clj:71)
36: swank.core 
$spawn_repl_thread__438$fn__468$fn__469.invoke(core.clj:183)

37: clojure.lang.AFn.applyToHelper(AFn.java:159)
38: clojure.lang.AFn.applyTo(AFn.java:151)
39: clojure.core$apply__3769.invoke(core.clj:535)
40: swank.core$spawn_repl_thread__438$fn__468.doInvoke(core.clj:180)
41: clojure.lang.RestFn.invoke(RestFn.java:398)
42: clojure.lang.AFn.run(AFn.java:24)
43: java.lang.Thread.run(Thread.java:636)

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

Re: Restricted eval

2010-05-06 Thread gary ng
On Thu, May 6, 2010 at 4:19 AM, Mibu mibu.cloj...@gmail.com wrote:

 As far as I can tell, clj-sandbox works by a set whitelist of
 arbitrary functions, which is not a very generic approach. It works
 for sandboxes like clojurebot, but not for other stuff.

 A restricted eval in all likelihood will not refer directly to
 clojure.core, and it's much better allowing the caller to specify by
 namespaces which functions are accessible. Maybe in the future
 clojure.core functions could be tagged depending on whether they are
 purely-functional or have side-effects, and a caller to a restricted
 eval will be able to automatically generate a new safe-core
 namespace based on this division.


While we are talking about sandboxed eval, it is not just which function is
accessible but also things like .alterRoot which becomes a instance method
of a java object which goes a bit beyond clojure name space. with some
clever tricks, it is possible to get the var of a root binding then
.alterRoot and replace the definition.

-- 
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: given a java.lang.Class, accessing a static field of the associated class

2010-05-06 Thread B Smith-Mannschott
On Thu, May 6, 2010 at 15:22, Stuart Halloway stuart.hallo...@gmail.com wrote:
 Reflection is slow, there are less than ten of these, and the possible set
 ain't gonna change.

 I would write a function that looks them up from a map.

Yea, I considered that too.  The only reason I didn't was because of a
misguided desire not to hardcode things.

But, you're right. My solution isn't optimal. The set of classes which
box java primitives is not going to change.

(let [m {Byte  Byte/TYPE,   Short Short/TYPE,
 Integer   Integer/TYPE,Long  Long/TYPE,
 Boolean   Boolean/TYPE,Character Character/TYPE,
 Float Float/TYPE,  DoubleDouble/TYPE}]
  (defn unbox [class]
(m class class)))

I've defined 'm' in a let containing the definition of unbox because
I'm assuming that if I'd inlined it at the point where I use m that it
would get constructed once for every function call, but I don't
actually know that:

  (defn unbox [class]
({Byte ...} class class))

Would Clojure be smart enough to recognize that {Byte ...} is a
compile-time constant expression and not rebuild it on every call to
unbox?

// Ben

-- 
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: Restricted eval

2010-05-06 Thread Mibu
I mentioned in the first message that javaop should also be disabled
in a restricted eval.

On May 6, 5:18 pm, gary ng garyng2...@gmail.com wrote:
 On Thu, May 6, 2010 at 4:19 AM, Mibu mibu.cloj...@gmail.com wrote:
  As far as I can tell, clj-sandbox works by a set whitelist of
  arbitrary functions, which is not a very generic approach. It works
  for sandboxes like clojurebot, but not for other stuff.

  A restricted eval in all likelihood will not refer directly to
  clojure.core, and it's much better allowing the caller to specify by
  namespaces which functions are accessible. Maybe in the future
  clojure.core functions could be tagged depending on whether they are
  purely-functional or have side-effects, and a caller to a restricted
  eval will be able to automatically generate a new safe-core
  namespace based on this division.

 While we are talking about sandboxed eval, it is not just which function is
 accessible but also things like .alterRoot which becomes a instance method
 of a java object which goes a bit beyond clojure name space. with some
 clever tricks, it is possible to get the var of a root binding then
 .alterRoot and replace the definition.

-- 
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: given a java.lang.Class, accessing a static field of the associated class

2010-05-06 Thread Alan Dipert
Hello,
Since maps are functions of their keys, I think you can get away with
something like:

(def unbox {Byte Byte/TYPE
 Integer Integer/TYPE})

(unbox Integer) ;int

Regarding your let/defn, I think in general if you have functions that
depend on compile-time constants it's idiomatic to def them.

Cheers,
Alan

On May 6, 11:08 am, B Smith-Mannschott bsmith.o...@gmail.com wrote:
 On Thu, May 6, 2010 at 15:22, Stuart Halloway stuart.hallo...@gmail.com 
 wrote:
  Reflection is slow, there are less than ten of these, and the possible set
  ain't gonna change.

  I would write a function that looks them up from a map.

 Yea, I considered that too.  The only reason I didn't was because of a
 misguided desire not to hardcode things.

 But, you're right. My solution isn't optimal. The set of classes which
 box java primitives is not going to change.

 (let [m {Byte      Byte/TYPE,       Short     Short/TYPE,
          Integer   Integer/TYPE,    Long      Long/TYPE,
          Boolean   Boolean/TYPE,    Character Character/TYPE,
          Float     Float/TYPE,      Double    Double/TYPE}]
   (defn unbox [class]
     (m class class)))

 I've defined 'm' in a let containing the definition of unbox because
 I'm assuming that if I'd inlined it at the point where I use m that it
 would get constructed once for every function call, but I don't
 actually know that:

   (defn unbox [class]
     ({Byte ...} class class))

 Would Clojure be smart enough to recognize that {Byte ...} is a
 compile-time constant expression and not rebuild it on every call to
 unbox?

 // Ben

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


Re: last-var-wins: a simple way to ease upgrade pain

2010-05-06 Thread Mike Meyer
On Wed, 5 May 2010 23:22:06 -0700
gary ng garyng2...@gmail.com wrote:

 On Wed, May 5, 2010 at 10:34 PM, Meikel Brandmeyer m...@kotka.de wrote:
  I'm deeply suspicious of such a behaviour. Why would + on a
  date mean adding days? Why not hours? minutes? seconds?
  months? years? I would always prefer plus-days over such a
  behaviour, because I wouldn't have to think everytime, what +
  adds.
  But that is only a matter of taste, I fancy.
 Convention, mostly. Say in the security trading settlement world, they use
 terms like T+3 to mean transaction date + 3 days. Which is why I said, toy
 DSL. It is used in an implicit context. Everyone in that business knows what
 T+3 means. Just like we know what CC means when looking at email.

But that just boils down to a matter of taste, with your taste
determined by the industry that dominates your background. So wiring
it into a DSL is reasonable, and it would be nice if the system didn't
get in the way of doing so.

mike
-- 
Mike Meyer m...@mired.org http://www.mired.org/consulting.html
Independent Network/Unix/Perforce consultant, email for more information.

O ascii ribbon campaign - stop html mail - www.asciiribbon.org

-- 
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: Dumbest test Q you ever heard

2010-05-06 Thread Quzanti
I probably could, although again it would be a bit of a hack, as I
want to 'do' some preparation rather than assign anything
(specifically I need to 'touch' some files before testing a function
which is modification time sensitive)

So I want something that happens before all several 'is' assertions in
my with-test for one specific function.

If you do anything outside an assertion you get an error saying you
were outside an assertion.

Small point, and as you say easily worked around, but it would seem to
me to be within the spirit of the with-test idea i.e. making the test
code closely tied to the function, if you could do a function specific
fixture??

On May 6, 2:34 pm, Sean Devlin francoisdev...@gmail.com wrote:
 Can you just use a local let in the specific test?

 On May 6, 6:41 am, Quzanti quza...@googlemail.com wrote:



  Sorry about this, but after an hour's googling I have drawn a blank.

  For clojure.test fixtures I understand you use :each for doing
  something around each and every test, and :once for doing it once
  around all the tests in that namespace

  What happens if you want to do some setup just for one particular test
  that you want to use a with-test structure for? Can you put non-
  assertion lines outside the scope of the function being tested, but
  within the scope of with-test

  I though of going an (is (= nil (mysetup-stuff))) but that is quite a
  hack

  I know also that I may be being obsessive as normally all tests on a
  namespace will get run together so :once will do the job, but I have
  this hitch to put setup code that only applies to testing that
  function within the with-test for that fn.

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


Re: Can't defalias a macro in clojure 1.2?

2010-05-06 Thread Joost
On May 6, 7:01 pm, ataggart alex.tagg...@gmail.com wrote:
 What defalias are you talking about?


The one in clojure.contrib.def

-- 
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: Mahout in Clojure

2010-05-06 Thread klathrop
Hoops indeed!  Thank you, the solution works great.

On May 5, 11:05 pm, ataggart alex.tagg...@gmail.com wrote:
 Wow! What hoops one has to jump through to fit things in an OO API,
 eh?

 Anyway, if you're using 1.2:

 (reify RecommenderBuilder
   (buildRecommender [this model]
     (let [similarity (PearsonCorrelationSimilarity. model)
            neighborhood (NearestNUserNeighborhood. 2 similarity
 model)]
       (GenericUserBasedRecommender. model neighborhood similarity

 Or if the model used everywhere is the same, you can skip some
 stuff:

 (let [model (FileDataModel. (File. intro.csv))
       similarity (PearsonCorrelationSimilarity. model)
       neighborhood (NearestNUserNeighborhood 2 similarity model)
       recommender  (GenericUserBasedRecommender model neighborhood
 similarity)
       builder (reify RecommenderBuilder (buildRecommender [_ _]
 recommender))
       evaluator (AverageAbsoluteDifferenceRecommenderEvaluator.)]
   (.evaluate evaluator nil model 0.7 1.0))

 On May 5, 9:23 pm, Krukow karl.kru...@gmail.com wrote:



  On May 5, 2:40 pm, klathrop gamingscien...@gmail.com wrote:
  [snip]

   Its the RecommenderBuilder that's giving me trouble.  I've tried using
   proxy with no luck.  Any suggestions?

  Can you post the code that fails?

  /Karl

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


Re: Restricted eval

2010-05-06 Thread Heinz N. Gies
If I may :) since I'm the sandbox guy.

On May 6, 2010, at 18:18 , Mibu wrote:

 I mentioned in the first message that javaop should also be disabled
 in a restricted eval.
 
 On May 6, 5:18 pm, gary ng garyng2...@gmail.com wrote:
 On Thu, May 6, 2010 at 4:19 AM, Mibu mibu.cloj...@gmail.com wrote:
 As far as I can tell, clj-sandbox works by a set whitelist of
 arbitrary functions, which is not a very generic approach. It works
 for sandboxes like clojurebot, but not for other stuff.
I place the bold claim clj-sandbox is pretty good for 'other stuff'. Let me 
explain.
 
 A restricted eval in all likelihood will not refer directly to
 clojure.core, and it's much better allowing the caller to specify by
 namespaces which functions are accessible.
Exactly that is what clj-sandbox does. It just comes which a list of things 
that we
consider secure. clj-sandbox allows a very fine grained  customization of the 
rules
it. It not even has a multitude of 'testers' including for things as 
namespaces, classes
and functions but even has a pretty simple interface to write custom tests that 
could, 
for example restrict the usage of let on every other tuesday without any 
adjustment
to the sandbox itself.
 Maybe in the future
 clojure.core functions could be tagged depending on whether they are
 purely-functional or have side-effects, and a caller to a restricted
 eval will be able to automatically generate a new safe-core
 namespace based on this division.
When that happens there will of cause be a clj-sandbox tester to easily match
against those functions!

 
 While we are talking about sandboxed eval, it is not just which function is
 accessible but also things like .alterRoot which becomes a instance method
 of a java object which goes a bit beyond clojure name space. with some
 clever tricks, it is possible to get the var of a root binding then
 .alterRoot and replace the definition.

This is very true, there clj-sandbox takes a rather elaborated approach to make 
it
hard to do this and succeeds quite well. It goes so far to replace the . 
function 
in the code against a custom version to make sure things like .alterRoot can't 
ever
be called, and trust me ato_ has made us quite a headache with this :P. In 
addition 
to that it also supports java sand-boxing (they have this nifty thing) but this 
is something
the user has to explore into themselves.

Mibu, if you are interested in this kind of stuff I'll gladly help you to use 
clj-sandbox for your 
issue since I am pretty confident it can solve your problem and if it can't it 
should and we'll 
work on making it ;)

Regards,
Licenser - the sandbox guy.

-- 
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: Restricted eval

2010-05-06 Thread Rayne
Disabling it is definitely unnecessary. As you said before, we go as
far as replacing the '.' special form with our own special safe dot
that makes Java interop safe.

As a side note, clojurebot doesn't actually use clj-sandbox (yet, hint
hiredman, hint), but sexpbot does. _ato hasn't broken sexpbot in a
while. ;)

On May 6, 1:04 pm, Heinz N. Gies he...@licenser.net wrote:
 On May 6, 2010, at 20:57 , Anniepoo wrote:

  Mibu - I've kind of gone around this track as well.
  My first reaction to the 'whitelist' was that it was kind of kludgy,
  and fought it for a long time, but after a lot of looking for other
  ways, I'm with Licenser, it's the best way to do it.

 Whitelists are indeed the only way to go, blacklists are not a option
 since it is too easy to forget something and the only other thing left I can
 imagine is a smart sandbox that works with actually understanding the code
 and I'm not quite done with that yet :P..

  And yes, you have to disable java interop not because you can't
  sandbox java but because it makes a backdoor to allow execution of
  arbitrary clojure.

 I don't think you have to disable it, just restrict it since you can indeed 
 police
 java code just good as clojure code. clj-sandbox works at the 'top' of a 
 function
 so if a function x is whitelisted and x calls something that isn't - it still 
 allows x.
 This is not a but but a feature here, it does this for a good reason, being 
 that
 often you want to wrap a generally insecured function in a secure wrapper
 allowing the sandbox limited access to this functionality.

 Regards,
 Heinz

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


History Question

2010-05-06 Thread Sean Devlin
Why does (str :a) return :a and not a?  I have to work around this
a lot, and I'm just curios what the reasoning to go this direction was.

-- 
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: History Question

2010-05-06 Thread Alan Dipert
Hi,

On May 6, 2:33 pm, Sean Devlin francoisdev...@gmail.com wrote:
 Why does (str :a) return :a and not a?  I have to work around this
 a lot, and I'm just curios what the reasoning to go this direction was.

str returns :a because (.toString :a) returns :a.  This is
probably so things like (println :a) work as expected, but I don't
know for sure.  Anyways, an easy way to get a from :a is with
name, ie:

(name :a) ; a

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


Re: History Question

2010-05-06 Thread Heinz N. Gies
(name :a) gives you a :), and I think the reason is that str shows the type 
somewhat, just as (str '(1 2 3)) or (str [1 2 3])

Regards,
Heinz
On May 6, 2010, at 21:33 , Sean Devlin wrote:

 Why does (str :a) return :a and not a?  I have to work around this
 a lot, and I'm just curios what the reasoning to go this direction was.
 
 -- 
 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: History Question

2010-05-06 Thread Jeff Heon
You could use name.

(name :a)
-a

On May 6, 2:33 pm, Sean Devlin francoisdev...@gmail.com wrote:
 Why does (str :a) return :a and not a?  I have to work around this
 a lot, and I'm just curios what the reasoning to go this direction was.

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


Re: History Question

2010-05-06 Thread Sean Devlin
Okay, next guy to mention name gets shot.  Nothing personal.

On May 6, 2:42 pm, Jeff Heon jfh...@gmail.com wrote:
 You could use name.

 (name :a)
 -a

 On May 6, 2:33 pm, Sean Devlin francoisdev...@gmail.com wrote:

  Why does (str :a) return :a and not a?  I have to work around this
  a lot, and I'm just curios what the reasoning to go this direction was.

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


Re: History Question

2010-05-06 Thread Jeff Heon
Sorry, the others replies weren't there yet when I begun answering 8)

On May 6, 2:44 pm, Sean Devlin francoisdev...@gmail.com wrote:
 Okay, next guy to mention name gets shot.  Nothing personal.

-- 
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: History Question

2010-05-06 Thread Heinz N. Gies
okay another suggestion:

(defn nstr [ ss]
  (apply str (map #(if (keyword? %) (n-word-function-i-dont-mention %) %) 
s)))


On May 6, 2010, at 21:44 , Sean Devlin wrote:

 Okay, next guy to mention name gets shot.  Nothing personal.
 
 On May 6, 2:42 pm, Jeff Heon jfh...@gmail.com wrote:
 You could use name.
 
 (name :a)
 -a
 
 On May 6, 2:33 pm, Sean Devlin francoisdev...@gmail.com wrote:
 
 Why does (str :a) return :a and not a?  I have to work around this
 a lot, and I'm just curios what the reasoning to go this direction was.
 
 --
 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 
 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

-- 
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: History Question

2010-05-06 Thread Sean Devlin
Now that's a solution :)

On May 6, 2:53 pm, Heinz N. Gies he...@licenser.net wrote:
 okay another suggestion:

 (defn nstr [ ss]
       (apply str (map #(if (keyword? %) (n-word-function-i-dont-mention %) %) 
 s)))

 On May 6, 2010, at 21:44 , Sean Devlin wrote:



  Okay, next guy to mention name gets shot.  Nothing personal.

  On May 6, 2:42 pm, Jeff Heon jfh...@gmail.com wrote:
  You could use name.

  (name :a)
  -a

  On May 6, 2:33 pm, Sean Devlin francoisdev...@gmail.com wrote:

  Why does (str :a) return :a and not a?  I have to work around this
  a lot, and I'm just curios what the reasoning to go this direction was.

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

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


Re: History Question

2010-05-06 Thread Meikel Brandmeyer
Hi,

or as-str from c.c.java-utils (I think)

Sincerely
Meikel

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


Annoying auto-signature

2010-05-06 Thread Mibu
Am I the only one driven mad by the new auto-appended signature to
every message in this group (You received this message because you
are subscribed...)? It started on April 16th. Is there a way a
moderator can stop it?

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


build.clojure.org update: clojure-contrib 1.2 repo path no longer includes -master

2010-05-06 Thread Stephen C. Gilardi
This change was made to some months ago, but some builds that followed the 
obsolete convention have been hanging around. I removed them today.

On Apr 30, 2010, at 9:50 AM, Stuart Halloway wrote:

 There are plenty of recent SNAPSHOT builds:
 http://build.clojure.org/snapshots/org/clojure/clojure-contrib/1.2.0-SNAPSHOT/
 
 But no recent master-SNAPSHOT builds:
 http://build.clojure.org/snapshots/org/clojure/clojure-contrib/1.2.0-master-SNAPSHOT/
 
 This is causing me a problem [...]
 
 Options
 
 [...]

 (b) we can delete the master artifacts so only the snapshots are found (I 
 would need to poke around Hudson to figure this out.

Hi Stu,

In response to your email request,  I've removed this directory:

 http://build.clojure.org/snapshots/org/clojure/clojure-contrib/1.2.0-master-SNAPSHOT/

Anyone who now gets a 404 for that path should update their config to point to 
the current location:

 http://build.clojure.org/snapshots/org/clojure/clojure-contrib/1.2.0-SNAPSHOT/

to start using nice fresh builds of clojure-contrib.

Cheers,

--Steve

-- 
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: Can't defalias a macro in clojure 1.2?

2010-05-06 Thread Stuart Halloway

Just pushed a fix for this. (An ugly hack, really.)

Let me know if it works for you.


In clojure 1.1 you can use defalias on macros, but as far as I can
tell, in the current 1.2 branch, this won't work anymore.

Is this intentional, and if so, how can I work around it once I start
porting stuff to 1.2?

Regards,
Joost Diepenmaat.

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


In the Seattle area? Seajure meeting tonight

2010-05-06 Thread Phil Hagelberg
Tonight we're having another Seajure meeting for all in the Seattle
area with an interest in Clojure.

We meet at 7pm at University Zoka:
http://maps.google.com/maps?f=qsource=s_qhl=engeocode=q=zoka,+university+district,+seattlesll=37.0625,-95.677068sspn=49.490703,90.791016ie=UTF8hq=zoka,hnear=University+District,+Seattle,+WAll=47.66624,-122.296629spn=0.010361,0.022166z=16iwloc=B

Topics may include:

* last-var-wins -- what does it mean to you?
* vote for favourite promoted-contrib-fn
* code review, bring a project that you'd like input on
* the list? predicate: threat or menace?

Check for the table full of nerds in the back of the coffee shop. More
details at http://seajure.technomancy.us/

-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: build.clojure.org update: clojure-contrib 1.2 repo path no longer includes -master

2010-05-06 Thread Frank Siebenlist
I just built the netbean+labrepl from start according the getting-started 
webpage, and the build barfed because labrepl's pom.xml included the 
1.2.0-master-SNAPSHOT instead of 1.2.0-SNAPSHOT for clojure-contrib. 

After correction, all build without errors and seems to work fine.

-Frank.



On May 6, 2010, at 2:22 PM, Stephen C. Gilardi wrote:

 This change was made to some months ago, but some builds that followed the 
 obsolete convention have been hanging around. I removed them today.
 
 On Apr 30, 2010, at 9:50 AM, Stuart Halloway wrote:
 
 There are plenty of recent SNAPSHOT builds:
 http://build.clojure.org/snapshots/org/clojure/clojure-contrib/1.2.0-SNAPSHOT/
 
 But no recent master-SNAPSHOT builds:
 http://build.clojure.org/snapshots/org/clojure/clojure-contrib/1.2.0-master-SNAPSHOT/
 
 This is causing me a problem [...]
 
 Options
 
 [...]
 
 (b) we can delete the master artifacts so only the snapshots are found (I 
 would need to poke around Hudson to figure this out.
 
 Hi Stu,
 
 In response to your email request,  I've removed this directory:
 
 http://build.clojure.org/snapshots/org/clojure/clojure-contrib/1.2.0-master-SNAPSHOT/
 
 Anyone who now gets a 404 for that path should update their config to point 
 to the current location:
 
 http://build.clojure.org/snapshots/org/clojure/clojure-contrib/1.2.0-SNAPSHOT/
 
 to start using nice fresh builds of clojure-contrib.
 
 Cheers,
 
 --Steve
 
 
 -- 
 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: Restricted eval

2010-05-06 Thread gary ng
On Thu, May 6, 2010 at 10:49 AM, Heinz N. Gies he...@licenser.net wrote:

 If I may :) since I'm the sandbox guy.


Is it possible to use the sandbox functionalities without the future/thread
part ?

Basically, I am trying to create a chatty REPL(say HTTP POST based).

the thread would be created by the app container and the container already
has its own protection against endless loop style attack or other typical
restrictions for a web based application. I just want to ensure that each
thread runs within its own namespace and would not be able to get into the
neighbour  namespace(or other shared/referred namespaces like clojure.core)
and do a .alterroot style thing. But if possible, still be able to use most
clojure features.

-- 
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: History Question

2010-05-06 Thread MarkSwanson


On May 6, 2:44 pm, Sean Devlin francoisdev...@gmail.com wrote:
 Okay, next guy to mention name gets shot.  Nothing personal.

Ok, but have you considered using name?

-- 
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: Restricted eval

2010-05-06 Thread Heinz N. Gies

On May 7, 2010, at 3:34 , gary ng wrote:

 
 
 On Thu, May 6, 2010 at 10:49 AM, Heinz N. Gies he...@licenser.net wrote:
 If I may :) since I'm the sandbox guy.
 
 
 Is it possible to use the sandbox functionalities without the future/thread 
 part ?
Currently no, if it is really important and the following does not solve your 
problem I can add it so.
 
 Basically, I am trying to create a chatty REPL(say HTTP POST based).
On a side note you should talk to Raynes about that ;).

 the thread would be created by the app container and the container already 
 has its own protection against endless loop style attack or other typical 
 restrictions for a web based application.
The use of an additional timeout would allow you to gracefully handle this 
situations, say returning a 'Sorry this code timed out' instead of a 500 which 
just tells the user 'meh something broke'

 I just want to ensure that each thread runs within its own namespace and 
 would not be able to get into the neighbour  namespace(or other 
 shared/referred namespaces like clojure.core) and do a .alterroot style 
 thing. But if possible, still be able to use most clojure features.
When I understand you right you want each sandbox to run in it's own namespace. 
This is a feature clj-sandbox already handles for you. All code is put in a own 
namespace - either one you define one or it takes a generated one. The sandbox 
compiler will use, after being created once, the same namespace for every code 
executed in it, the sandbox will use a one shot one unless given one that 
already exists. And as far as I can tell it is not possible to change the 
namespace with the current whitelists.

Regards,
Heinz

-- 
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: History Question

2010-05-06 Thread MarkSwanson
 or as-str from c.c.java-utils (I think)

Good one. It's in string.clj in the latest git.

I've needed this before too. There is so much good stuff in contrib. I
think I have to allocate 30 minutes every day and just try to commit
c.c. to memory.

-- 
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: labrepl updated

2010-05-06 Thread Laurent PETIT
master version of labrepl tested with ccw succesfully.

Remarks:
  * The pom.xml should have xmlns etc. stuff declared at its top, so
that IDEs able to interpret it can assist people for verification,
code completion, etc.
  * I still see lots of SNAPSHOT dependencies not fixed to a
particular snapshot, is it normal ?

2010/5/6 Michael Wood esiot...@gmail.com:
 On 6 May 2010 15:45, Craig Andera craig.and...@gmail.com wrote:
 So if someone produces a fork of incanter that doesn't have the
 warning (or David fixes up Incanter), then the problem goes away?

 I don't use Incanter and I haven't tried labrepl, but I thought David
 had fixed Incanter a week or so ago to rename group-by to group-on.
 Does labrepl bundle/depend on a slightly older version of Incanter?

 Because the other place I see the warnings coming out of is swank
 itself.

 --
 Michael Wood esiot...@gmail.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 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


Strange Loop call for presentations

2010-05-06 Thread Alex Miller
Hello Clojurians.hope some of you can submit to this conference:


CALL FOR SPEAKERS
Strange Loop Conference
St. Louis, Oct. 14-15, 2010
http://strangeloop2010.com

The Strange Loop conference is now holding an open call for
presentations
and workshops.  Strange Loop is a developer-run software conference
focusing on what's next in the world of software development.

Strange Loop focuses on the following technical areas (examples
shown):
* Alternative languages - Groovy, Ruby, Python, Clojure, Scala, F#,
Erlang
* Big data / NoSQL - Cassandra, Hadoop, HBase, CouchDB, MongoDB, Riak,
Neo4J
* Concurrency and distributed systems - actors, STM, ZooKeeper, Chef,
Akka
* Web - Javascript, jQuery, HTML 5, security, semantic web, RDFa
* Mobile - iPhone, Android, WebOS
* Open source - popular or interesting open source libraries

You can find the full call for presentations here:
http://strangeloop2010.com/pages/38735

For a list of already confirmed speakers see the following list:
http://strangeloop2010.com/speakers

To register, go here:
https://regonline.com/strangeloop2010

The call for presentations closes on July 9th, 2010.

Thanks,
Alex Miller

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