Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
Tutorialspoint

Execute LISP Online

(write-line "Hello World")
;get the list of all atoms
;(((A B) C) (D E)) ==> (A B C D E)

(DEFUN fct(L)
    (COND
        ((NULL L) NIL)
        ((ATOM (CAR L)) (CONS (CAR L) (fct (CDR L))))
        ((LISTP (CAR L)) (APPEND (fct (CAR L)) (fct (CDR L))))
    )
)

(write(fct '(((A B) C) (D E) F) ))

Advertisements
Loading...

We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.