Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
12
Task/Repeat/Racket/repeat.rkt
Normal file
12
Task/Repeat/Racket/repeat.rkt
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
#lang racket/base
|
||||
(define (repeat f n) ; the for loop is idiomatic of (although not exclusive to) racket
|
||||
(for ((_ n)) (f)))
|
||||
|
||||
(define (repeat2 f n) ; This is a bit more "functional programmingy"
|
||||
(when (positive? n) (f) (repeat2 f (sub1 n))))
|
||||
|
||||
(display "...")
|
||||
(repeat (λ () (display " and over")) 5)
|
||||
(display "...")
|
||||
(repeat2 (λ () (display " & over")) 5)
|
||||
(newline)
|
||||
Loading…
Add table
Add a link
Reference in a new issue