Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
10
Task/Stem-and-leaf-plot/Racket/stem-and-leaf-plot.rkt
Normal file
10
Task/Stem-and-leaf-plot/Racket/stem-and-leaf-plot.rkt
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
#lang racket
|
||||
(define (show-stem+leaf data)
|
||||
(define xs (sort data <))
|
||||
(for ([stem (add1 (floor (/ (last xs) 10)))])
|
||||
(printf "~a|" (~a #:width 2 #:align 'right stem))
|
||||
(for ([i xs])
|
||||
(define-values [q r] (quotient/remainder i 10))
|
||||
(when (= q stem) (printf " ~a" r)))
|
||||
(newline)))
|
||||
(show-stem+leaf (sequence->list (in-producer read eof)))
|
||||
Loading…
Add table
Add a link
Reference in a new issue