Closed homedirectory closed 1 year ago
This doesn't work with normal symbols, but it should be possible to get this thru quoting; have you tried:
`(fn ,name [...]
@technomancy The example I provided was too simple. I'm actually trying to form an argument list by adding ...
to the end. Here is a more realistic example:
(fn defun [name arglist ...]
(let [args (mandatory-args arglist)]
(table.insert args varg-sym) ;; need varg-sym
`(fn ,name ,args
;; ommited
)))
(table.insert args '...) should work
@andreyorst, it works, thank you. This was almost too simple.
Function
varg
fromfennel.utils
returns a symbol representing var args (...
). Since this symbol's name starts with a dot, it cannot be constructed using(sym "...")
, which would signal an error.This prevents us from writing macros that need access to the var args symbol.
Example:
Output:
I've also tried using
(require :fennel.utils)
inside a macro to access thevarg
function. The module is found only when compiled with--no-compiler-sandbox
.