update
This commit is contained in:
parent
1f1ad49427
commit
6f050a029e
2496 changed files with 37609 additions and 3031 deletions
|
|
@ -1,4 +1,5 @@
|
|||
; fast
|
||||
#lang racket
|
||||
;; fast
|
||||
(define (string-repeat n str)
|
||||
(apply string-append (make-list n str)))
|
||||
(string-repeat 5 "ha") ==> "hahahahaha"
|
||||
(string-append* (make-list n str)))
|
||||
(string-repeat 5 "ha") ; => "hahahahaha"
|
||||
|
|
|
|||
|
|
@ -1,7 +1 @@
|
|||
; memory efficient
|
||||
(define (string-repeat n string)
|
||||
(with-output-to-string
|
||||
(λ ()
|
||||
(for ([_ (in-range n)])
|
||||
(display string)))))
|
||||
(string-repeat 5 "ha") ==> "hahahahaha"
|
||||
(make-string 5 #\*) => "*****"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue