Re: let a variable number of bindings

2009-07-18 Thread John Harrop
On Fri, Jul 17, 2009 at 11:52 PM, Rowdy Rednose rowdy.redn...@gmx.netwrote: How can I lexically bind names like let does in a macro, when names and values for those bindings are passed in? This here works fine when I pass a literal collection: (defmacro let-coll [coll body] `(let

Re: let a variable number of bindings

2009-07-18 Thread John Harrop
On Sat, Jul 18, 2009 at 1:22 AM, Meikel Brandmeyer m...@kotka.de wrote: Using eval is not really a solution. (def foo '[a 1 b 2]) (let-coll foo ...) will probably work with eval, but (let [foo '[a 1 b 2]] (let-coll foo ...)) will not. No, for that you need to make the macro

Slime - Clojure Installation

2009-07-18 Thread Glen Foy
Hi, I'm trying to set up Clojure, Slime and Aquamacs on a powerbook. I obtained http://github.com/technomancy/clojure-mode M-x clojure-install produces this error: Checking out source... this will take a while... Loading cl-macs...done Initialized empty Git repository in

Re: VimClojureBox

2009-07-18 Thread Meikel Brandmeyer
Hi, Am 14.07.2009 um 22:35 schrieb Justin Johnson: That sounds reasonable to me. I would only be able to work on the Windows installer but I'd be willing to collaborate with others to incorporate other installers into the project. I can try on a Mac installer. I'm not that something like

Re: VimClojureBox

2009-07-18 Thread Meikel Brandmeyer
Hi, Am 15.07.2009 um 05:12 schrieb e: i vote for zero config, option 1. I'm not a big fan of option 1, because you have to duplicate all efforts to install Vim on the different systems. The Windows installers and MacVim show, that this is not trivial, especially if you want to provide

Bug in VimClojure indentation logic?

2009-07-18 Thread James Reeves
Hi folks, Does anyone else suffer from occassional incorrect indentations in VimClojure? It looks like VimClojure is preferring the indentation layer of a previous set of [] over the current set of (). For example: (defn foo [x] (+ x 1)) When I hit enter after the

Re: Bug in VimClojure indentation logic?

2009-07-18 Thread James Reeves
On Jul 18, 4:54 pm, James Reeves weavejes...@googlemail.com wrote: Does anyone else suffer from occassional incorrect indentations in VimClojure? It looks like VimClojure is preferring the indentation layer of a previous set of [] over the current set of (). A quick update; it looks like it's

Re: Bug in VimClojure indentation logic?

2009-07-18 Thread Meikel Brandmeyer
Hi, Am 18.07.2009 um 18:07 schrieb James Reeves: On Jul 18, 4:54 pm, James Reeves weavejes...@googlemail.com wrote: Does anyone else suffer from occassional incorrect indentations in VimClojure? It looks like VimClojure is preferring the indentation layer of a previous set of [] over the

Re: let a variable number of bindings

2009-07-18 Thread Rowdy Rednose
Thanks Meikel, your negative answer actually helped me analyze my problem better and get the distinction run time / expansion time straight. I figured that the names of the bindings are already there at expansion time and it's only the values that I need to retrieve at run time. So this version

Re: let a variable number of bindings

2009-07-18 Thread Meikel Brandmeyer
Hi Rowdy, Am 18.07.2009 um 20:35 schrieb Rowdy Rednose: your negative answer actually helped me analyze my problem better and get the distinction run time / expansion time straight. I figured that the names of the bindings are already there at expansion time and it's only the values that I

Re: Loop, Recur, and Binding

2009-07-18 Thread Stuart Sierra
Hi, Tim, I'm not 100% certain what is going on here, but I do know that, in general, binding and loop/recur should not be mixed. recur is not true recursion -- it's more like a GOTO. The binding macro establishes thread-local bindings using the static methods

Re: Loop, Recur, and Binding

2009-07-18 Thread Meikel Brandmeyer
Hi Tim, the issue is already in the tracker: http://www.assembla.com/spaces/clojure/tickets/31 Sincerely Meikel smime.p7s Description: S/MIME cryptographic signature

Re: let a variable number of bindings

2009-07-18 Thread Jarkko Oranen
user= (macroexpand-1 '(let-coll [a b c] {:a 1 :b 2 :c 3} (println a b   c))) (clojure.core/let [val-fn__23 {:a 1, :b 2, :c 3}                     a          (val-fn__23 :a)                     b          (val-fn__23 :b)                     c          (val-fn__23 :c)]    (println a b c))

Re: let a variable number of bindings

2009-07-18 Thread Meikel Brandmeyer
Hi Jarkko, Am 18.07.2009 um 22:02 schrieb Jarkko Oranen: That looks a lot like map destructuring, though: (let [{:keys [a b c]} {:a 1 :b 2 :c 3}] (list a b c)) - (1 2 3) Yes. But val-fn might also be exactly that: a function which gets the value by some others means than a map. I'm not

Re: Bug in VimClojure indentation logic?

2009-07-18 Thread Richard Newman
Is this just me, or does anyone else have this issue? I haven't had your exact problem, but sometimes it seems to incorrectly maintain depth at the top level, so I'll end up with something like (defn foo [x y] ...) (defn bar [a] ...) (defn baz [...] ...) | cursor goes

Re: Bug in VimClojure indentation logic?

2009-07-18 Thread James Reeves
On Jul 18, 6:47 pm, Meikel Brandmeyer m...@kotka.de wrote: I don't see this here. Which vim are you using? Which VimClojure? Does it happen also in a different file? Can you send me an example file where this happens? I cleared down my Vim settings back to the defaults, and indentation

Re: let a variable number of bindings

2009-07-18 Thread Rowdy Rednose
As I said, the example was stripped down for simplicity, and that simple version doesn't make much sense other than for communicating my problem. My real val-fn is not a map, it's indeed a couple of functions, applied to some data that's passed in. But the result of that acts like a map: it

On Lisp = Clojure

2009-07-18 Thread Rowdy Rednose
Hi all, in my quest to learn clojure (and lisp in general), I'm currently trying to translate some the On Lisp code to clojure. The first couple of functions and macros in Chapter 19 A Query Compiler read: (defun make-db (optional (size 100)) (make-hash-table :size size)) (defvar

Re: On Lisp = Clojure

2009-07-18 Thread Rowdy Rednose
On Jul 19, 12:53 pm, Richard Newman holyg...@gmail.com wrote: * Can the body of the db-push function be simplified? I think so. Untested: (defn db-push   ([key val] (db-push key val *default-db*))   ([key val db]      (swap! db assoc key (cons val (db key)) If I add an @ it runs: