Search code examples
lispcommon-lispvariadic-functions

common-lisp — how to wrap a built-in function that has var-args?


I’d like to wrap the built-in:

     (concatenate ‘string <arg1> <arg2> .. <argn>)

To be something like this:

     (strcat <arg1> <arg2> ... <argn>)

The issue is - how to do var-args in common-lisp? I see two possible paths:

  1. accept a list as a parameter, then splat it / apply it [neither of which I know either]
  2. var-args special syntax in common-lisp? ex: ...

Thanks


Solution

  • (defun strcat (&rest args)
      (apply #'concatenate 'string args))