Program 1
Language: Python
def reverse(l): if(l==[]): return [] else: return (reverse(l[1:])+list(a[0]))
Program 2
Language: Python
def reverse(l): return l[::-1]
Program 3
Language: Python
a=range(10) a.reverse()
Program 4
Language: elisp (!!)
(defun consx (l x) "like cons but first arg is a list" (if (eq l '()) (list x) (cons (car l) (consx (cdr l) x)))) (defun reverse(l) "reverse a list" (if (eq l '()) () (consx (reverse (cdr l)) (car l)))) (reverse '(1 2 3))
2 comments:
u gEEk :P
You seem to have too much time on your hands :P
Post a Comment