How do I extend an existing function to take different number of params?
Suppose I already have a function f that accepts 0 and 1 param: (defn f ([] 0) ([ _ ] 1)) How do I extend it with additional version that takes 2 params? Something like the following that does not override the original: (defn f [ _ _ ] 2) and makes all 3 work: (f) (f 1) (f 1 2) - Dmitry -- 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: Probability Monad
On Fri, Jan 8, 2010 at 2:57 PM, Konrad Hinsen wrote: > It's a bug. More specifically, a typo in a recent improvement. It is fixed > now, so please try again with the current version - or in fact go back to an > older version before December 28. Thanks! I pulled the latest clojure-contrib source, and my code works now. > > BTW, I suppose that instead of > >> (domonad dist-m >> [a die >> b die] >> [+ a b]) > > you want > > (domonad dist-m > [a die > b die] > (+ a b)) > Whups. Yes, you're right, that's precisely what I meant to type! - Joel. -- 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: Strange problem when adding type to a var defined by a macro.
Hi Nicolas, The macro works fine. The problem is that the REPL tries to print the result (which is the var you created) and the print multimethod does not know what to do with your custom type, and the default method throws an exception. user=> (defbar fuz (+ 1 1)) java.lang.ClassCastException: clojure.lang.Var cannot be cast to clojure.lang.IObj user=> fuz 2 user=> (meta (var fuz)) {:ns #, :name fuz, :file "NO_SOURCE_PATH", :line 133, :type :user/MyType} user=> (print (var fuz)) java.lang.ClassCastException: clojure.lang.Var cannot be cast to clojure.lang.IObj (NO_SOURCE_FILE:0) user=> (defmethod print-method ::MyType [o w] (.write w "hi")) # user=> (print (var fuz)) hinil user=> (defbar zzz (+ 2 3)) hi user=> zzz 5 user=> (meta (var zzz)) {:ns #, :name zzz, :file "NO_SOURCE_PATH", :line 148, :type :user/MyType} (defmethod print-method :default [o, #^Writer w] (print-method (vary-meta o #(dissoc % :type)) w)) user=> (vary-meta (var fuz) #(dissoc % :type)) java.lang.ClassCastException: clojure.lang.Var cannot be cast to clojure.lang.IObj (NO_SOURCE_FILE:0) Regards, Tim. 2010/1/9 Nicolas Buduroi : > Hi, I'm using macros to define special vars (w/ a keyword as type) to > retrieve them later with ns-utils/ns-vars and filter them. I don't > know if this technique is recommended or if there's some better way to > achieve this, but there's something weird happening when we try to > evaluate the var defined at the REPL. For example, if you run this > code: > > (defmacro defbar [foo & body] > `(def ~(with-meta foo {:type ::MyType}) > (eval ~...@body))) > > (defbar baz (+ 1 1)) > > It throws a ClassCastException: "clojure.lang.Var cannot be cast to > clojure.lang.IObj", which is an error I encountered often and never > truly understood. Can somebody help me find out what I'm missing? > > Thanks > > - budu > > -- > 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: C interop lib (JNA wrapper)
I've gotten rid of the automatic loading of the library and replacement of stub functions upon their first call. While this seemed convenient I didn't like that the stub versions of the functions could be passed around as objects without the user knowing that it was not the "real" version being used. And while it would have no functional impact, those versions would keep replacing their var root every time they were called which felt very icky. Instead there is now an additional function generated besides the mapped C functions which is called loadlib-libname (libname is the name of the C lib) which must be called (at runtime) before any of the library functions. The library functions still have stubs so that it's possible to link other clojure functions against them at compile time but the stubs now throw an exception telling the user to run the loadlib function first. -- 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: Recommendation for Clojure Indentation tool
I really hate emacs. And the solution in http://www.google.com/url?sa=D&q=http://groups.google.com/group/clojure/browse_thread/thread/6a16bb89340f46d8/fb03dffa410e919a%3Flnk%3Dgst%26q%3Dharrop%2Bindent%23fb03dffa410e919a&usg=AFQjCNFAyiZOBGMdhoXnFe1UaFrJQTgGUg doesn't work Any other way to format lisp/clojure ? On Dec 23 2009, 7:22 pm, Stefan Kamphausen wrote: > Hi, > > On Dec 22, 11:48 am, Gabi wrote: > > > I need a simple command-line tool to indent Clojure source files. > > Any recommendation ? > > there was a post to a ruby script for some OSX editor which provided > the Clojure indentation by calling emacs in batch-mode. Unfortunately > I can't find it anymore. Sorry. Anyone else remember? > > Regards, > Stefan -- 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: Recommendation for Clojure Indentation tool
Have you tried what I wrote in my above post ? 2010/1/9 Gabi : > I really hate emacs. And the solution in > http://www.google.com/url?sa=D&q=http://groups.google.com/group/clojure/browse_thread/thread/6a16bb89340f46d8/fb03dffa410e919a%3Flnk%3Dgst%26q%3Dharrop%2Bindent%23fb03dffa410e919a&usg=AFQjCNFAyiZOBGMdhoXnFe1UaFrJQTgGUg > doesn't work > > Any other way to format lisp/clojure ? > > On Dec 23 2009, 7:22 pm, Stefan Kamphausen > wrote: >> Hi, >> >> On Dec 22, 11:48 am, Gabi wrote: >> >> > I need a simple command-line tool to indent Clojure source files. >> > Any recommendation ? >> >> there was a post to a ruby script for some OSX editor which provided >> the Clojure indentation by calling emacs in batch-mode. Unfortunately >> I can't find it anymore. Sorry. Anyone else remember? >> >> Regards, >> Stefan > > -- > 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: Recommendation for Clojure Indentation tool
On Tue, Dec 22, 2009 at 4:18 PM, Gabi wrote: > I need a simple command-line tool to indent Clojure source files. > Any recommendation ? If all else fails, vim has a batch mode. $ echo "=G:wq" >> indent-script $ vim -s indent-script right now it asks me to hit enter when it's done indenting; not sure how to work around that but it's a start. martin -- 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: SLIME/Swank problem with swank.util.sys/get-pid and RuntimeMXBean
On Fri, Jan 8, 2010 at 12:57 PM, Richard Newman wrote: >> I don't want to have to use ELPA, or maven, or some other configuration >> management thing to get basic tools like an editing environment for the >> language up and running. Perhaps I should just bite the bullet and use the >> crazy configuration/package management things that the clojure community >> seems so enamored of (ELPA, maven, leiningen, etc...), but in the way I'm >> used to doing things, nothing more than the source code and a fairly simple >> system definition tool (like ASDF) are enough to get things done. It's not >> too say that there's room for improvement, but I like it when simple tools >> get the job done and I don't need to rely on a bunch of shell scripts, to >> have to modify classpaths, restart JVMs, etc... to get the code I want >> loaded. Perhaps I'm just ignorant of the proper clojure-y way to do things, >> so I'll hop off my soapbox now. > > I think I'm pretty familiar with the Clojure-y way to do things, and I also > close the tab when I see "... using Maven". I am alien to the Java world and haven't still embrased ELPA, lein and other tools. Here is my setup which works fine for me: o. slime git://git.boinkor.net/slime.git o. swank-clojure git://github.com/jochu/swank-clojure.git o. clojure-mode git://github.com/jochu/clojure-mode.git It has worked quite nicely for me until now. I also discovered the other branch of swank-clojure, which seem to be what people are using more. I see that it does things like downloading jars etc etc. I would rather like it to leave them for other tools to do. I have no problem installing emacs scripts by hand. If so, I wouldn't be using it anyway, so I just don't see why ELPA and the other swank-clojure branch is trying to do things that other tools are supposed to do. -- Ramakrishnan -- 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: generating a fn with a body based on user inputs, possible?
Hi, On Jan 8, 3:10 pm, tristan wrote: > I've been working on a problem where I want the user to be able to > input an equation in infix notation which includes variables and > convert that to a clojure fn that my program can call later. You need to construct the form of the function explicitely and call eval on that. (Why is already explained by Laurent) (defn create-user-function [inputs body] (eval `(fn ~inputs ~...@body))) (apply create-user-function (parse input)) Random notes: 1. You may want to use vectors w/ conj and peek instead of lists w/ reverse and first. 2. Please don't write macros with "(list 'foo (vec bar) baz)". Always use syntax-quote aka ` 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
clarsec
Name: clarsec Url: http://github.com/mmikulicic/clarsec Author: Marko Mikulicic Category: parsing License: Apache License 2.0 Simple monadic parser trying to mimic Parsec and be usable. Not really complete. Uses Meikel Brandmeyer monad library. -- 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: Having difficulties with compilation in slime, emacs and clojure-project
Zef, Can you compile files? My environment works fine by setting all necessary clojure.jar, clojure-contrib.jar, swank-clojure.jar, ~/clj (my own project directory) in swank-clojure-classpath. However, I have difficulty to generate classes from the *.clj. E.g. I have a find.clj in ~/clj/src/futils/. By running (compile 'futils.find), I got the following error. I think the swank at least already finds the find.clj to compile because it shows the different error below if I try to compile a non-existing file (compile 'futils.fake). Except compiling, I can call functions in futils.find from slime-repl without any issue. Could someone shed me some light on this? p.s. clojure.jar(1.1), clojure-contrib.jar(1.1), swank-clojure.jar (1.0). I pull all of them from github and compiled them. Emacs elpha: clojure-mode(1.6) swank-clojure(1.1.0) slime (2009-10-16) slime-repl(2009-10-16) Thanks, James The file I want to compile :(compile 'futils.find) No such file or directory [Thrown class java.io.IOException] Restarts: 0: [ABORT] Return to SLIME's top level. Backtrace: 0: java.io.UnixFileSystem.createFileExclusively(Native Method) 1: java.io.File.createNewFile(File.java:883) 2: clojure.lang.Compiler.writeClassFile(Compiler.java:5000) 3: clojure.core$gen_class__7189.doInvoke(genclass.clj:594) 4: clojure.lang.RestFn.invoke(RestFn.java:498) 5: clojure.lang.Var.invoke(Var.java:379) 6: clojure.lang.AFn.applyToHelper(AFn.java:197) 7: clojure.lang.Var.applyTo(Var.java:476) 8: clojure.lang.Compiler.macroexpand1(Compiler.java:4504) The file doesn't exist (compile 'futils.fake) Could not locate futils/fake__init.class or futils/fake.clj on classpath: [Thrown class java.io.FileNotFoundException] On Jan 8, 6:19 am, Zef Hemel wrote: > Thanks, indeed, swank-clojurewas not on my classpath, I added it as a > dependency to my project.clj and now it works fine. > > On Jan 8, 2:25 pm, Shawn Hoover wrote: > > > On Fri, Jan 8, 2010 at 4:39 AM, Zef Hemel wrote: > > > After I do the swankclojureproject command, enter the directory and > > > press return myEmacsgets stuck doing this:http://imgur.com/Ap8mo > > > When I just go to the Slime CLI that works fine. Any idea what could > > > be wrong there? > > > > Zef > > > Check your inferior-lisp buffer. There may be some errors in there > > indicatingclojure.main or swank.swank is missing. > > > swank-clojure-project won't work unless all dependencies live in appropriate > > places under the project directory. Here's how I hackedClojureBox startup > > to not wipe out the entire classpath and build it from > > scratch:http://bitbucket.org/shoover/clojure-box/src/8015172a1dc3/default.el#... > > > Shawn -- 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: How do I extend an existing function to take different number of params?
Hi, Am 09.01.2010 um 09:59 schrieb Dmitry Kakurin: > Suppose I already have a function f that accepts 0 and 1 param: > (defn f > ([] 0) > ([ _ ] 1)) > > How do I extend it with additional version that takes 2 params? > Something like the following that does not override the original: > > (defn f [ _ _ ] 2) > > and makes all 3 work: > (f) > (f 1) > (f 1 2) This is not possible. You have to add the definition to the original one. Or – if you can't influence the original function definition – substitute your own: (def orig-f foo/f) (defn my-f ([] (orig-f)) ([x] (orig-f x)) ([_ _] 2)) (binding [foo/f my-f] (foo/f :a :b)) I suspect that you want to use that for a dirty hack. Why do you need that? Do you have some example code which demonstrates the problem? 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
Using/configuring c.c.logging
Hello all, I want to use the c.c.logging for all my logging purposes but I have a few queries about `configuring' the logging system. Ideally I would like to log to a file which is rotated regularly. It'd be best if I can put this configuration in one place and change the output to stdout on a case by case basis (using the repl). Unfortunately I am not familiar with Java logging facilities and would appreciate some help with this. Regards, BG -- Baishampayan Ghose oCricket.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
Re: Strange problem when adding type to a var defined by a macro.
> The macro works fine. The problem is that the REPL tries to print the > result (which is the var you created) and the print multimethod does > not know what to do with your custom type, and the default method > throws an exception. That was it, thanks a lot. - budu -- 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: Brainstorming new sequence functions
On Jan 3, 9:22 pm, Timothy Pratley wrote: > 2010/1/4 Tom Hicks : > > > All the other code is there to parallel the functionality in 'subvec'. > > Ah right, I see what you mean. > Calling count in the two argument form will realize the entire > sequence unnecessarily. Take and drop are already lazy so no need to > call lazy-seq... so if you wanted to explicitly return nil for invalid > indices you could still simplify to: > (defn indexed-subseq > ([coll start] > (when (not (neg? start)) > (drop start coll))) > ([coll start end] > (when (and (not (neg? start)) (<= start end)) > (take (- end start) (drop start coll) > ; (indexed-subseq [0 1 2 3 4] 1 3) > ; = (1 2) > ; (indexed-subseq [0 1 2 3 4] -5 3) > ; = nil > ; (indexed-subseq [0 1 2 3 4] 4 3) > ; = nil > ; (indexed-subseq [0 1 2 3 4] 2) > ; = (2 3 4) > > Regards, > Tim. Very cool, thank-youthis is exactly the kind of feedback that's valuable as I learn to "think in Clojure". For a second I wondered why your version didn't need the seq call to insure that the argument was a sequence but then realized that, since we were calling only drop and take, they will handle it. I've updated the gist to reflect the latest version. Thanks again for your help. regards, -tom -- 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: Recommendation for Clojure Indentation tool
Weird, it used to work for me when I tested it. And it appears it also worked for some people on the thread ... 2010/1/9 Gabi : > Yes. Didn't work. Even after fixing a bug in it (complained about > Character/isWhitespace ) it produced garbage > > On Jan 9, 3:00 pm, Laurent PETIT wrote: >> Have you tried what I wrote in my above post ? >> >> 2010/1/9 Gabi : >> >> > I really hate emacs. And the solution in >> >http://www.google.com/url?sa=D&q=http://groups.google.com/group/cloju... >> > doesn't work >> >> > Any other way to format lisp/clojure ? >> >> > On Dec 23 2009, 7:22 pm, Stefan Kamphausen >> > wrote: >> >> Hi, >> >> >> On Dec 22, 11:48 am, Gabi wrote: >> >> >> > I need a simple command-line tool to indent Clojure source files. >> >> > Any recommendation ? >> >> >> there was a post to a ruby script for some OSX editor which provided >> >> the Clojure indentation by calling emacs in batch-mode. Unfortunately >> >> I can't find it anymore. Sorry. Anyone else remember? >> >> >> Regards, >> >> Stefan >> >> > -- >> > You received this message because you are subscribed to the Google >> > Groups "Clojure" group. >> > To post to this group, send email to clojure@googlegroups.com >> > Note that posts from new members are moderated - please be patient with >> > your first post. >> > To unsubscribe from this group, send email to >> > clojure+unsubscr...@googlegroups.com >> > For more options, visit this group at >> >http://groups.google.com/group/clojure?hl=en > > -- > You received this message because you are subscribed to the Google > Groups "Clojure" group. > To post to this group, send email to clojure@googlegroups.com > Note that posts from new members are moderated - please be patient with your > first post. > To unsubscribe from this group, send email to > clojure+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/clojure?hl=en > -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
slicing multidimensional vectors (vectors of vectors of vectors ...)
Hi all. I'm working on implementing a solution for extracting slices of multidimensional vectors, in the sense of vectors of vectors. I'm taking the recursive route. I'm almost there, just have to work out a few things. But I was wondering, this being a rather straightforward need, perhaps it's already been done by someone, or maybe it's even in the colujure.contrib libraries somewhere, so I thought I'd come here and ask to see if anybody knows something I don't! I wouldn't want to reinvent the wheel so to speak :) Anyway, I'm trying to follow the MATLAB path. For instance, suppose this is a 5x5 matrix: (def a [[2 3 5 7 11] [13 17 19 23 29] [31 37 41 43 47] [53 59 61 67 71] [73 79 83 89 97]]) This: (submvec a [[0 2 4] [0 2 4]]) would yield: [[2 5 11] [13 19 29] [31 41 47] [53 61 71] [73 83 97]] (actually a sequence) In other words, [0 2 4] is to be interpreted as [START STRIDE END]. STRIDE should be optional. What do you think? And, above all, has it already been done (or something similar)? Thank you. Rock -- 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: Recommendation for Clojure Indentation tool
Yes. Didn't work. Even after fixing a bug in it (complained about Character/isWhitespace ) it produced garbage On Jan 9, 3:00 pm, Laurent PETIT wrote: > Have you tried what I wrote in my above post ? > > 2010/1/9 Gabi : > > > I really hate emacs. And the solution in > >http://www.google.com/url?sa=D&q=http://groups.google.com/group/cloju... > > doesn't work > > > Any other way to format lisp/clojure ? > > > On Dec 23 2009, 7:22 pm, Stefan Kamphausen > > wrote: > >> Hi, > > >> On Dec 22, 11:48 am, Gabi wrote: > > >> > I need a simple command-line tool to indent Clojure source files. > >> > Any recommendation ? > > >> there was a post to a ruby script for some OSX editor which provided > >> the Clojure indentation by calling emacs in batch-mode. Unfortunately > >> I can't find it anymore. Sorry. Anyone else remember? > > >> Regards, > >> Stefan > > > -- > > 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: Recommendation for Clojure Indentation tool
Just found an easy and stupid way. Using Kate editor: 1, Tools->indentation->Lisp 2. Select the whole text and do Tools ->Align On Jan 9, 10:17 pm, Gabi wrote: > Yes. Didn't work. Even after fixing a bug in it (complained about > Character/isWhitespace ) it produced garbage > > On Jan 9, 3:00 pm, Laurent PETIT wrote: > > > Have you tried what I wrote in my above post ? > > > 2010/1/9 Gabi : > > > > I really hate emacs. And the solution in > > >http://www.google.com/url?sa=D&q=http://groups.google.com/group/cloju... > > > doesn't work > > > > Any other way to format lisp/clojure ? > > > > On Dec 23 2009, 7:22 pm, Stefan Kamphausen > > > wrote: > > >> Hi, > > > >> On Dec 22, 11:48 am, Gabi wrote: > > > >> > I need a simple command-line tool to indent Clojure source files. > > >> > Any recommendation ? > > > >> there was a post to a ruby script for some OSX editor which provided > > >> the Clojure indentation by calling emacs in batch-mode. Unfortunately > > >> I can't find it anymore. Sorry. Anyone else remember? > > > >> Regards, > > >> Stefan > > > > -- > > > 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: SLIME/Swank problem with swank.util.sys/get-pid and RuntimeMXBean
I've reverted to the setup that you listed, Ramakrishnan. I spent quite a few hours trying to figure out how to use ELPA + the forked slime + the new swank clojure, but failed miserably (despite the kind assistance of Phil and others on another thread). I would agree that it would be nice to have the option of installing packages oneself, since if an automatic package management system is relied on, and it fails, it can be very difficult to figure out how to fix things. On Jan 8, 1:03 am, Ramakrishnan Muthukrishnan wrote: > On Fri, Jan 8, 2010 at 12:57 PM, Richard Newman wrote: > >> I don't want to have to use ELPA, or maven, or some other configuration > >> management thing to get basic tools like an editing environment for the > >> language up and running. Perhaps I should just bite the bullet and use the > >> crazy configuration/package management things that the clojure community > >> seems so enamored of (ELPA, maven, leiningen, etc...), but in the way I'm > >> used to doing things, nothing more than the source code and a fairly simple > >> system definition tool (like ASDF) are enough to get things done. It's not > >> too say that there's room for improvement, but I like it when simple tools > >> get the job done and I don't need to rely on a bunch of shell scripts, to > >> have to modify classpaths, restart JVMs, etc... to get the code I want > >> loaded. Perhaps I'm just ignorant of the proper clojure-y way to do things, > >> so I'll hop off my soapbox now. > > > I think I'm pretty familiar with the Clojure-y way to do things, and I also > > close the tab when I see "... using Maven". > > I am alien to the Java world and haven't still embrased ELPA, lein and > other tools. Here is my setup which works fine for me: > > o. slime > git://git.boinkor.net/slime.git > > o. swank-clojure > git://github.com/jochu/swank-clojure.git > > o. clojure-mode > git://github.com/jochu/clojure-mode.git > > It has worked quite nicely for me until now. I also discovered the > other branch of swank-clojure, which seem to be what people are using > more. I see that it does things like downloading jars etc etc. I would > rather like it to leave them for other tools to do. I have no problem > installing emacs scripts by hand. If so, I wouldn't be using it > anyway, so I just don't see why ELPA and the other swank-clojure > branch is trying to do things that other tools are supposed to do. > > -- > Ramakrishnan -- 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: Recommendation for Clojure Indentation tool
Maybe you can post here an example code of how you used it ? Maybe I missed something? On Jan 9, 10:38 pm, Laurent PETIT wrote: > Weird, it used to work for me when I tested it. And it appears it also > worked for some people on the thread ... > > 2010/1/9 Gabi : > > > Yes. Didn't work. Even after fixing a bug in it (complained about > > Character/isWhitespace ) it produced garbage > > > On Jan 9, 3:00 pm, Laurent PETIT wrote: > >> Have you tried what I wrote in my above post ? > > >> 2010/1/9 Gabi : > > >> > I really hate emacs. And the solution in > >> >http://www.google.com/url?sa=D&q=http://groups.google.com/group/cloju... > >> > doesn't work > > >> > Any other way to format lisp/clojure ? > > >> > On Dec 23 2009, 7:22 pm, Stefan Kamphausen > >> > wrote: > >> >> Hi, > > >> >> On Dec 22, 11:48 am, Gabi wrote: > > >> >> > I need a simple command-line tool to indent Clojure source files. > >> >> > Any recommendation ? > > >> >> there was a post to a ruby script for some OSX editor which provided > >> >> the Clojure indentation by calling emacs in batch-mode. Unfortunately > >> >> I can't find it anymore. Sorry. Anyone else remember? > > >> >> Regards, > >> >> Stefan > > >> > -- > >> > You received this message because you are subscribed to the Google > >> > Groups "Clojure" group. > >> > To post to this group, send email to clojure@googlegroups.com > >> > Note that posts from new members are moderated - please be patient with > >> > your first post. > >> > To unsubscribe from this group, send email to > >> > clojure+unsubscr...@googlegroups.com > >> > For more options, visit this group at > >> >http://groups.google.com/group/clojure?hl=en > > > -- > > You received this message because you are subscribed to the Google > > Groups "Clojure" group. > > To post to this group, send email to clojure@googlegroups.com > > Note that posts from new members are moderated - please be patient with > > your first post. > > To unsubscribe from this group, send email to > > clojure+unsubscr...@googlegroups.com > > For more options, visit this group at > >http://groups.google.com/group/clojure?hl=en -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to clojure+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/clojure?hl=en
Re: Having difficulties with compilation in slime, emacs and clojure-project
Shawn Hoover writes: > In updating Clojure Box to the latest I found that the defadvice form > has to be loaded before slime is loaded. (I didn't know about > ad-activate.) This would be a problem if you somehow require slime > before the ELPA's package-initialize is called, which loads the > swank-clojure autoloads, which includes the defadvice. Yeah, you should ideally remove all manual configuration of slime, but failing that I guess it would need to be moved till after package.el is initialized. I'll make a note in the readme. -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: SLIME/Swank problem with swank.util.sys/get-pid and RuntimeMXBean
"Steven E. Harris" writes: > Phil Hagelberg writes: > >> If someone would volunteer to fix it, I'd be thrilled. Nobody who is >> interested in using CL and Clojure at the same time has stepped >> forward so far, which is why it's currently broken. > > Can you characterize what needs to be fixed? There was some discussion about it a couple months ago: http://groups.google.com/group/clojure/browse_thread/thread/3e5f416e3f2a1884 Unfortunately I don't have the resources to pursue it myself. -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: Recommendation for Clojure Indentation tool
Gabi wrote: I really hate emacs. ... Any other way to format lisp/clojure ? http://www.vim.org/scripts/script.php?script_id=2501 -- 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: SLIME/Swank problem with swank.util.sys/get-pid and RuntimeMXBean
Phil Hagelberg writes: > There was some discussion about it a couple months ago: I picked up the torch today, in hope that others will try again for a better resolution: http://thread.gmane.org/gmane.lisp.slime.devel/9178/focus=9383 -- Steven E. Harris -- 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: Strange problem when adding type to a var defined by a macro.
2010/1/10 Nicolas Buduroi : > That was it, thanks a lot. Ah great. My understanding is that type meta data should go on the object not the var, but that integers for example do not support meta data as they are java objects. Only things like vectors and hash maps do. So you can not set an integer 'type' unless you put it in a IObj container. It is possible to make the :default print-method only attempt to vary-meta if o is indeed an IObj: (defmethod print-method :default [o, #^java.io.Writer w] (if (instance? clojure.lang.IObj o) (print-method (vary-meta o #(dissoc % :type)) w) (.write w (str o user=> (defbar fuz 1) #'user/fuz But I doubt this is really what you are aiming for user=> (type fuz) java.lang.Integer user=> (type (var fuz)) :user/MyType I think you would want (type fuz) to be :user/MyType, which I do not think is possible with integers user=> (type (vary-meta [1 2 3] assoc :type :user/MyType)) :user/MyType user=> (type (vary-meta 1 assoc :type :user/MyType)) java.lang.ClassCastException: java.lang.Integer cannot be cast to clojure.lang.IObj (NO_SOURCE_FILE:0) So I think the source of the exception is clear, but have you found a solution to your original problem? Maybe if you expand on that someone can describe a good technique. Regards, Tim. -- 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
Has anyone got the Enclojure NetBeans plugin working with clojure 1.1?
I've tried to add a new platform, but the repl fails to start. Then I tried to build the latest version of Enclojure using clojure 1.1, but couldn't get that working either. Has anyone else been able to get it working with clojure 1.1? -- 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: reader and "s
Try escaping it: (println "\"foo\"") On Jan 8, 4:34 pm, Raoul Duke wrote: > hi, > > i'm using (read) and it seems to get rid of double quotes e.g. > > (println "foo") > > is read as > > (println foo) > > as far as i can tell so far. how do i get the quotes to come through? > or don't i want to? > > 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 at http://groups.google.com/group/clojure?hl=en
Re: SLIME/Swank problem with swank.util.sys/get-pid and RuntimeMXBean
"Steven E. Harris" writes: >> There was some discussion about it a couple months ago: > > I picked up the torch today, in hope that others will try again for a > better resolution: > > http://thread.gmane.org/gmane.lisp.slime.devel/9178/focus=9383 Thanks for digging. I'll keep this around to show to anyone else in the future who might be inclined to go further with it. -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: How do I extend an existing function to take different number of params?
Actually this is possible. (see http://xkcd.com/386/) See the macro add-arity which I've put up here: http://gist.github.com/273349 This allows you to do things like: user> (add-arity keyword [ns name suffix] (keyword ns (str name "-" suffix))) # user> (keyword nil "hello" "more") :hello-more The code I put up will handle (I think) all sorts of variations of arg counts: you can use add-arity just like defn and it will grab any specified arglists (including arglists with &) and proxy the others back to the original function. It doesn't do anything with metadata, though. Also, you can override a given arity on the original function, but you can't then call the original version at that arity. Whether this is a good idea or not is a completely different question :-) Tom -- 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