Skip to content

Instantly share code, notes, and snippets.

View andlys's full-sized avatar

Andrii Lysenko andlys

  • Kyiv, Ukraine
View GitHub Profile
@andlys
andlys / fun.lisp
Created September 12, 2017 06:08
(defmacro nth-expr (n &rest args)
(let ((g (gensym)))
`(let ((,g (1- ,n)))
(eval (nth ,g ',args))))) ; TODO: make this work without eval function
(defun watch () (print 'evaluated!))
(let ((n 2))
(macroexpand-1 '(nth-expr n (watch) (+ 1 3) 'value)))
(let ((n 2))
(nth-expr n (watch) (+ 1 3) 'value))