freenode/#lisp - IRC Chatlog
Search
1:15:03
ruffianeo
I am trying to write a macro (defmacro remoted (name args &body body) ...) which defines 3 functions.....
1:18:32
no-defun-allowed
`(progn (defun ,name ,args ,@body) (defun ,(make-name name) () '(,name ,@args)) (defun ,(make-definition-name name) () '(defun ,name ,args ,@body)))?
1:19:43
no-defun-allowed
make-name and make-definition-name can be defined using intern and format (or alexandria:format-symbol) if you need to make those names and they aren't given by the user.
1:24:42
ruffianeo
well - I hosted ecl in some c++ code and want to send it lisp stuff over a tcp socket
1:37:01
ruffianeo
the problem I have with (remote-foo 1 2 3), that the (defun remote-foo (a b c) '(foo a b c)) needs to kind of eval the arguments and put the values into the variables
1:37:01
no-defun-allowed
Then you want to generate (list 'foo ,@arguments), but not exactly that, because the lambda list (a &key b) would do something else.
1:37:52
no-defun-allowed
If you can live without the lambda list, you could generate `(defun remote-foo (&rest rest) (cons ',name rest)).
1:38:51
no-defun-allowed
One idea though: instead of generating (remote-foo 1 2 3), why not (remote (foo 1 2 3))? Defining REMOTE would be trivial, and it'd just look like FOO otherwise.
1:46:28
ruffianeo
(remote (name &rest args) ...) could be a second macro I then simply use for the first one
11:03:46
drl
How can this be fixed: ; Evaluation aborted on #<SB-KERNEL:SIMPLE-PACKAGE-ERROR "~A is a nickname for the package ~A" {1006988463}>.