[plt-scheme] Intersperse

From: Robby Findler (robby at cs.uchicago.edu)
Date: Tue Feb 12 17:14:26 EST 2008

Yeah, I can't count how many times I've written that function. I
usually call it add-between, tho. :)

Robby

On Feb 12, 2008 3:24 PM, Matthias Felleisen <matthias at ccs.neu.edu> wrote:
>
> 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
>
> _________________________________________________
>   For list-related administrative tasks:
>   http://list.cs.brown.edu/mailman/listinfo/plt-scheme
>

Posted on the users mailing list.