You know how repetition of language has a tendency to render it meaningless? After a certain threshold has passed – let’s say ten repetitions – the definition slips away, leaving a smear of alien letters on the page.
“Tail?” What’s a tail? I DON’T KNOW.
#lang racket
#| Annotate tail calls in Scheme code built from non-quoted literals, variables, 'if', 'set!', 'λ', and function call.
Tail calls are annotated as (τ: ...). |#
(provide annotate-tails)
(require (only-in "match-diamond.rkt" match◇))
(define (annotate-tails code [tail? #t])
(let ([tail (λ (code) (annotate-tails code #t))]
[not-tail (λ (code) (annotate-tails code #f))]
[preserve-tail (λ (code) (annotate-tails code tail?))])
(match◇ code
((λ
...
)
(λ
,@(map not-tail `)
,(tail `)))
((if
)
(if ,(not-tail `)
,(preserve-tail `)
,(preserve-tail `)))
((set! )
(set! ,(not-tail `)))
(( ...)
(,@(if tail? '(τ:) '())
,(not-tail `) ,@(map not-tail `)))
(
))))











2 comments
Comments feed for this article
March 13, 2011 at 7:36 am
arafelis
You know how repetition of language has a tendency to render it meaningless? You know how repetition of language has a tendency to render it meaningless? You know how repetition of language has a tendency to render it meaningless? You know how repetition of language has a tendency to render it meaningless? You know how repetition of language has a tendency to render it meaningless? You render meaningless how tendency of it language repetition has a know to? You to how know a has of repetition meaningless render language tendency? You language how a repetition know has it tendency render? Tender you row now leniency of reptile language….
March 13, 2011 at 7:38 am
arafelis
Sorry, looking at it now, I think that last sentence should’ve ended with “cunnilingus.”