Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;; 捨てるのももったいないので %* とか付けてみたり。オリジナルにもあったんだったか
- (defun clojurish-fn (delim-char)
- (lambda (srm char arg)
- (declare (ignore char arg))
- `(lambda (&rest %*)
- (destructuring-bind (&optional %1 %2 %3 %4 %5 %6 %7 %8 %9 %10 %11 %12 %13 %14 %15 %16 %17 %18 %19 %20
- &aux (% %1)) %*
- ,(read-delimited-list delim-char srm T) ))))
- (defmacro with-new-readtable (&body body)
- `(let ((*readtable* (copy-readtable nil)))
- ,@body))
- (with-new-readtable
- (set-syntax-from-char #\} #\) )
- (set-dispatch-macro-character #\# #\{ (clojurish-fn #\}))
- (eval (read-from-string "(funcall #{list % % (list %2) %*} 1 2 3)")) )
- ;=> (1 1 (2) (1 2 3))
Add Comment
Please, Sign In to add comment