Guest User

Untitled

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