Re: funny (?) str behavior

2010-02-24 Thread Jarkko Oranen
On Feb 23, 10:47 am, Alfred Tarski wrote: > Hi, > > I have this function: > > (defn wrap [x] >   (str "%" x "%")) > > and I do > > bf=> (str "boo hoo " (map wrap ["fdfd" "ggfs"])) > "boo hoo clojure.lang.lazy...@9e050eb0" > > This looks odd to me, but if the powers that be consider this to be >

Re: Can't get Ring to reload namespace

2010-02-24 Thread Neill Alexander
Great, that makes sense. Thanks very much guys. On Feb 24, 1:00 am, James Reeves wrote: > Ah yep, (var app) is probably a better idea than #(app %). > > - James > > On Feb 23, 11:55 pm, Mark McGranaghan wrote: > > > > Basically because wrap-reload is a function, so app is evaluated > > > before

Re: clojure-clr how to reference assemblies?

2010-02-24 Thread soyrochus
Hi, Some assemblies are loaded by default an can be used directly. But like IronPython, you will need to *explicitly* load most assemblies to be imported into your program. This differs from C# which does it "under the hood". The Assemblies can be loaded from the GAC or from a dll if it is not loa

on-the-fly fn creation, arglist, with-meta, :tag

2010-02-24 Thread Jules
Guys, I seem to have thrown myself in at the deep end here ! I'm writing some clojure which interacts very heavily with some pojos, making, hopefully, millions of method invocations a second. I tried : Clojure 1.1.0-new-SNAPSHOT user=> (set! *warn-on-reflection* true) true user=> (defn fn1 [s]

Re: on-the-fly fn creation, arglist, with-meta, :tag

2010-02-24 Thread Meikel Brandmeyer
Hi, On Feb 24, 12:50 pm, Jules wrote: > user=> (let [arg (with-meta 's {:tag String}) arglist [arg] body (list > '.length arg)] (eval (list 'fn arglist body))) > Reflection warning, NO_SOURCE_PATH:40 - reference to field length > can't be resolved. > # > user=> (*1 "foo") > 3 The following seem

Re: on-the-fly fn creation, arglist, with-meta, :tag

2010-02-24 Thread Jules
Meikel, Thanks for the quick answer. So I was only one step away from a solution ! I had : user=> (let [arg (with-meta 's {:tag String}) arglist [arg] body (list '.length arg)] (eval (list 'fn arglist body))) Reflection warning, NO_SOURCE_PATH:52 - reference to field length can't be resolved. #

Re: Strange reflection warning

2010-02-24 Thread Sean Devlin
Here's what I would suspect after running the following at the REPL user=> (set! *warn-on-reflection* true) true user=> (defn bar [o] (.toString o)) Reflection warning, NO_SOURCE_PATH:605 - reference to field toString can't be resolved. #'user/bar user=> (bar 1) "1" How does the reader know the d

Var Value from String of varname

2010-02-24 Thread Quzanti
I am sure this is really obvious but as I don't know the technical term for what I am trying to do I can't google it (def age 3) then (cons (symbol "age") [2 1]) I get (age 2 1) rather than (3 2 1) which is what I was hoping for. Or maybe you cannot do this at runtime? -- You received thi

Enclojure plugin Netbeans

2010-02-24 Thread Larry Wykel
Anyone!!! . Anyway if your using Enclojure etc in Netbeans let me describe exactly what happens when I attempt to install plugin Latest MacOS Snow Leopard NetBeans 6.8 with just Ruby Enclojure plugin from Git File came down with a .zip extention

clojure-clr how to wire up a delegate

2010-02-24 Thread adam11235
Hi, I've made progress in creating a simple app to show a windows form, however I am having trouble wiring up a delegate (to handle button clicks). The Java version uses Proxy to implement ActionListener, instead I am just trying to create an EventHandler passing as the 2nd constructor argument t

Posting

2010-02-24 Thread Larry Wykel
I just joined, got confirm, the clicked link. Posted msg to group. got email back confirming but is not showing up in messages Lar -- 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 tha

getting a library listed on the library page?

2010-02-24 Thread Kyle R. Burton
I've written an XPath library in clojure that wraps the Java api to make it easier to use from clojure [1]. What is the process for submitting libraries for inclusion on the clojure library page? I'm also not sure if the community feels this is worth including but I thought I'd offer it to see if

Re: Var Value from String of varname

2010-02-24 Thread Quzanti
Have found what I am trying to do eval I am working through the Halloway book, which doesn't seem to have eval in the index, so I probably should excuse myself my ignorance. Is there much a performance impact of using eval,as presumably the compiler can't do much until runtime? Or is the idea of

Re: clojure-clr how to wire up a delegate

2010-02-24 Thread Joop Kiefte
Tried to encapsulate what you want to put in the eventhandler in an anonymous function? And I don't know how that works in Clojure-CLR, but you might need proxy... 2010/2/24 adam11235 : > Hi, > > I've made progress in creating a simple app to show a windows form, > however I am having trouble wir

Re: clojure-clr how to wire up a delegate

2010-02-24 Thread Joop Kiefte
Forget about the proxy part, re-read your message... =x 2010/2/24 Joop Kiefte : > Tried to encapsulate what you want to put in the eventhandler in an > anonymous function? > > And I don't know how that works in Clojure-CLR, but you might need proxy... > > 2010/2/24 adam11235 : >> Hi, >> >> I've ma

Re: Strange reflection warning

2010-02-24 Thread Konrad Hinsen
On 24.02.2010, at 14:43, Sean Devlin wrote: > How does the reader know the difference between .hashCode > and .reallyObsureMethod? It would need to keep a whitelist of > everything in object, and know that these methods can be called > directly. Maybe the reader should be upgraded to handle this

Re: Var Value from String of varname

2010-02-24 Thread Stuart Halloway
You don't need (and shouldn't use) eval for this: @(resolve (symbol "age"))) Stu Have found what I am trying to do eval I am working through the Halloway book, which doesn't seem to have eval in the index, so I probably should excuse myself my ignorance. Is there much a performance impact of

Re: Strange reflection warning

2010-02-24 Thread Sean Devlin
Konrad, Okay, I was looking in the wrong place. Which leads me to suggest the following: Create a local fork of Clojure, make a new branch, and hack on the compiler. Run the experiment, see what happens :) Sean On Feb 24, 9:15 am, Konrad Hinsen wrote: > On 24.02.2010, at 14:43, Sean Devlin wr

Re: Posting

2010-02-24 Thread Michael Wood
On 24 February 2010 15:40, Larry Wykel wrote: > I just joined, got confirm, the clicked link. Posted msg to group. got email > back confirming but is not showing up > in messages > > Lar It looks like your message about Enclojure did take a little while to come through. [...] Received: by 10.15

Re: getting a library listed on the library page?

2010-02-24 Thread Krešimir Šojat
Hi, On Feb 24, 2:59 pm, "Kyle R. Burton" wrote: > I've written an XPath library in clojure that wraps the Java api to > make it easier to use from clojure [1].  What is the process for > submitting libraries for inclusion on the clojure library page? Instructions on how to get listed are at: htt

Re: Strange reflection warning

2010-02-24 Thread Konrad Hinsen
On 24.02.2010, at 15:42, Sean Devlin wrote: > Create a local fork of Clojure, make a new branch, and hack on the > compiler. Run the experiment, see what happens :) Right now I have better ways to use my time than hacking on a compiler that Rich is replacing with a new one written in Clojure!

Minimax in Clojure – request for code review and a question

2010-02-24 Thread Tzach
Hi all I made a naïve attempt to implement the minimax algorithm in Clojure. I would appreciate any comment on style, wrong (or right) use of idioms etc. Specifically, can I create a “contract” for the function I use, like heuristic, to formalize minimax requirement from it? Thanks Tzach Pseudoco

Re: Minimax in Clojure – request for code review a nd a question

2010-02-24 Thread Laurent PETIT
Hello, 2010/2/24 Tzach : > [...] > Specifically, can I create a “contract” for the function I use, like > heuristic, to formalize minimax requirement from it? Yes, you can add pre- and post- conditions, have a look here: http://clojure.org/special_forms HTH, -- Laurent -- You received this m

Re: Var Value from String of varname

2010-02-24 Thread Quzanti
Thanks. So it isn't a counterexample to my rule of Thumb 'If it is isn't in Halloway you shouldn't be using it' I'll catch you out one day. On Feb 24, 2:19 pm, Stuart Halloway wrote: > You don't need (and shouldn't use) eval for this: > > @(resolve (symbol "age"))) > > Stu > > > Have found wha

Re: Map with multiple keys?

2010-02-24 Thread liebke
> Alternatively, amalgamation works fine, though you probably want to > amalgamate with vector instead of str. That prevents inadvertent > collisions in cases where the elements in are similar (not a problem > for you). Again, assuming appropriate definitions for M and F: > > {[1 M] [ 1 2 3 4 5 6

Re: getting a library listed on the library page?

2010-02-24 Thread Kyle R. Burton
Thank you! I have not yet picked a license for the library, I am open to any of them, but would like to know what the preferred license is for the project. My first leaning is towards a permissive license such as BSD. What is preferred or recommended for clojure and its libraries? Thank you, K

Re: getting a library listed on the library page?

2010-02-24 Thread Sean Devlin
IANAL. The standard seems to be EPL 1.0, because it's what Rich uses for Clojure & Contrib. My understanding is that this causes problems w/ the GPL, so you'll probably want to stay away from that. Sean On Feb 24, 1:36 pm, "Kyle R. Burton" wrote: > Thank you! > > I have not yet picked a licens

Re: Got a Clojure library?

2010-02-24 Thread Kyle R. Burton
> The name of your library clj-xpath > Library home page URL http://github.com/kyleburton/clj-xpath > Your name Kyle Burton > Category (db, web, UI, parsing etc) XML Processing, XPath > License EPL > A one-paragraph description. Include 3rd party dependencies if any. Simplified XPath Lib

Re: Map with multiple keys?

2010-02-24 Thread Johann Hibschman
Base writes: > So this may be an extraordinary dumb question (even for me...) but is > there such a thing as a map with compound keys? [...] > I could do map - in - map, or do something like a (str cat gender) to > amalgamate 2 fields to set the key but I was just wondering if this > even exis

Re: Map with multiple keys?

2010-02-24 Thread eyeris
You can use a map as a key in another map. The clojure.set namespace has a function index that does this: user=> (doc index) - clojure.set/index ([xrel ks]) Returns a map of the distinct values of ks in the xrel mapped to a set of the maps in xrel with the corresponding

Re: clojure-clr how to wire up a delegate

2010-02-24 Thread soyrochus
Hi Adam, You need to use the gen-delegate macro to create delegates, See http://wiki.github.com/richhickey/clojure-clr/clr-interop The signature of the macro is (gen-delegate Type [args] body) whereby in case of event-handlers you would typically use the EventHandler class. The code becomes then

Re: Enclojure plugin Netbeans

2010-02-24 Thread Mark Nutter
I think I know this one: you need NetBeans with the Java module activated. I had the same problems trying to use NetBeans with just PHP. Mark On Wed, Feb 24, 2010 at 8:18 AM, Larry Wykel wrote: > Anyone!!! > > . > > Anyway if your using Enclojure etc in Netbeans let me describe exactly what > h

Prefixed or suffixed symbols?

2010-02-24 Thread joshua-choi
When it comes to distinguishing certain types of symbols from other things, should one use prefixes or suffixes? Example: naming tests with clojure.test/deftest. If you distinguish your tests’ symbols at all, do you do “t-addition” or “addition-t”? (I need to know what the standard is, if there i

Re: Enclojure plugin Netbeans

2010-02-24 Thread Lar
Wonderfull. Thanks so Much. Well you know I suspected as much. I did not want all the Java stuff right now. I went on to other things. So tommorow I will do the Java se plugin. '' Again thanks much. Its been fun last five days attempting to get a good Clojure IDE thats good. Larry On Feb 24, 5:

clojure.lib

2010-02-24 Thread cej38
I noticed a thread on the clojure developer's google group last night, http://groups.google.com/group/clojure-dev/browse_thread/thread/97e5fa7c49f457b2# I first want to give my vote for including: io seq string I would also like to see seq include more functionality. Two examples, which I use a

Re: clojure-clr how to wire up a delegate

2010-02-24 Thread adam11235
Excellent that worked. For other clojure-clr newbies, the Clojure.Source project has some samples that are helpful. Thanks, Adam. On Feb 25, 7:39 am, soyrochus wrote: > Hi Adam, > > You need to use the gen-delegate macro to create delegates, > > Seehttp://wiki.github.com/richhickey/clojure-clr/

Using zip-filter to remove nodes

2010-02-24 Thread James Sofra
Hi all, I am trying to use (abuse? *) zip-filter to remove some nodes and return the xml tree to me. If I do something like this: (xml1-> zipped-xml zf/descendants :model zip/remove zip/root) I can remove one :model node, but what if I want to remove more than one or all of the :model nodes?

Re: Bug in Clojure 1.2 case macro

2010-02-24 Thread pthatcher
Ouch. Burned by documented behavior :). Thanks for pointing that out. Seriously, though, I'm not the last that will get confused by this. My suggestion would be to make (case) copy the value from the *var* at compile time and use that. In fact, I decided to do just that and created (case-eval).

Re: Bug in Clojure 1.2 case macro

2010-02-24 Thread Chouser
On Wed, Feb 24, 2010 at 8:57 PM, pthatcher wrote: > Ouch.  Burned by documented behavior :).  Thanks for pointing that > out. > > Seriously, though, I'm not the last that will get confused by this. > My suggestion would be to make (case) copy the value from the *var* at > compile time and use that

Re: Using zip-filter to remove nodes

2010-02-24 Thread Chouser
On Wed, Feb 24, 2010 at 8:09 PM, James Sofra wrote: > Hi all, > > I am trying to use (abuse? *) zip-filter to remove some nodes and > return the xml tree to me. > If I do something like this: >    (xml1-> zipped-xml zf/descendants :model zip/remove zip/root) > > I can remove one :model node, but w

Re: clojure.lib

2010-02-24 Thread Sean Devlin
Rich has stated in a later thread on the dev list that he's more concerned with library refinement for the time being. The idea seemed to be that our efforts should be placed in getting signatures right & improving performance. I'm all for having the "what if" discussions, but now doesn't seem to

Re: Bug in Clojure 1.2 case macro

2010-02-24 Thread Michael Wood
On 25 February 2010 03:57, pthatcher wrote: [...] > (defn count-from [start] >  (iterate inc start)) > > ; like python > (defn zip [& lists] >  (apply map vector lists)) > > ; like python > (defn enumerate [vals] >  (zip (count-from 0) vals)) [...] By the way, there's an implementation of "enumer