Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Duplicate list elements recursively
;gnu clisp 2.49.60 (defun dupl (lst) (cond ((null lst) nil) ((not (listp lst)) (list lst lst)) (t (cons (car lst) (cons (car lst) (dupl (cdr lst))))) ) ) (print (dupl '(1 2 3))) ;; (1 1 2 2 3 3) (print (dupl '(r (5)))) ;; (R R (5) (5))
run
|
edit
|
history
|
help
1
L2.8
mywall
L1.9b
(defun (ins ‘( 2 5 6) ‘4)
test***
Вычисление гипотенузы... на лиспе.
Project Euler 51
Project Euler Problem 491
COND
14