Skip to content
This repository has been archived by the owner on Mar 15, 2024. It is now read-only.

Commit

Permalink
dealing with &rest and &optional
Browse files Browse the repository at this point in the history
  • Loading branch information
Hakan Raberg committed Apr 16, 2012
1 parent 9a6e4d2 commit 9f1a718
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion smoke
@@ -1,3 +1,3 @@
#!/bin/sh

./run-bare -Q --batch --eval "(print (emacs-version))"
./run-bare --batch --eval "(print (emacs-version))"
5 changes: 4 additions & 1 deletion src/deuce/core.clj
Expand Up @@ -4,7 +4,10 @@

(defmacro defun [name args & body]
(let [[doc body] (split-with string? body)
name (if (seq? name) (eval name) name)]
name (if (seq? name) (eval name) name)
args (replace '{&rest &} args)
[args &optional optional-args] (partition-by '#{&optional} args)
args (concat args (when &optional ['& (vec optional-args)]))]
`(do (defn ~name ~(vec args) ~@body)
(alter-meta! (var ~name) merge {:doc ~(apply str doc)})
~name)))
Expand Down
2 changes: 1 addition & 1 deletion src/deuce/scaffold.clj
@@ -1,5 +1,5 @@
(ns deuce.scaffold
(use [deuce.core])
(use [deuce.core :exclude (-main)])
(require [clojure.java.shell :as sh]
[clojure.string :as string]
[clojure.walk :as walk]
Expand Down

0 comments on commit 9f1a718

Please sign in to comment.