How do I extend an existing function to take different number of params?

2010-01-09 Thread 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) - Dmitry --

Re: Probability Monad

2010-01-09 Thread joel r
On Fri, Jan 8, 2010 at 2:57 PM, Konrad Hinsen konrad.hin...@fastmail.net 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

Re: Strange problem when adding type to a var defined by a macro.

2010-01-09 Thread Timothy Pratley
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:

Re: C interop lib (JNA wrapper)

2010-01-09 Thread mac
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

Re: Recommendation for Clojure Indentation tool

2010-01-09 Thread Gabi
I really hate emacs. And the solution in http://www.google.com/url?sa=Dq=http://groups.google.com/group/clojure/browse_thread/thread/6a16bb89340f46d8/fb03dffa410e919a%3Flnk%3Dgst%26q%3Dharrop%2Bindent%23fb03dffa410e919ausg=AFQjCNFAyiZOBGMdhoXnFe1UaFrJQTgGUg doesn't work Any other way to format

Re: Recommendation for Clojure Indentation tool

2010-01-09 Thread Laurent PETIT
Have you tried what I wrote in my above post ? 2010/1/9 Gabi bugspy...@gmail.com: I really hate emacs. And the solution in

Re: Recommendation for Clojure Indentation tool

2010-01-09 Thread Martin DeMello
On Tue, Dec 22, 2009 at 4:18 PM, Gabi bugspy...@gmail.com 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 file-to-indent right now it asks me to hit enter

Re: SLIME/Swank problem with swank.util.sys/get-pid and RuntimeMXBean

2010-01-09 Thread Ramakrishnan Muthukrishnan
On Fri, Jan 8, 2010 at 12:57 PM, Richard Newman holyg...@gmail.com 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

Re: generating a fn with a body based on user inputs, possible?

2010-01-09 Thread Meikel Brandmeyer
Hi, On Jan 8, 3:10 pm, tristan tristan.k...@gmail.com 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

clarsec

2010-01-09 Thread mmikulicic
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

Re: Having difficulties with compilation in slime, emacs and clojure-project

2010-01-09 Thread James
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

Re: How do I extend an existing function to take different number of params?

2010-01-09 Thread Meikel Brandmeyer
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 [ _

Using/configuring c.c.logging

2010-01-09 Thread Baishampayan Ghose
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

Re: Strange problem when adding type to a var defined by a macro.

2010-01-09 Thread Nicolas Buduroi
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

Re: Brainstorming new sequence functions

2010-01-09 Thread Tom Hicks
On Jan 3, 9:22 pm, Timothy Pratley timothyprat...@gmail.com wrote: 2010/1/4 Tom Hicks hickstoh...@gmail.com: 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

Re: Recommendation for Clojure Indentation tool

2010-01-09 Thread Laurent PETIT
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 bugspy...@gmail.com: 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

slicing multidimensional vectors (vectors of vectors of vectors ...)

2010-01-09 Thread Rock
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

Re: Recommendation for Clojure Indentation tool

2010-01-09 Thread 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 laurent.pe...@gmail.com wrote: Have you tried what I wrote in my above post ? 2010/1/9 Gabi bugspy...@gmail.com: I really hate emacs. And the

Re: Recommendation for Clojure Indentation tool

2010-01-09 Thread Gabi
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 bugspy...@gmail.com wrote: Yes. Didn't work. Even after fixing a bug in it (complained about Character/isWhitespace ) it produced garbage On

Re: SLIME/Swank problem with swank.util.sys/get-pid and RuntimeMXBean

2010-01-09 Thread Rob Lachlan
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

Re: Recommendation for Clojure Indentation tool

2010-01-09 Thread Gabi
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 laurent.pe...@gmail.com 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

Re: Having difficulties with compilation in slime, emacs and clojure-project

2010-01-09 Thread Phil Hagelberg
Shawn Hoover shawn.hoo...@gmail.com 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,

Re: SLIME/Swank problem with swank.util.sys/get-pid and RuntimeMXBean

2010-01-09 Thread Phil Hagelberg
Steven E. Harris s...@panix.com writes: Phil Hagelberg p...@hagelb.org 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

Re: Recommendation for Clojure Indentation tool

2010-01-09 Thread Jeff Schwab
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

Re: SLIME/Swank problem with swank.util.sys/get-pid and RuntimeMXBean

2010-01-09 Thread Steven E. Harris
Phil Hagelberg p...@hagelb.org 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

Re: Strange problem when adding type to a var defined by a macro.

2010-01-09 Thread Timothy Pratley
2010/1/10 Nicolas Buduroi nbudu...@gmail.com: 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

Has anyone got the Enclojure NetBeans plugin working with clojure 1.1?

2010-01-09 Thread nwalex
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

Re: reader and s

2010-01-09 Thread Kasim
Try escaping it: (println \foo\) On Jan 8, 4:34 pm, Raoul Duke rao...@gmail.com 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

Re: SLIME/Swank problem with swank.util.sys/get-pid and RuntimeMXBean

2010-01-09 Thread Phil Hagelberg
Steven E. Harris s...@panix.com 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

Re: How do I extend an existing function to take different number of params?

2010-01-09 Thread Tom Faulhaber
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$eval__6304$fn__6309