Re: special handling of :type in meta data

2009-04-26 Thread Konrad Hinsen
On 27.04.2009, at 00:33, David Chamberlin wrote: > I can get round this by not using a structure map for the metadata, > but since I'm going to be creating container loads of these structures > I understand that I need to be using struct-maps for efficiency. > > Is there a reason why this should n

Unloading a namespace?

2009-04-26 Thread Mark Derricutt
Is it possible to unload/remove a namespace at runtime at all? Mark ...and then Buffy staked Edward. The End. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to cl

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

2009-04-26 Thread Phil Hagelberg
On Sun, Apr 26, 2009 at 7:25 AM, Baishampayan Ghose wrote: > I am a Clojure newbie and I have been trying to get M-. > (slime-edit-definition) and the corresponding > M-,(slime-pop-find-definiton-stack) to work with Clojure. > > Right now, if I press M-. I get "Search failed" in he minibuffer. >

Re: Abstract data types in functional languages

2009-04-26 Thread David Nolen
GENIOUS idea Laurent ;) Extremely terse and uniform. Also because I switched the implementation to use multimethods, performance has jumped quite a bit. In fact if you memoize find-accessors, the code is only a little bit slower than update-in/assoc-in/get-in! The defset and defget macros now check

Re: 32-bit Unicode character literals

2009-04-26 Thread Stephen C. Gilardi
On Apr 26, 2009, at 7:47 PM, samppi wrote: user=> \u1 java.lang.IllegalArgumentException: Invalid unicode character: \u1 How would I embed the character as a literal in my Clojure code? Java characters are (still) 16 bits wide. A single Java character cannot represent the Unicode ch

32-bit Unicode character literals

2009-04-26 Thread samppi
In the REPL: Clojure user=> \u0032 \2 user=> \u1 java.lang.IllegalArgumentException: Invalid unicode character: \u1 How would I embed the character as a literal in my Clojure code? --~--~-~--~~~---~--~~ You received this message because you are subscribed

yet another clojure clr thread

2009-04-26 Thread Matthew D. Swank
Given the recent dust-up on c.l.l about the platform independence of clojure, I was wondering anyone was still hacking on the CLR code base. The stuff in contrib doesn't seem to have changed since it was checked in February. Matt --~--~-~--~~~---~--~~ You received

Re: The Path to 1.0

2009-04-26 Thread Laurent PETIT
I've created issue 110 with the patch attached in clojure's google code project. Hi Rich, Howard, I'll answer to both at the same time, trying to reconcile things a bit. Howard, my first patch was already along the lines of what you described below, I think (concerning the fact to use ant to ge

special handling of :type in meta data

2009-04-26 Thread David Chamberlin
I think I'm seeing some strange effects of some special handling of :type in meta-data. I'm trying to create a structure map with meta data that is also a structure map. The meta-data includes the :type key, but I see an error when I try to do this: ( def sm ( create-struct :type ) ) ( def so (

Re: Abstract data types in functional languages

2009-04-26 Thread Laurent PETIT
Hello, Maybe you should consider creating a single function with 2 arities: with one argument, it's the getter, with two arguments, it's the setter (that returns the new type) ! (prop-foo obj) ; --> returns the property prop-foo (prop-foo obj newval) ; --> returns a new version of obj with prop

Search Heap? (was: priority queue: some results)

2009-04-26 Thread e
my understanding of a suggestion in the chat room was to add a separate slot for an object associated with a priority rather than having comparable objects inserted. That is, the priority of something is not the something. It's just its priority. I need to play around a lot more with this to ma

Re: Abstract data types in functional languages

2009-04-26 Thread David Nolen
You're right. The following includes code for handling this case via setin and getin. I've also ditched macros, because that code couldn't support new lexical scopes in the setter/getter definition. setin getin support works by dynamically resolving getters and setters, thus this is slower than dir

Re: How to call function (or Java method) using string name?

2009-04-26 Thread Stuart Sierra
Yes. The following should also work, without calling into Clojure implementation methods: (defn eval-string [s] (eval (read-string s))) -Stuart Sierra On Apr 26, 1:50 pm, timc wrote: > Thanks Stuart. > > I have figured out another way, which is much more general (and uses > the lowest level o

Re: How to call function (or Java method) using string name?

2009-04-26 Thread timc
Thanks Stuart. I have figured out another way, which is much more general (and uses the lowest level of how Clojure works). (defn evalStr [s] (clojure.lang.Compiler/eval (clojure.lang.RT/ readString s))) will (attempt to) execute any valid form (i.e. the string that is the source of the form).

Re: How to call function (or Java method) using string name?

2009-04-26 Thread Stuart Sierra
This will work: ((resolve (symbol "+")) 1 2 3) To answer your question, a symbol is just a symbol, it doesn't have a value. (In Common Lisp, symbols have values, but in Clojure they do not.) In Clojure, values belong to Vars. "resolve" will find the Var that is named by the symbol. When you w

How to call function (or Java method) using string name?

2009-04-26 Thread timc
Is there a way of invoking functions, or java methods "by name" in Clojure? Or, put another way, why does this work: (+ 1 2) but this does not: ((symbol "+") 1 2) Similarly, this works (. javaObj (methodName param)) but this does not: (. javaObj ((symbol "methodName") param)) I suppose th

Re: The Path to 1.0

2009-04-26 Thread Rich Hickey
On Apr 26, 9:18 am, lpetit wrote: > On 26 avr, 15:04, Rich Hickey wrote: > > > On Apr 24, 1:57 pm, Howard Lewis Ship wrote: > > > > Another option is for the version number to be in build.xml, and for > > > it to generate a runtime file (so that Clojure can know its own > > > version number)

Getting slime-edit-definition to work with Clojure

2009-04-26 Thread Baishampayan Ghose
Hello, I am a Clojure newbie and I have been trying to get M-. (slime-edit-definition) and the corresponding M-,(slime-pop-find-definiton-stack) to work with Clojure. Right now, if I press M-. I get "Search failed" in he minibuffer. Is there any way to get it to work, or am I doing something co

Re: The Path to 1.0

2009-04-26 Thread lpetit
On 26 avr, 15:04, Rich Hickey wrote: > On Apr 24, 1:57 pm, Howard Lewis Ship wrote: > > > Another option is for the version number to be in build.xml, and for > > it to generate a runtime file (so that Clojure can know its own > > version number) and set the version number inside a generated p

Re: The Path to 1.0

2009-04-26 Thread Rich Hickey
On Apr 24, 1:57 pm, Howard Lewis Ship wrote: > Another option is for the version number to be in build.xml, and for > it to generate a runtime file (so that Clojure can know its own > version number) and set the version number inside a generated pom.xml. > You can use Ant resource copying with

Re: How do you "boot-strap" clojure from java?

2009-04-26 Thread prhlava
Hello Christophe, Thank you. > clojure.lang.RT.load("my/script.clj") ; your script must be on the classpath > clojure.lang.RT.var("my.ns", "my-var").invoke("hello") ; to call a function This is good (so I should read more then main.clj source code nex time ;-) ). Kind regards, Vlad --~--~--

Re: How do you "boot-strap" clojure from java?

2009-04-26 Thread Christophe Grand
prhlava a écrit : > But what would be really cool, if I could distribute clojure code in > the source form, load it into a java appliation _and_ call the clojure > code (which got compiled on the fly when loaded) from java. But maybe > the nature of > the java language does not permit this. >

Re: Google announcement, version 1.0 & SCM Holy War (not really)

2009-04-26 Thread prhlava
Hello Dan, > Which version did you try? msysgit works very well. Pity that VM I used is now no-existent, but as I said it was a while ago. Maybe msysgit improoved since. The reasons I had for choosing mercurial were: 1. The hg code base is simpler and smaller that git's 2. It is more easily p

Re: How do you "boot-strap" clojure from java?

2009-04-26 Thread prhlava
Hello James, > Are you aware you can compile Clojure code directly into Java class > files? Yes, this was my 1st method of distributing clojure apps (in a .jar). It works. But what would be really cool, if I could distribute clojure code in the source form, load it into a java appliation _and