Re: Getting Started in Mac OS X Snow Leopard

2009-12-04 Thread Steve Purcell
On 4 Dec 2009, at 09:41, Lauri Pesonen wrote: How do you type ''#' in the Cocoa build of Emacs 23 (I'm on a UK keyboard and in OS X apps I type option-3 to get'#')? Aquamacs has a mode where option-3 is interpreted as '#' rather than a meta-3 which takes care of my problem, but I haven't

Re: Clojure development environments

2009-12-04 Thread Steve Purcell
On 4 Dec 2009, at 10:18, balln...@googlemail.com wrote: Emacs / clojure-mode: [...] Sorry but Emacs is unfamiliar to regular developers VimClojure: similar to clojure-mode setup ... separate downloads, builds, configs ... and then it does not work out of the box or you need to read

Re: Getting Started in Mac OS X Snow Leopard

2009-12-07 Thread Steve Purcell
On 7 Dec 2009, at 11:15, Lauri Pesonen wrote: 2009/12/4 Steve Purcell st...@sanityinc.com: Here's what I do (in Cocoa Emacs 23) to make 'option' work the same in Emacs as in other OS X apps: (setq mac-command-modifier 'meta) (setq mac-option-modifier 'none) (setq default-input-method

Re: Help recreating OS X Leiningen 1.0 +Swank bug

2009-12-17 Thread Steve Purcell
I came across this problem too, and David's patch helps, to a certain extent. Additionally, without David's patch, the src and test directories of the current project don't get added to the classpath one sees from inside swank. (All the jars upon which leiningen depends *are* in the classpath,

Re: list of open source clojure projects to contribute?

2009-12-23 Thread Steve Purcell
Here's a good start: http://www.google.com/search?hl=enq=site:github.com+clojure But the best plan is to start using clojure for real work, then contribute to the open source tools you find yourself using. -Steve On 23 Dec 2009, at 02:27, Kasim wrote: I am just thinking if anyone can list

Re: Clojure + Redis

2009-12-31 Thread Steve Purcell
Not sure if it's any help, but here's a variant of memoize I wrote, which stores arbitrary readable/printable objects to redis: http://gist.github.com/266689 (If there's any interest, I'll wrap it up in a github project and push it to clojars.) Redis isn't a hierarchical store, so its

Re: Clojure/SLIME/Emacs questions

2009-12-31 Thread Steve Purcell
Well, it clearly works for Lau, but then he says in one of the screencasts that he's using an old version of Slime; if you install technomancy's slime package from ELPA, I believe you don't get all the slime extensions, which would easily explain why the fuzzy completion doesn't work. I'm using

Re: Clojure/SLIME/Emacs questions

2009-12-31 Thread Steve Purcell
Indeed -- that works nicely. I tried going back to a completely non-ELPA-ized setup, but it was too painful; the trick was installing technomancy's github repo of slime *in addition* to the ELPA packages, which all depend on each other. -Steve On 31 Dec 2009, at 16:44, william douglas

Re: Clojure + Redis

2010-01-01 Thread Steve Purcell
interest. What if I stored a shared data structure in redis (only because its the fastest), using your memoize variant, and process (maybe even updated it) it in parallel from different Clojure nodes. Some kind of primitive map/reduce mechanism I think. On Dec 31, 12:29 pm, Steve Purcell st

Re: Clojure + Redis

2010-01-04 Thread Steve Purcell
Read the code I posted in this thread and put up on github after you expressed interest. That's part of what it does, using the reader/printer representation. Alternatives would include standard Java binary serialisation or 3rd party libraries (Hessian/Burlap?). -Steve On 4 Jan 2010, at

Re: Clojure + Redis

2010-01-05 Thread Steve Purcell
Indeed, thanks - I realized that earlier today myself! -Steve On 5 Jan 2010, at 09:24, Gabi wrote: I think you should do (binding [*print-dup* true] (pr-str value).. instead of just (pr-str value) in the encode-value function. (line 20 in redis_memo.clj) On Jan 4, 2:55 pm, Steve Purcell

Re: Clojure + Redis

2010-01-05 Thread Steve Purcell
wrote: I think you should do (binding [*print-dup* true] (pr-str value).. instead of just (pr-str value) in the encode-value function. (line 20 in redis_memo.clj) On Jan 4, 2:55 pm, Steve Purcell st...@sanityinc.com wrote: Read the code I posted in this thread and put up on github after you

Re: Clojure on Ideone!

2010-01-18 Thread Steve Purcell
For those who didn't click through, this is a really nifty code paste site that will actually run your pasted code and display the output next to the paste. Worth a look; it's a nice piece of work. -Steve On 15 Jan 2010, at 21:23, sphere research wrote: Hi, test Clojure on ideone.com

Re: Dependency management

2010-01-23 Thread Steve Purcell
I believe some people use HttpUnit for this purpose. It's a very full-featured HTTP client. YMMV. On 23 Jan 2010, at 01:25, Richard Newman wrote: And as for Apache HttpComponents, it sounds like they don't grok the notion that breaking backwards compatibility should only occur with a

Re: How can I parse this with clojure.contrib.zip-filter.xml ?

2010-01-23 Thread Steve Purcell
On 23 Jan 2010, at 02:53, James Reeves wrote: On Jan 23, 2:29 am, David Cabana drcab...@gmail.com wrote: What I'd like to get from 'tickets' is something like ( [Alice [foo]] [Bob [bar baz]]), that is, output that ties incidents to customers. So far it has eluded me. xml- just returns a

Re: Help needed regarding the use of macro

2010-01-25 Thread Steve Purcell
I think you'll have to use exception# instead of exception, in order to generate a local symbol. Otherwise, the quoting will try to resolve exception in the current namespace. Also, don't expand ~url more than once -- what if the expression passed for url has side effects? It would get

Re: Please share your thoughts on dependency injection

2010-02-09 Thread Steve Purcell
On 8 Feb 2010, at 16:53, Boris Mizhen - 迷阵 wrote: Hello all, I am playing with the idea of a little library for dependency injection. The idea is to declare injectable values as metadata-to-function map. I started with a sketch of what the client code may look like. Please let me know

Re: clojure-dev: #55: clojure.contrib.sql expects *err* to be a PrintWriter Ticket updated - Resolution?

2010-02-13 Thread Steve Purcell
On 13 Feb 2010, at 19:03, Richard Newman wrote: The above thread suggests defining *err* as a PrintWriter instead of as a Writer. Has this been patched, and is it official? If so, I'll patch clojure-swank to use PrintWriter. If not, I'll patch clojure.contrib.sql to not use println. I

Re: clojure-dev: #55: clojure.contrib.sql expects *err* to be a PrintWriter Ticket updated - Resolution?

2010-02-14 Thread Steve Purcell
On 13 Feb 2010, at 23:22, Phil Hagelberg wrote: Even without CL experience, just gathering up the various patches into one branch and seeing what works and what doesn't would be very helpful too. I'll bite: http://github.com/purcell/swank-clojure In my master branch (freshly forked from

Re: clojure-dev: #55: clojure.contrib.sql expects *err* to be a PrintWriter Ticket updated - Resolution?

2010-02-14 Thread Steve Purcell
On 14 Feb 2010, at 09:34, Steve Purcell wrote: In my master branch (freshly forked from Phil's repo) I've applied Richard's patch, plus the following recent branches from the swank-clojure network on github (http://github.com/technomancy/swank-clojure/network): I should add that I skipped

Re: Permutations of n things

2010-02-14 Thread Steve Purcell
On 14 Feb 2010, at 13:20, ka wrote: I'm trying to make a function which gives the n! permutations of a vector of n things. Here is my first attempt : (defn permute Gives the n! permuations of the input vector of things [v] (if (= 1 (count v)) (list [(v 0)]) (loop [i 0 perm '()]

Re: processing two collections

2010-02-15 Thread Steve Purcell
On 15 Feb 2010, at 13:50, Glen Rubin wrote: Thank you so much This is really wonderful advice...saved me months of learning. I have rewritten my code as follows: You'll want to use let in place of all of those def declarations. -Steve -- You received this message because you are

Re: processing two collections

2010-02-15 Thread Steve Purcell
On 15 Feb 2010, at 13:58, Steve Purcell wrote: On 15 Feb 2010, at 13:50, Glen Rubin wrote: Thank you so much This is really wonderful advice...saved me months of learning. I have rewritten my code as follows: You'll want to use let in place of all of those def declarations. e.g

Re: Reflection Warning Output in SLIME

2010-03-01 Thread Steve Purcell
On 1 Mar 2010, at 12:26, Volkan YAZICI wrote: When I compile an expression via C-c C-c in SLIME -- assuming *warn-on- reflection* is turned on -- reflection related warnings don't appear neither in the REPL, nor in the inferior lisp buffer. Everytime, I have to paste the code the REPL

Re: Two potential map-util functions

2010-03-09 Thread Steve Purcell
On 8 Mar 2010, at 13:59, Luka wrote: Other thing I would like to ask is how can I see what is different in 40 github clones of clojure.contrib without clicking on every clone? Either: 1. Use the github network browser: http://github.com/richhickey/clojure-contrib/network (use

Re: bounded memoize

2010-03-10 Thread Steve Purcell
On 9 Mar 2010, at 23:22, Michał Marczyk wrote: In the way of early feedback -- that's looks super neat! I've got this instant feeling that this would be a great clojure.contrib.memoize. +1 That would be wonderful. -- You received this message because you are subscribed to the Google Groups

Re: indexing only some elements of a sequence...

2010-03-20 Thread Steve Purcell
Which looks the same as clojure.contrib.seq/reductions to me... -Steve On 20 Mar 2010, at 13:54, Per Vognsen wrote: Learn to love scan: http://gist.github.com/338682 -Per On Sat, Mar 20, 2010 at 12:13 PM, Douglas Philips d...@mac.com wrote: Hello all, I'm new to clojure, but not

Re: Haskell-style list functions

2010-04-11 Thread Steve Purcell
On 10 Apr 2010, at 08:46, Yuto Hayamizu wrote: Hi, all I want some list functions in Haskell like mapAccumL in clojure.contrib, because some sequence operations are difficult with only functions in clojure.core and contrib. Think about writing a function 'accum-seq', which takes a

Re: Common Algorithms Written in Clojure

2010-04-12 Thread Steve Purcell
On 12 Apr 2010, at 09:39, Bytesource wrote: Hi, I am new to Clojure and currently reading Programming Clojure (just finished the chapter on concurrency). I would like to know if there is a collection of common algorithms written in Clojure to get a better feel for the language and to

Re: Strange protocol behaviour

2010-05-20 Thread Steve Purcell
Before anyone spends time investigating, this has been accepted as an issue: https://www.assembla.com/spaces/clojure/support/tickets/353 My workaround for now is to use reify in place of deftype. -Steve On 20 May 2010, at 13:43, Steve Purcell wrote: I'm loving protocols, but I keep having

Re: finding combinations given a coll and selection of n

2010-05-22 Thread Steve Purcell
On 22 May 2010, at 20:38, Kasim wrote: Hi folks, I am just asking you guy's input to following: (defn- k-filter [el coll] (filter #(not (= el %)) coll)) (defn combinations [n coll] (if (= n 0) nil (for [el coll nlis (combinations (- n 1) (k-filter el coll))] [el

Re: 57 varieties

2010-05-28 Thread Steve Purcell
On 28 May 2010, at 11:39, Philip Hudson wrote: I've been trying for the best part of a month to get SLIME/SWANK/Clojure/clojure-mode working in emacs 23.2 on Mac OS X 10.5 without using ELPA, which unfortunately seems to break everything including itself in my setup. If it helps, I've

Re: numerator fn

2010-06-07 Thread Steve Purcell
On 7 Jun 2010, at 04:28, Dave Pawson wrote: On 6 June 2010 13:35, Moritz Ulrich ulrich.mor...@googlemail.com wrote: Note the Added in Clojure version 1.2 in the documentation of numerator ;-) Not until I'd blown up the text. Don't expect text that size to be read by everyone? If the

Re: Loop and Recur

2010-06-07 Thread Steve Purcell
On 6 Jun 2010, at 15:30, Jon Seltzer wrote: I'm still learning Clojure and doing so by reading everything on clojure.org. I ran across this example in the Functional Programming section: (defn my-zipmap [keys vals] (loop [my-map {} my-keys (seq keys) my-vals (seq vals)]

Re: Loop and Recur

2010-06-07 Thread Steve Purcell
On 7 Jun 2010, at 12:43, Steve Purcell wrote: Empty seqs are logically true, so your if condition is always true. Apologies; I'm talking rubbish: user= (if '() (println truthy)) truthy nil user= (if (seq '()) (println truthy)) nil -- You received this message because you are subscribed

Re: contrib command-line

2010-06-10 Thread Steve Purcell
On 10 Jun 2010, at 12:22, Dave Pawson wrote: http://richhickey.github.com/clojure-contrib/command-line-api.html Where might I find information on the 'cmdspec' mentioned please? If you click on the source link there is a nice example at the bottom. -Steve -- You received this message

Re: Reduce a function over more than one sequence (like map)

2010-06-11 Thread Steve Purcell
On 11 Jun 2010, at 08:59, Nathan Sorenson wrote: Is there a way to fold over multiple sequences, in the same way that 'map' can apply a multi-parameter function over several seqs? In other words, is there a function like this: (defn reduce* [f val colls] (reduce (fn [acc

Re: Can anyone create a simpler version of prime factors in Clojure?

2010-06-12 Thread Steve Purcell
On 11 Jun 2010, at 20:35, Russell Christopher wrote: didn't need the assoc in my previous try (defn of [n] (letfn [(f [res k] (if (= 0 (rem (:n res) k)) {:n (/ (:n res) k) :fs (conj (:fs res) k)} res))] (:fs (reduce f {:n n :fs []}

Re: Can anyone create a simpler version of prime factors in Clojure?

2010-06-12 Thread Steve Purcell
On 12 Jun 2010, at 16:18, Russell Christopher wrote: You're right. Hope I haven't offended with the fail, I thought I had tested it - by iterating over a range and comparing it to Uncle Bob's but obviously I didn't do that right and then realized that factorization is likely not O(n)

Re: RAM for a Ring app

2010-06-28 Thread Steve Purcell
On 27 Jun 2010, at 09:42, David Beckwith wrote: Approximately how much RAM is required to deploy a small Ring app on 64-bit Ubuntu? That rather depends on the deployment method, app server, and whether it's sharing a servlet container with other apps. By the time the JVM has loaded the

Re: Moderately off-topic: installing emacs on OSX

2010-12-10 Thread Steve Purcell
javajosh javaj...@gmail.com writes: failing to load in the error message and all, I'd try that. I would still like to see slime in action, however. I have two emacs installed, GNU and Aquamacs. macports is still not able to do anything - I'm actually rather concerned about it's health. $

Re: Moderately off-topic: installing emacs on OSX

2010-12-10 Thread Steve Purcell
javajosh javaj...@gmail.com writes: (conflicting advice snipped) If we can reach consensus on best (easiest, least error-prone) path to getting a working emacs clojure environment up on OSX I'll happily execute and even write up my experience. I think there is consensus; the respondents to

Re: Moderately off-topic: installing emacs on OSX

2010-12-13 Thread Steve Purcell
Chris Maier christopher.ma...@gmail.com writes: (if window-system (set-exec-path-from-shell-PATH)) This was a huge help for me, but I had to replace the -i flag with --login in order to fully replicate my path that I see in Terminal. I have a few things set in /etc/paths.d (TeX, X11, and git,

Re: Is swank-clojure.el deprecated?

2010-12-23 Thread Steve Purcell
limux liumengji...@gmail.com writes: The clojure has released the 1.2 version, while swank-clojure.el is used 1.1 yet, Is swank-clojure deprecated at all? Nope. Version 1.3 was just released. Take a look here for more info: https://github.com/technomancy/swank-clojure -Steve -- You

Re: Is swank-clojure.el deprecated?

2010-12-23 Thread Steve Purcell
limux liumengji...@gmail.com writes: The clojure has released the 1.2 version, while swank-clojure.el is used 1.1 yet, Is swank-clojure deprecated at all? Well, to be more precise; yes, swank-clojure.el is now unnecessary. You only need clojure-mode and slime. But see Phil's page for the

Re: Maps with functions for default values

2010-07-12 Thread Steve Purcell
On 12 Jul 2010, at 16:13, aria42 wrote: Is there a way to set up a map so that there is a default function which depending on the key returns a value if one is not present in the map. I can obviously write this with a deftype and have it implement Associative, Seqable, etc. so it behaves like

Re: Feedback on Clojure web development post

2010-07-26 Thread Steve Purcell
On 26 Jul 2010, at 17:30, tguy wrote: When developing a web app, my preference would be to edit files using SLIME with lein swank like all of my other development. So, I should be able to start and stop the server from the repl and can reflect my changes in the browser simply by reloading a

Re: take-while2?

2010-08-07 Thread Steve Purcell
On 7 Aug 2010, at 11:15, bonega wrote: Hi. Are there some function like this: (defn take-while2 [f pred coll] ... usage: (take-while2 + #( % 100) (iterate inc 0)) returns: (0 1 2 3 4 5 6 7 8 9 10 11 12 13) I'm feeling a bit stupid because I can't see from the above example how

Re: take-while2?

2010-08-07 Thread Steve Purcell
passed to pred. This examples takes elements while their total sum is less than 100. 2010/8/7 Steve Purcell st...@sanityinc.com On 7 Aug 2010, at 11:15, bonega wrote: Hi. Are there some function like this: (defn take-while2 [f pred coll] ... usage: (take-while2 + #( % 100

Re: take-while2?

2010-08-07 Thread Steve Purcell
On 7 Aug 2010, at 20:23, gary ng wrote: On Sat, Aug 7, 2010 at 8:14 AM, Steve Purcell st...@sanityinc.com wrote: Oh, right, so maybe: (last (take-while #( (apply + %) 100) (reductions conj [] (iterate inc 0 = [0 1 2 3 4 5 6 7 8 9 10 11 12 13] -Steve or user= (map second (take

Re: take-while2?

2010-08-08 Thread Steve Purcell
On 8 Aug 2010, at 04:56, Michał Marczyk wrote: Yet another version: (defn take-while-acc [f pred coll] (map (fn [_ x] x) (take-while pred (reductions f coll)) coll)) Seems to work: user (take-while-acc + #( % 100) (range)) (0 1 2 3 4 5 6 7 8 9 10 11 12 13) Delightful

Re: M-x clojure-mode in Slime REPL disables REPL

2010-08-10 Thread Steve Purcell
On 10 Aug 2010, at 19:19, Mike Meyer wrote: On Tue, 10 Aug 2010 09:57:02 -0700 (PDT) Alexis Rondeau alexis.rond...@gmail.com wrote: What I would like to do is to enable clojure-mode when I get my REPL (connected either via swank-clojure-project or lein swank/M-x slime- connect) but whenever

Re: chinese character in hiccup

2010-08-13 Thread Steve Purcell
On 13 Aug 2010, at 11:40, James Reeves wrote: I think it would be worth adding some charset setting middleware to Ring, though, and perhaps document this behaviour. +1 -- character encoding is exactly the kind of thing one would want to set up application-wide. -Steve -- You received this

ANN: Emacs auto-complete plugin for slime users

2010-08-14 Thread Steve Purcell
Hi all, A while ago I hooked Slime's completion and documentation features into the popular Emacs auto-completion framework auto-complete (http://www.emacswiki.org/emacs/AutoComplete). Since it may be of interest to others, I've released the completion plugin on github:

Re: ANN: Emacs auto-complete plugin for slime users

2010-08-15 Thread Steve Purcell
On 15 Aug 2010, at 08:45, Michał Marczyk wrote: This is absolutely awesome! I notice it also works perfectly with Common Lisp... I'm in a state of blissful exaltation. :-) Excellent - so if there are any quirks with this plugin, at least there'll be a couple more users to help fix it up now!

Re: ANN: Emacs auto-complete plugin for slime users

2010-08-15 Thread Steve Purcell
On 15 Aug 2010, at 10:13, Michał Marczyk wrote: On the other hand, I'm having mixed luck with fuzzy completion... slime-fuzzy-complete-symbol offers 'with-bindings and 'with-bindings* as completions for 'wi-bi, but so far I haven't been able to provoke ac + ac-slime to do the same (with

Re: ANN: Emacs auto-complete plugin for slime users

2010-08-17 Thread Steve Purcell
On 17 Aug 2010, at 13:00, Steve Purcell wrote: That seems to be a slime/swank problem, related to accessing the documentation for a symbol corresponding to a namespace. In a clojure-mode buffer, use M-: to execute the following expression: (slime-eval '(swank:documentation-symbol

Re: ANN: Emacs auto-complete plugin for slime users

2010-08-18 Thread Steve Purcell
On 17 Aug 2010, at 21:21, Steve Molitor wrote: Sorry my message got truncated. Let's try again: Fuzzy completion (ac-source-slime-fuzzy) isn't working for me. It complains that the function slime-fuzzy-completions is not defined. I'm using slime.el version 2010404, which does not

Re: ANN: Emacs auto-complete plugin for slime users

2010-08-18 Thread Steve Purcell
On 18 Aug 2010, at 13:51, MHOOO wrote: I'm experiencing the exact same problem. Haven't found a way to fix this yet. I've fixed the problem in my fork of swank-clojure and requested that Phil pull the commit into the master repo:

Re: creating map throws ArrayIndexOutOfBounds (inconsistently)

2010-08-28 Thread Steve Purcell
On 27 Aug 2010, at 19:40, santervo wrote: Also, if i hold AltGr down after typing { (AltGr-7) when pressing space button, i get this: user= { :a b } java.lang.Exception: Unable to resolve symbol: :a in this context (NO_SOURCE_FILE:0) Note from the spaces in the error message that

Re: Blogs/Twitter accounts about Clojure

2010-09-04 Thread Steve Purcell
Christian Guimarães cguimaraes...@gmail.com writes: Everybody here has a common interest. Clojure. And I think that all people here can contribute with relevant informations. So, why not follow the guys from this list. Interested? Add your twitter account bellow. Cheers. @csgui

Re: Clojure Database experience reports wanted

2010-10-03 Thread Steve Purcell
Mark Engelberg mark.engelb...@gmail.com writes: I've been using clojure with mongodb for a while now. I found that using a nosql database system was very freeing and pleasurable, compared to the python/sqlite combination I'd used before. However, I'm starting to bump up against some

Re: Javascript generator

2010-10-11 Thread Steve Purcell
jim jim.d...@gmail.com writes: Due to popular demand*, I resuscitated my code to generate javascript from s-expressions. This was what I coded to learn about logic programming in Clojure. Github: http://github.com/jduey/js-gen Clojars: http://clojars.org/net.intensivesystems/js-gen

Re: Javascript generator

2010-10-11 Thread Steve Purcell
into the javascript source sexps. -Steve jim jim.d...@gmail.com writes: I've heard of scriptjure but never used it or looked at it. My interests took me in another direction and I've never circled back. I would be interested to know how the differ. Thanks, Jim On Oct 11, 3:21 am, Steve Purcell st

Re: Javascript generator

2010-10-11 Thread Steve Purcell
David Nolen dnolen.li...@gmail.com writes: On Mon, Oct 11, 2010 at 10:02 AM, Steve Purcell st...@sanityinc.com wrote: Well, taking a brief look over your code, it seems like the main difference is that scriptjure is macro-based, so all the code generation gets done

Re: fastest way to remove nils

2010-11-17 Thread Steve Purcell
Miki miki.teb...@gmail.com writes: user= (time (remove nil? (repeat 100 nil))) Elapsed time: 0.079312 msecs () user= (time (filter identity (repeat 100 nil))) Elapsed time: 0.070249 msecs () Seems like filter is a bit faster, however YMMV You're not timing the execution, just the