lisp - Programmatically defun a function with a given name -


I need to program a macro which is similar to defun , so that any function My attempts to name a given (auto-generated) name are:

  (defun, (intern "autogen-command-33") () (echo "autogen- Command-33! "))  

However, for some reason, (intern ...) stopped working as expected (now it's like this Complaints):

  Invalid number of arguments: 1 [Type of condition SB-IA T: simple programming error] restarts: 0: [Retry] retry SLIME REPL evaluate the request. 1: [* ABORT] Return to the top level of SLIME 2: [Timeliness] End this thread (# & lt; THREAD "worker" running {10078C8DE3}>) Backtraces: 0: [Error printing Frame] 1: (SB-INT: Simple-Eva-in-Lexenw (International) "Autogen-Command-34") # (NULL-LEXENV> 2) (EVAL ("autogen-command-34") )  

So I intern with created-icon , which does not return any errors. Then, I try the (autogen-command-35) , hopefully it has been defined, but it is not:

  STUMPWM> (Eval `(defun, (make-symbol" autogen-command-35 ") () (resonance" autogen 35 "))): | Autogen-command-35 | STUMPWM & gt; (Autogen-command-35); # & Amp; # 39; UNDEFINED-FUNCTION AUTOGEN-COMMAND-35 {10082F8D43} & gt; On & # STUMPWM & gt;  

How do I define a named function in Common Lispi?

If you make a symbol as a function name that you want to call There are some things to consider:

  • Symbol names are internally larger by default, so the best present case creates a symbol, usually uppercase.

  • The symbols of the function should usually be in the package. The INTERN is the right package for it in symbol International. The Best To Specify Package While In Internal Phone See the documentation for

Your icon names were lowercase. Make-Symbol also creates only one symbol, but it is not interned in the package.

  FOO & gt; (Internet "baobab" "cl-user") comon-lip-user :: bobab  

Comments

Popular posts from this blog

import - Python ImportError: No module named wmi -

Editing Python Class in Shell and SQLAlchemy -

c# - MySQL Parameterized Select Query joining tables issue -