News for hackers. Stuff that matters.
Re:Practical Emacs Lisp by klibertp on Saturday September 12, 2015 @06:00AM (#10207711)
Some Schemes - most notably Racket, which I use the most - allow for nested defines. Your code actually is a valid Racket code after polishing the differences in naming and syntax a bit:

    #lang racket

    (define-syntax-rule (defun name (arg ...) . body)
      (define (name arg ...) . body))
    (define nil null)
    (define t #t)

    (defun ab (l)
      ;; "I'm too lazy to reverse the result back."
      (defun _ (l a b f)
        (if (null? l)
            (if f (list a b) (list b a))
            (_ (cdr l) b (cons (car l) a) (not f))))
      (_ l nil nil t))

    (ab '())
    (ab '(1))
    (ab '(1 2))
    (ab '(1 2 3 4 5 6 7 8 9 10))
    ;; ((9 7 5 3 1) (10 8 6 4 2))
    (ab '(1 2 3 4 5 6 7 8 9 10 11))
    ;; ((11 9 7 5 3 1) (10 8 6 4 2))
...and you don't need to worry about recursion limits thanks to mandatory TCO.
Re:Practical Emacs Lisp by agumonkey on Saturday September 12, 2015 @06:40AM (#10207763)
Yeah, I spent too much time on scheme classes about recursive logic while using emacs lisp at the same time, hence the code above.