LINUX.ORG.RU

История изменений

Исправление monk, (текущая версия) :

А почему бы это именно здесь и не узнать, в чем проблемы?

«Именно здесь» — это где?

Из

(defmacro defun* (fname arglist &body body)
  (safe-define 'defun fname arglist body))

и кода safe-define структура параметров никак не следует. А если брать формальную грамматику из комментария:

- FNAME :: either the name of the function to be created, or a list with the
  following grammar:
  : fname =   FUNCTION-NAME
  :         | (FUNCTION-NAME -> TYPE [assertion])
  : assertion =       FORM
  :                 | PREDICATE-SYMBOL
  Where:
  - =TYPE= is any valid type specifier
  - =FORM= is any form, which must return non-nil if the assertion is satisfied,
    nil otherwise. Within the form, the symbol =RESULT= is bound to the
    value that is about to be returned by the function.
  - =PREDICATE-SYMBOL= is a symbol, the name of a function that accepts a single
    argument. Equivalent to the form =(PREDICATE-SYMBOL RESULT)=.

    /Note:/ if the latter (list) form for fname is used, the =DEFUN*= body may
    /not/ also contain a =:returns= form. Also note that the latter form cannot
    currently be used when defining a =(setf ...)= function or method.
- ARGLIST :: a =DEFUN*= LAMBDA LIST, which uses the following grammar:
  : arglist =   var-term*
  :           | (var-term* [&optional opt-term+])
  :           | (var-term* [&key opt-term+])
  :           | (var-term* [&rest rest-term])
  : var-term =        VARNAME
  :                 | (VARNAME TYPE/CLASS [assertion])
  : rest-term =       VARNAME
  :                 | (VARNAME ELEMENT-TYPE)
  : opt-term =        VARNAME
  :                 | (var-term DEFAULT [SUPPLIEDP])

То уже нет разницы писать парсер на лиспе или на любом другом языке.

Исправление monk, :

А почему бы это именно здесь и не узнать, в чем проблемы?

«Именно здесь» — это где?

Из

(defmacro defun* (fname arglist &body body)
  (safe-define 'defun fname arglist body))

и кода safe-define

Структура параметров никак не следует. А если брать формальную грамматику из комментария:

- FNAME :: either the name of the function to be created, or a list with the
  following grammar:
  : fname =   FUNCTION-NAME
  :         | (FUNCTION-NAME -> TYPE [assertion])
  : assertion =       FORM
  :                 | PREDICATE-SYMBOL
  Where:
  - =TYPE= is any valid type specifier
  - =FORM= is any form, which must return non-nil if the assertion is satisfied,
    nil otherwise. Within the form, the symbol =RESULT= is bound to the
    value that is about to be returned by the function.
  - =PREDICATE-SYMBOL= is a symbol, the name of a function that accepts a single
    argument. Equivalent to the form =(PREDICATE-SYMBOL RESULT)=.

    /Note:/ if the latter (list) form for fname is used, the =DEFUN*= body may
    /not/ also contain a =:returns= form. Also note that the latter form cannot
    currently be used when defining a =(setf ...)= function or method.
- ARGLIST :: a =DEFUN*= LAMBDA LIST, which uses the following grammar:
  : arglist =   var-term*
  :           | (var-term* [&optional opt-term+])
  :           | (var-term* [&key opt-term+])
  :           | (var-term* [&rest rest-term])
  : var-term =        VARNAME
  :                 | (VARNAME TYPE/CLASS [assertion])
  : rest-term =       VARNAME
  :                 | (VARNAME ELEMENT-TYPE)
  : opt-term =        VARNAME
  :                 | (var-term DEFAULT [SUPPLIEDP])

То уже нет разницы писать парсер на лиспе или на любом другом языке.

Исходная версия monk, :

А почему бы это именно здесь и не узнать, в чем проблемы?

«Именно здесь» — это где?

Из

(defmacro defun* (fname arglist &body body)
  (safe-define 'defun fname arglist body))

и кода safe-define

Структура параметров никак не следует. А если брать формальную грамматику из комментария:

То уже нет разницы писать парсер на лиспе или на любом другом языке.