Command-line arguments: Difference between revisions

Content added Content deleted
(→‎{{header|Common Lisp}}: add a function for a univorm way to access arguments)
Line 252: Line 252:
=={{header|Common Lisp}}==
=={{header|Common Lisp}}==


The Common Lisp standard does not specify anything relating to external invocation of a Common Lisp system. The method for getting command-line arguments varies by implementation; here are some examples:
The Common Lisp standard does not specify anything relating to external invocation of a Common Lisp system. The method for getting command-line arguments varies by implementation.


The following function could be used to create a uniform way to access the arguments:
{|
! Implementation !! Expression !! Includes program name (argv[0])
|-
| SBCL || sb-ext:*posix-argv* || Yes
|-
| CLISP || ext:*args* || No
|}


<lang lisp>(defun argv ()
All of these return a list of strings.
(or
#+SBCL sb-ext:*posix-argv*
#+LISPWORKS system:*line-arguments-list*
#+CMU (cons "cmucl" extensions:*command-line-words*)
#+CLISP (cons "clisp" ext:*args*)
nil))</lang>


=={{header|D}}==
=={{header|D}}==