PasteRack.org
Paste # 3432
2019-04-11 10:53:46

Fork as a new paste.

Paste viewed 276 times.


Embed:

  1. #lang racket
  2. ;;repeat : symbol natural -> los
  3. ;;produce a list with symbols
  4. (define (repeat symbol natural)
  5.   (cond
  6.    [(= natural 0) empty]
  7.    [else (cons symbol ( repeat symbol (sub1 natural)))]))
  8. (repeat 'bets 3)
  9. (repeat 'doll 0)

=>

'(bets bets bets)

'()