Re: Concerned about Clojure's license choice.
One thing that might be doable and acceptable is dual licensing. If Clojure is realsed as CPL *and* GPL, it can be combined with GPL programs and it is not in any way more free than the CPL (say, like if you add BSD in the bag). In that way you can keep GPLists happy and still use CPL. On Nov 1, 6:33 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hello. I am an open source programmer and fan of Clojure! I wanted to express my concern about your wonderful language project in the hopes it may help it succeed even more. Are you really sure you want/need to use the Common Public License for your language? The biggest problem I see with this license is that it is not compatible with the GPL. This means a lot to many people and I would hate to see you have to wasted time with discussing license issues when a new license would avoid all these problems. You may find this article informative http://www.dwheeler.com/essays/gpl-compatible.html Chris --~--~-~--~~~---~--~~ 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 To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~--~~~~--~~--~--~---
Re: [EMAIL PROTECTED]
On Nov 2, 11:35 pm, David Hilton [EMAIL PROTECTED] wrote: On Oct 22, 5:15 am, Krukow [EMAIL PROTECTED] wrote: Rich, Was this presentation recorded? Any chance you can upload the slides and/or video for those of us that didn't participate in Lisp50. Thanks - Karl I'd also be interested in seeing the Lisp50 presentation (I missed it because I had SV hours scheduled at the time). I just noticed that the Boston Lisp presentation on Clojure has been posted (http://clojure.blogspot.com/). How similar were the two presentations? The Boston Lisp presentation, at 4x the length, was significantly more detailed and interactive, and what I would recommend if you have the time. If you've already seen it, the Lisp50 talk won't add much - probably most interesting in the context of the entire day's talks. I didn't record the Lisp50 talk, but all of the talks were recorded and will eventually end up somewhere, I'll post when I know they are available. Rich --~--~-~--~~~---~--~~ 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 To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~--~~~~--~~--~--~---
Macro-Defining Macros
Today, when I was writing some code, which is a macro writing a macro, I felt strange that it never work.. So I decided to examine existing code from 'On Lisp' Below code is copied from 'On Lisp'. I just changed , to ~. But this code does not work in Clojure. (defmacro abbrev [short long] `(defmacro ~short [ args] `(~'~long [EMAIL PROTECTED]))) Is there any important issue what I am overlooking when writing macros in Clojure? Any help appreciated. --~--~-~--~~~---~--~~ 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 To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~--~~~~--~~--~--~---
Re: Macro-Defining Macros
On Mon, Nov 3, 2008 at 9:13 AM, Chanwoo Yoo [EMAIL PROTECTED] wrote: Below code is copied from 'On Lisp'. I just changed , to ~. But this code does not work in Clojure. (defmacro abbrev [short long] `(defmacro ~short [ args] `(~'~long [EMAIL PROTECTED]))) Is there any important issue what I am overlooking when writing macros in Clojure? Any help appreciated. (defmacro abbrev [short long] `(defmacro ~short [ args#] `(~'~long [EMAIL PROTECTED]))) Your clue here is the error message: Can't use qualified name as parameter: user/args Clojure has a unique combination of features that help increase the hygine of macros. In your original translation, the word args was resolved into the user namespace because it was left bare. For local names (like formal arguments, let locals, etc.) you don't want that, so you need to use some mechanism to make it clear what you mean. One such mechanism is gensym (in this case I used the trailing # which is an auto-gensym). Another option is ~'foo which would explicitly capture foo from the context where the macro is expanded. --Chouser --~--~-~--~~~---~--~~ 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 To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~--~~~~--~~--~--~---
Re: (source name)
I agree that this would be helpful. On Nov 2, 6:34 pm, Mark McGranaghan [EMAIL PROTECTED] wrote: I really like being able to find and check documentation in the REPL with find-doc and doc, but I often would like to see the source code of a function or macro to be able to understand it better or learn from the implementation. To do this I switch into an editor with boot.clj, find and read the source, then switch back into the REPL. Doing this a lot got me thinking, what if we could just do e.g. user= (source filter) (defn filter Returns a lazy seq of the items in coll for which (pred item) returns true. pred must be free of side-effects. [pred coll] (when (seq coll) (if (pred (first coll)) (lazy-cons (first coll) (filter pred (rest coll))) (recur pred (rest coll) nil user= This might also be also be useful for programatically generating documentation with handy view source links. I was think for the source macro something like: (defmacro source Prints the source text of the top-level form in which var was created. [name] `(if-let src-txt# (:source (meta (var ~name))) (println src-txt#) (println no source found For that to work we would need a :source meta value like we currently have for :line and :file. My questions then are: - Does the general idea of a source macro or something similar sound useful? Am I missing something that renders such a feature unnecessary? - How might one implement the source macro and the associated support in the reader/compiler? Thanks for your thoughts, - Mark --~--~-~--~~~---~--~~ 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 To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~--~~~~--~~--~--~---
A newb question about macros
(defmacro foobar [] `'(+ a b)) (let [a 5 b 6] (eval (foobar))) I know that the above is completely useless but I'm just trying to get an intuitive understanding of how macros work under Clojure. At the REPL when I try to evaluate the second form, I get an null pointer exception. Why can't the result of the foobar macro access the values of a and b? Many thanks, David --~--~-~--~~~---~--~~ 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 To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~--~~~~--~~--~--~---
Re: A question about test-is
On Nov 2, 11:20 pm, Chanwoo Yoo [EMAIL PROTECTED] wrote: When I evaluate (run-tests) in a repl of my terminal, I can see test messages. But when I do it in slime, I can't see any messages. How I can see test results in slime? Hmm, not sure. I don't use SLIME, but I know that run-tests prints results to *test-out*, which by default is bound to java.lang.System.err. You could try re-binding *test-out* to standard output like this: (binding [*test-out* System/out] (run-tests)) -Stuart Sierra --~--~-~--~~~---~--~~ 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 To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~--~~~~--~~--~--~---
Re: (source name)
And this could open the door to organic code : dynamically discovering the source code of functions, and - why not- correcting / adjusting the code by re-def ining the function by manipulating its original source code. Some sort of macro, at runtime :-) On Nov 3, 3:57 pm, Paul Barry [EMAIL PROTECTED] wrote: I agree that this would be helpful. On Nov 2, 6:34 pm, Mark McGranaghan [EMAIL PROTECTED] wrote: I really like being able to find and check documentation in the REPL with find-doc and doc, but I often would like to see the source code of a function or macro to be able to understand it better or learn from the implementation. To do this I switch into an editor with boot.clj, find and read the source, then switch back into the REPL. Doing this a lot got me thinking, what if we could just do e.g. user= (source filter) (defn filter Returns a lazy seq of the items in coll for which (pred item) returns true. pred must be free of side-effects. [pred coll] (when (seq coll) (if (pred (first coll)) (lazy-cons (first coll) (filter pred (rest coll))) (recur pred (rest coll) nil user= This might also be also be useful for programatically generating documentation with handy view source links. I was think for the source macro something like: (defmacro source Prints the source text of the top-level form in which var was created. [name] `(if-let src-txt# (:source (meta (var ~name))) (println src-txt#) (println no source found For that to work we would need a :source meta value like we currently have for :line and :file. My questions then are: - Does the general idea of a source macro or something similar sound useful? Am I missing something that renders such a feature unnecessary? - How might one implement the source macro and the associated support in the reader/compiler? Thanks for your thoughts, - Mark --~--~-~--~~~---~--~~ 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 To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~--~~~~--~~--~--~---
Re: (source name)
On Sun, Nov 2, 2008 at 6:34 PM, Mark McGranaghan [EMAIL PROTECTED] wrote: I really like being able to find and check documentation in the REPL with find-doc and doc, but I often would like to see the source code of a function or macro to be able to understand it better or learn from the implementation. Hi Mark, Just FYI, if you use Clojure through Emacs/Slime, you already have this functionality. The command slime-edit-definition, or M-. (meta-key period), will open the source for whatever name is currently under your cursor. Best, Graham To do this I switch into an editor with boot.clj, find and read the source, then switch back into the REPL. Doing this a lot got me thinking, what if we could just do e.g. user= (source filter) (defn filter Returns a lazy seq of the items in coll for which (pred item) returns true. pred must be free of side-effects. [pred coll] (when (seq coll) (if (pred (first coll)) (lazy-cons (first coll) (filter pred (rest coll))) (recur pred (rest coll) nil user= This might also be also be useful for programatically generating documentation with handy view source links. I was think for the source macro something like: (defmacro source Prints the source text of the top-level form in which var was created. [name] `(if-let src-txt# (:source (meta (var ~name))) (println src-txt#) (println no source found For that to work we would need a :source meta value like we currently have for :line and :file. My questions then are: - Does the general idea of a source macro or something similar sound useful? Am I missing something that renders such a feature unnecessary? - How might one implement the source macro and the associated support in the reader/compiler? Thanks for your thoughts, - Mark --~--~-~--~~~---~--~~ 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 To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~--~~~~--~~--~--~---
Re: A question about test-is
On Nov 3, 2008, at 9:34 AM, Stuart Sierra wrote: Hmm, not sure. I don't use SLIME, but I know that run-tests prints results to *test-out*, which by default is bound to java.lang.System.err. You could try re-binding *test-out* to standard output like this: (binding [*test-out* System/out] (run-tests)) -Stuart Sierra Right, that's it. Slime/Swank_Clojure sends error output to the *inferior lisp* buffer. I was pleased to see that you had provided *test-out* when this came up for clojure.contrib.test-clojure. --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 To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~--~~~~--~~--~--~---
Re: Concerned about Clojure's license choice.
Hi Chris What said problem would moving to GPL solve ? Shouldn't we hear atleast a couple of benefits that may be derived from moving to GPL ? Are there (GPL) projects that clojure would benefit from incorporating directly into the base language compiler and/or libraries ? What are they ? Are there people and communities waiting to contribute code who see CPL as a road block ? Secondly, from the license point of view, which GPL would you advocate ? GPL V2 and GPL V3 are incompatible, unless the authors have given freedom to choose a later version when they released the code under GPL v2. Java has moved to GPL (with classpath exception), however would clojure benefit from JVM code ? Clojure is a language that targets the JVM/Java platform. The license of the platform is of same relevance as a license of OS (Linux/Windows/Solaris) has on license of code that is running on it, which to say is - none! Choice of venue for resolving infringement disputes is, imho, the thing that keeps the license relevant. It keeps the author in a position where he can defend himself or prosecute meaningfully, unless somehow you are rolling in cash and are okay with prosecuting someone in a court overseas in his hometown and not yours! Finally, would someone enlighten a project that derived significant benefits from moving from a non-GPL open source license to GPL. PS: And what is it about GPL fanbois telling everyone what to do with their code ? I don't see BSD/MIT/Apache/X11/CDDL/CPL camps go around poking everyone to switch just like what religious nuts were doing in medieval times. - Akhilesh On Nov 1, 10:33 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hello. I am an open source programmer and fan of Clojure! I wanted to express my concern about your wonderful language project in the hopes it may help it succeed even more. Are you really sure you want/need to use the Common Public License for your language? The biggest problem I see with this license is that it is not compatible with the GPL. This means a lot to many people and I would hate to see you have to wasted time with discussing license issues when a new license would avoid all these problems. You may find this article informative http://www.dwheeler.com/essays/gpl-compatible.html Chris --~--~-~--~~~---~--~~ 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 To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~--~~~~--~~--~--~---
Re: (source name)
On Sun, Nov 2, 2008 at 6:34 PM, Mark McGranaghan [EMAIL PROTECTED] wrote: I really like being able to find and check documentation in the REPL with find-doc and doc, but I often would like to see the source code of a function or macro to be able to understand it better or learn from the implementation. (import '(java.io LineNumberReader InputStreamReader PushbackReader) '(clojure.lang RT)) (defn get-source [vn] (let [m ^(resolve vn) strm (.getResourceAsStream (RT/baseLoader) (str clojure/ (:file m)))] (if (and m strm) (with-open rdr (LineNumberReader. (InputStreamReader. strm)) (dotimes _ (dec (:line m)) (.readLine rdr)) (.mark rdr 2000) (read (PushbackReader. rdr)) (let [cnt (- (.getLineNumber rdr) (:line m))] (.reset rdr) (dotimes _ cnt (println (.readLine rdr))) true)) (println Source not found for vn (defmacro source [n] `(get-source '~n)) It's not pretty, and it only works on functions defined in the clojure namespace. But it does work, without requiring any changes to Clojure itself: user= (source filter) (defn filter Returns a lazy seq of the items in coll for which (pred item) returns true. pred must be free of side-effects. [pred coll] (when (seq coll) (if (pred (first coll)) true --~--~-~--~~~---~--~~ 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 To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~--~~~~--~~--~--~---
Re: Concerned about Clojure's license choice.
On Nov 3, 5:35 am, J. Pablo Fernández [EMAIL PROTECTED] wrote: One thing that might be doable and acceptable is dual licensing. If Clojure is realsed as CPL *and* GPL, it can be combined with GPL programs and it is not in any way more free than the CPL (say, like if you add BSD in the bag). In that way you can keep GPLists happy and still use CPL. It doesn't even have to be dual-licensed with the GPL. It just has to be dual licensed with a GPL *compatible* license. Chris --~--~-~--~~~---~--~~ 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 To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~--~~~~--~~--~--~---
Re: Concerned about Clojure's license choice.
On Nov 3, 7:33 am, Christian Vest Hansen [EMAIL PROTECTED] wrote: On Mon, Nov 3, 2008 at 2:11 AM, Rich Hickey [EMAIL PROTECTED] wrote: MIT and BSD are not reciprocal licenses. I want a reciprocal license. What does it mean that a license is reciprocal? I think in this case it means that any contributions or modifications also become licensed under the CPL. So (unlike the BSD license) I can't do an 'embrace and extend' on Clojure without releasing my changes back to the community. The CPL also has specific wording to deal with patents, so someone can't add a bunch of patented code (either accidentally or deliberately) and later demand royalties for using the patented stuff. --~--~-~--~~~---~--~~ 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 To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~--~~~~--~~--~--~---
Re: A newb question about macros
@Phlex, I understand why the code is usually bad form. @MikeM, I had already noticed that it worked on the REPL when I defined vars. My questions was _why_ it does not work in the case where I have locals via a let expression? David On Mon, Nov 3, 2008 at 12:27 PM, MikeM [EMAIL PROTECTED]wrote: On Nov 3, 9:57 am, David Nolen [EMAIL PROTECTED] wrote: (defmacro foobar [] `'(+ a b)) (let [a 5 b 6] (eval (foobar))) I know that the above is completely useless but I'm just trying to get an intuitive understanding of how macros work under Clojure. At the REPL when I try to evaluate the second form, I get an null pointer exception. Why can't the result of the foobar macro access the values of a and b? If you macroexpand, (macroexpand '(foobar)) you'll see that the a and b symbols in your macro are resolved to be vars in the namespace in which the macro is defined (I defined the macro in the user namespace): (quote (clojure/+ user/a user/b)) Note that symbol + was resolved to be the + function from boot.clj, since my user namespace refers to the clojure namespace. So when the foobar macro is run, the resulting code doesn't look at the a and b in your let, but instead tries to find vars named a and b. If you: (def a 1) (def b 2) then execute (let [a 5 b 6] (eval (foobar))) you'll get 3. Hope that helps. --~--~-~--~~~---~--~~ 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 To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~--~~~~--~~--~--~---
newb slime/clojure question...
I've been trying to get clojure working with slime (on windows). I can run ants.clj from the command line fine. I can run simple expressions under slime (e.g. (+ 2 3)). However, when I try to run ants.clj from within slime, I get the following warning in the inferior lisp buffer, and nothing happens. Reflection warning, line: 280 - call to drawImage can't be resolved. Reflection warning, line: 283 - call to setPreferredSize can't be resolved. Looking at the sun.boot.class.path property for both executables seems the same. When I look at the system classpath using the invocation I found here: http://paste.lisp.org/display/69257 I get the clojure.jar, and ~/.clojure/*. From the command line directly, I just get clojure.jar on the classpath. Anybody have any advice on how I can fix this? --~--~-~--~~~---~--~~ 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 To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~--~~~~--~~--~--~---
2nd European Lisp Symposium (ELS 2009)
* * *2nd European Lisp Symposium (ELS 2009) * * * * Milan, Italy, May 27-29, 2009 * * Università degli Studi di Milano-Bicocca * * * Important Dates: * Submission deadlineJanuary 25, 2009 * Author notificationFebruary 27, 2009 * Final paper dueMarch 23, 2009 * Symposium May 27-29, 2009 Accepted research papers will be invited for a special issue of the Journal of Universal Computer Science (J.UCS). See the symposium website for more details. Scope: ** The purpose of the European Lisp Symposium is to provide a forum for the discussion of all aspects of the design, implementation and application of any of the Lisp dialects. We encourage everyone interested in Lisp to participate. The European Lisp Symposium 2009 invites high quality papers about novel research results, insights and lessons learned from practical applications, and educational perspectives, all involving Lisp dialects, including Common Lisp, Scheme, Emacs Lisp, AutoLisp, ISLISP, Dylan, Clojure, and so on. Topics include, but are not limited to: * Language design and implementation techniques * Language integration, interoperation and deployment * Language critique and future directions * Reflection and meta-level architectures * Educational approaches * Software adaptation and evolution * Configuration management * Artificial intelligence * Large and ultra-large-scale systems * Development methodologies * Development support and environments * Persistent systems * Scientific computing * Parallel and distributed computing * Data mining * Semantic web * Dynamic optimization * Innovative applications * Hardware and virtual machine support * Domain-oriented programming * Lisp pearls * Experience reports and case studies We also encourage submissions about past approaches that have been largely forgotten about, as long as they are presented in a new setting. We invite submissions in two categories: original contributions and work-in-progress papers. * Original contributions have neither been published previously nor are under review by other refereed events or publications. Research papers should describe work that advances the current state of the art, or presents old results from a new perspective. Experience papers should be of broad interest and should describe insights gained from substantive practical applications. The program committee will evaluate each contributed paper based on its relevance, significance, clarity, and originality. * Work in progress describes ongoing work that is not ready for publication yet, but would benefit strongly from feedback by other researchers, practitioners and educators. Such contributions will not be published in the symposium proceedings, but will be made available at the symposium website. The work-in-progress track will be organized as a series of writers' workshops where authors work together to improve their papers. Some authors who submit papers for the main track will be suggested to contribute their work in this track instead, if the program committee decides that their submission is not yet ready for a publication. The writers' workshops will take place at the symposium in Milan on May 27, 2008. Program Chair: ** * António Leitão, Technical University of Lisbon, Portugal Local Chair: * Marco Antoniotti, Università Milano Bicocca, Italy Program committee: ** * Giuseppe Attardi, Università di Pisa , Italy * Pascal Costanza, Vrije Universiteit Brussel, Belgium * Irene Durand, Université Bordeaux 1, France * Marc Feeley, Université de Montréal, Canada * Ron Garret, Amalgamated Widgets Unlimited, USA * Gregor Kiczales, University of British Columbia, Canada * Scott McKay, ITA Software, Inc., USA * Peter Norvig, Google Inc., USA * Julian Padget, University of Bath, UK * Kent Pitman, PTC, USA * Christian Queinnec, Université Pierre et Marie Curie, France * Christophe Rhodes, Goldsmiths College, University of London, UK * Robert Strandh, Université Bordeaux 1, France * Mark Tarver, Lambda Associates, UK * Didier Verna, EPITA Research and Development Laboratory, France * JonL White, TheGingerIceCreamFactory of Palo Alto, USA * Taiichi Yuasa, Kyoto University, Japan Important Dates: * Submission deadlineJanuary 25, 2009 * Author notificationFebruary 27, 2009 * Final paper dueMarch 23, 2009 * Symposium May 27-29, 2009 For more information, see http://european-lisp-symposium.org --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Clojure group. To post to this group, send email
Ant simulation questions: keyword functions and #' for agent calls
Howdy, been enjoying learning Clojure and watching some screencasts but had to simple (I think) questions about the ant code that I haven't been able to find info about on the site or in this group (though I admit my lack of knowledge about what to call these two questions could lead me to not find them in the google group). First is the use of keywords as the predicate in some forms. For example in the turn function: (:ant @p) Does :ant become a function of the map because it's a map? Can you always do this? Isn't this the same as (@p :ant)? Is there an equivalent for vectors? The second question deals with the agent calls. To start the agents off you just have to pass the function: (send-off animator animation) Yet in the animation function you use: (send-off *agent* #'animation) Is this because animation isn't bound in the current thread and you need to get the route bound value (if that's the correct term) for the animation var? If so I guess this confuses me a little in the sense that you have to know you're in a thread where animation is not bound. If you need to use #' for this reason, why can't the system be smart enough to say hey this isn't bound in my thread, does it have a root binding? or something of that nature? Anyway thanks and sorry if the answers are in the group somewhere, once I get answers I'd probably be able to find them :) Thanks! Chris G --~--~-~--~~~---~--~~ 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 To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~--~~~~--~~--~--~---
(Small Questions) Keywords used as verbs and different in agent send-off calls in ant simulation
Howdy, I posted this a little while ago and it doesn't seem to have posted so I'm reposting. If this comes through twice I'm sorry for double posting. My first question is about the form: (:ant @p) How does :ant get to be used as a verb? Do all keywords expand to (@p :ant) if @p is a map or something like that? Couldn't find any reference to this on the site or group but I also don't know exactly what to call it so searches may have been doomed to fail from the start. My second question is about the send-off calls. When starting the program you can refer to animate by the symbol alone. Inside the agent function itself you need to refer to it as #'animate. Is this because animate isn't bound in the current thread but is root bound? If that's the case, why is this done rather than have this type of lookup be automatic? What is the problem with just the symbol name being used and using the root binding if the current thread doesn't have a binding (Obviously this question means nothing if I wrongly assumed why you need to use #' in the first place). --~--~-~--~~~---~--~~ 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 To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~--~~~~--~~--~--~---
Re: Ant simulation questions: keyword functions and #' for agent calls
On 03.11.2008, at 17:22, Kelsin wrote: First is the use of keywords as the predicate in some forms. For example in the turn function: (:ant @p) Does :ant become a function of the map because it's a map? Can you always do this? Isn't this the same as (@p :ant)? Yes, yes, and yes. Is there an equivalent for vectors? Not that I know of - and I can't think of anything obvious to use as the accessor function. Vectors are simply indexed by numbers. I'll let more experienced users reply to your last question! Konrad --~--~-~--~~~---~--~~ 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 To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~--~~~~--~~--~--~---
Re: Concerned about Clojure's license choice.
On Nov 3, 7:59 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: I'm not advocating the GPL...only a GPL compatible license. Regarding the benefits to a dual license or reclicense, are you sure there *aren't* benefits? If it is easy to move to GPL compatibility, then is it worth worrying about? Yes, it's worth worrying about. The problem is, you're going to have the danger of fragmenting the Clojure user base. If one part of the community distribute their work under the CPL, while the other part distribute their work under the GPL (or any other CPL-incompatible license), you will not be able to combine code from both parts of the community. You're going to have to rely on everyone dual-licensing their work, which kind of negates all the benefits of having dual- licensed Clojure in the first place. That's the way I see it, anyway. I'm not very sure about all of this. Matthias --~--~-~--~~~---~--~~ 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 To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~--~~~~--~~--~--~---
Re: (Small Questions) Keywords used as verbs and different in agent send-off calls in ant simulation
And of course after I post this the original finally posts, sorry about that, should have waited longer. Chris G On Nov 3, 3:05 pm, Kelsin [EMAIL PROTECTED] wrote: Howdy, I posted this a little while ago and it doesn't seem to have posted so I'm reposting. If this comes through twice I'm sorry for double posting. My first question is about the form: (:ant @p) How does :ant get to be used as a verb? Do all keywords expand to (@p :ant) if @p is a map or something like that? Couldn't find any reference to this on the site or group but I also don't know exactly what to call it so searches may have been doomed to fail from the start. My second question is about the send-off calls. When starting the program you can refer to animate by the symbol alone. Inside the agent function itself you need to refer to it as #'animate. Is this because animate isn't bound in the current thread but is root bound? If that's the case, why is this done rather than have this type of lookup be automatic? What is the problem with just the symbol name being used and using the root binding if the current thread doesn't have a binding (Obviously this question means nothing if I wrongly assumed why you need to use #' in the first place). --~--~-~--~~~---~--~~ 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 To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~--~~~~--~~--~--~---
Re: (source name)
On Nov 3, 7:03 pm, Chouser [EMAIL PROTECTED] wrote: [...] It's not pretty, and it only works on functions defined in the clojure namespace. [...] The variation below works in a more general setting: it will look for the source file anywhere in the classpath (including jar files) or in user.dir I just combined your get-source function with functionality from swank- clojure (in swank/commands/basic/basic.clj). I didn't test it much, there might be a bug or two. Carlos (import '(java.io File FileInputStream LineNumberReader InputStreamReader PushbackReader) '(java.util.zip ZipFile) '(clojure.lang RT)) (defn- namespace-to-path [ns] (- (name (ns-name ns)) (.replace \- \_) (.replace \. \/))) (defn- get-path-prop Returns a coll of the paths represented in a system property ([prop] (seq (- (System/getProperty prop) (.split File/pathSeparator ([prop props] (lazy-cat (get-path-prop prop) (mapcat get-path-prop props (defn- search-paths [] (concat (get-path-prop user.dir java.class.path sun.boot.class.path) (map #(.getPath %) (.getURLs clojure.lang.RT/ ROOT_CLASSLOADER (defn- find-file-in-dir [#^File file #^String dir] (let [file-name (. file (getPath)) child (File. (File. dir) file-name)] (or (when (.exists child) (FileInputStream. child)) (try (let [zipfile (ZipFile. dir)] (when (.getEntry zipfile file-name) (.getInputStream zipfile (.getEntry zipfile file-name (catch Throwable e false) (defn- find-file-in-paths [#^String file paths] (let [f (File. file)] (if (.isAbsolute f) (FileInputStream. f) (first (filter identity (map #(find-file-in-dir f %) paths)) (defn get-source [vn] (let [m ^(resolve vn) strm (when (:file m) (or (find-file-in-paths (str (namespace-to-path (:ns m)) (.separator File) (:file m)) (search-paths)) (find-file-in-paths (:file m) (search-paths] (if strm (with-open rdr (LineNumberReader. (InputStreamReader. strm)) (dotimes _ (dec (:line m)) (.readLine rdr)) (.mark rdr 2000) (read (PushbackReader. rdr)) (let [cnt (- (.getLineNumber rdr) (:line m))] (.reset rdr) (dotimes _ cnt (println (.readLine rdr))) true)) (println Source not found for vn (defmacro source [n] `(get-source '~n)) --~--~-~--~~~---~--~~ 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 To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~--~~~~--~~--~--~---
Re: Back on max again...
On Nov 3, 5:39 pm, Paul Stadig [EMAIL PROTECTED] wrote: Could/Should the max function be modified to work against the Comparable interface instead of expecting its arguments to be numbers? I'm working with a sequence of strings that are dates in the -mm-dd format, and I want to find the max. Calling max gives an exception about not being able to cast to a java.lang.Number. I vote no, max shouldn't be modified because 1. The notation is ambiguous in the context of dates. What's the max date? The most recent one, or the oldest one? 2. Even if everyone agrees on what the max date of a sequence of dates means, you're asking what max means for a sequence of strings. You're thinking of some kind of dictionary order, but some people might want to use string length. Since your version of max would accept arbitrary strings, it would break for dates represented using a different string format. The semantics of max string are unclear enough that it would be better to write out the operation explicitly so that all readers of the code know what you mean. mfh --~--~-~--~~~---~--~~ 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 To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~--~~~~--~~--~--~---
Re: Open Source project hosting for clojure.
On Nov 3, 2008, at 4:09 PM, Paul Stadig wrote: Hey Drew, I'd like to see this come to fruition, and help administer if needed. I'll volunteer some time to help admin as well. Coming from Ruby (most recently) I may have a Ruby bias, but I think that RubyForge has been a great boon to the Ruby community. It is nice to be able to go to a single site (or do a google site: search) to find Ruby projects. Of course there was also RAA, and now GitHub seems to be splintering things as well, but I don't mean to get into all that. I think at least for this stage of the language and community development, Clojure would benefit from having a kind of defacto place to go to find libraries. CLiki and Python's PyPI provide a standard place to find libraries for their respective languages without providing project management tools - it serves as an index only. Something like that for Clojure would be great. As a somewhat secondary issue, I would also like see a gem like system for Clojure, and I have some ideas about how it might work in Clojure. I think it's too early, and Clojure has to get to the point where it is more stable, with numbered releases, and it has a stable command line script that comes baked in. When the time is right though, I think there should be some support for building Clojure gems (or at least indexing) on the server, like GitHub does with Ruby gems. Package and dependency management is a fun problem, hopefully we can learn from others and come up with something appropriate. -Matt Obviously, the standard (version control, tickets, mailing list, web page, etc.) would be peachy. Paul --~--~-~--~~~---~--~~ 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 To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~--~~~~--~~--~--~---
Re: A newb question about macros
@Phlex @MikeM, apologies I checked back on Chouser's post and it helped me to understand that Clojure takes a different approach to macros than Common Lisp: Common Lisp - (defmacro foobar () `(+ a b)) (let ((a 5) (b 6)) (foobar)) Clojure - (defmacro foobar [] `(+ ~'a ~'b)) (let [a 5 b 6] (foobar)) The is answer to the WHY: Clojure believes its a good thing that it's harder to shoot yourself in the foot than Common Lisp. I agree. Thanks On Mon, Nov 3, 2008 at 2:35 PM, David Nolen [EMAIL PROTECTED] wrote: @Phlex, I understand why the code is usually bad form. @MikeM, I had already noticed that it worked on the REPL when I defined vars. My questions was _why_ it does not work in the case where I have locals via a let expression? David On Mon, Nov 3, 2008 at 12:27 PM, MikeM [EMAIL PROTECTED]wrote: On Nov 3, 9:57 am, David Nolen [EMAIL PROTECTED] wrote: (defmacro foobar [] `'(+ a b)) (let [a 5 b 6] (eval (foobar))) I know that the above is completely useless but I'm just trying to get an intuitive understanding of how macros work under Clojure. At the REPL when I try to evaluate the second form, I get an null pointer exception. Why can't the result of the foobar macro access the values of a and b? If you macroexpand, (macroexpand '(foobar)) you'll see that the a and b symbols in your macro are resolved to be vars in the namespace in which the macro is defined (I defined the macro in the user namespace): (quote (clojure/+ user/a user/b)) Note that symbol + was resolved to be the + function from boot.clj, since my user namespace refers to the clojure namespace. So when the foobar macro is run, the resulting code doesn't look at the a and b in your let, but instead tries to find vars named a and b. If you: (def a 1) (def b 2) then execute (let [a 5 b 6] (eval (foobar))) you'll get 3. Hope that helps. --~--~-~--~~~---~--~~ 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 To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~--~~~~--~~--~--~---
Re: Ant simulation questions: keyword functions and #' for agent calls
On Nov 3, 3:35 pm, Konrad Hinsen [EMAIL PROTECTED] wrote: On 03.11.2008, at 17:22, Kelsin wrote: First is the use of keywords as the predicate in some forms. For example in the turn function: (:ant @p) Does :ant become a function of the map because it's a map? Can you always do this? Isn't this the same as (@p :ant)? Yes, yes, and yes. Thought so, definitely neat, I like the readability a lot. Is there an equivalent for vectors? Not that I know of - and I can't think of anything obvious to use as the accessor function. Vectors are simply indexed by numbers. Yeah that figures, didn't think that one through. I guess what I was really asking is if there was any other use of keyword functions, or just for maps. I'll let more experienced users reply to your last question! Thanks for your help though! Chris G --~--~-~--~~~---~--~~ 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 To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~--~~~~--~~--~--~---
Re: Back on max again...
On Tue, Nov 4, 2008 at 6:23 AM, Mark H. [EMAIL PROTECTED] wrote: On Nov 3, 6:48 pm, Cosmin Stejerean [EMAIL PROTECTED] wrote: I think clearly spelling out how objects of a type should be sorted is the point of the Comparable interface. Ah, yes, this is true, I hadn't realized that String and Date both implement Comparable. Comparable is supposed to impose a total ordering on a set, so in a finite set of objects of the same type, the max is always well defined. +1 on (min) and (max) operating on Comparables. -- Venlig hilsen / Kind regards, Christian Vest Hansen. --~--~-~--~~~---~--~~ 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 To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~--~~~~--~~--~--~---
STM criticisms from Bryan Cantrill (Sun)
http://blogs.sun.com/bmc/entry/concurrency_s_shysters I'm new to clojure... and like what I see. Just passing this blog post on as a discussion point... 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 To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~--~~~~--~~--~--~---
Re: Concerned about Clojure's license choice.
Hello, On Nov 3, 7:54 pm, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: On Nov 3, 5:35 am, J. Pablo Fernández [EMAIL PROTECTED] wrote: One thing that might be doable and acceptable is dual licensing. If Clojure is realsed as CPL *and* GPL, it can be combined with GPL programs and it is not in any way more free than the CPL (say, like if you add BSD in the bag). In that way you can keep GPLists happy and still use CPL. It doesn't even have to be dual-licensed with the GPL. It just has to be dual licensed with a GPL *compatible* license. True, it can be LGPL, BSD, etc. I proposed GPL because is the one that leaves less freedom, thus changing as little as possible the current situation. --~--~-~--~~~---~--~~ 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 To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/clojure?hl=en -~--~~~~--~~--~--~---