[plt-scheme] Intersperse

From: Matthias Felleisen (matthias at ccs.neu.edu)
Date: Tue Feb 12 16:24:39 EST 2008

Everyone writes his own for his own collects directory, and then  
'folds' it, and nobody bothers to add it ... Put it in! -- Matthias



On Feb 12, 2008, at 3:33 PM, Jens Axel Soegaard wrote:

> Is this function in one of the usual list libraries?
>
>   (define (intersperse seperator xs)
>     (cond
>       [(null? xs) '()]
>       [(null? (cdr xs)) xs]
>       [else (cons (car xs)
>                   (cons seperator
>                         (intersperse seperator (cdr xs))))]))
>
>   > (intersperse '- '(a b c d))
>   (a - b - c - d)
>
>
> -- 
> Jens Axel Søgaard
> _________________________________________________
>  For list-related administrative tasks:
>  http://list.cs.brown.edu/mailman/listinfo/plt-scheme



Posted on the users mailing list.