[racket] recursion style question

From: Kevin Forchione (lysseus at gmail.com)
Date: Sat Sep 6 21:55:40 EDT 2014

Hi guys,
Which is preferable? 

(define (foo let … (acc empty)) … (foo (rest let) ... (cons …. acc))


(define (foo lst ...) (let loop ([lst lst] …[acc empty]) … (loop (rest let) … (cons …. acc)))

On the one hand we eliminate the named let construct, but on the other hand we expose the acc in the function / contract.  If the acc is not something the caller would ever need to know about, should we hide it inside the definition?


Posted on the users mailing list.