Name: Anonymous 2015-11-06 22:20
and what's this craze about tail-recursion? they didn't like loops?
(let loop ((x 1)) der... (loop n))
is a loop construct, but it is essentially equivalent (i.e. macro-rewritable) to (let ((loop (lambda (x) der... (loop n)))) (loop 1))
in the same way that unlabelled let
and lambda
are related. (define-struct foo (a b c))
; ->
(define foo-id (gensym))
(define (foo a b c) (list foo-id a b c))
(define (foo? x) (eq? (car x) foo-id))
(define (foo-a x) (assert (foo? x)) (cadr x))
(define (foo-b x) (assert (foo? x)) (caddr x))
(define (foo-c x) (assert (foo? x)) (cadddr x))
infer-types
[1] macro.