What is meant by keyword argument in LISP?

Sharad Jaiswal
Sharad Jaiswal

Posted On: Feb 22, 2018

 

keyword argument are function arguments that are passed by keyword, instead of position.Keyword arguments can be mixed with by-position arguments, and default-value expressions can be supplied for either kind of argument:
(define greet
  (lambda (given #:last surname)
    (string-append "Hello, " given " " surname)))
 
> (greet "John" #:last "Smith") 
"Hello, John Smith"
> (greet #:last "Doe" "John")
"Hello, John Doe"

In above example last is a keyword argument.

    Related Questions

    Please Login or Register to leave a response.

    Related Questions

    Lisp Interview Questions

    What is LISP Programming

    List Processing – LISP (or LISP) is the second oldest high-level programming language after Fortran developed by John..

    Lisp Interview Questions

    How many types of variables are available in LISP?

    There are two types of variables are available in LISP one is lexical variable, and other is special variable..

    Lisp Interview Questions

    What is LISP Machine (LISPM)

    LISP machines are general-purpose computers designed to efficiently run LISP as their main software and programming lan..