about summary refs log blame commit diff stats
path: root/shen/rms-defs.shen
blob: 7839a178a88ef18cd4d9cb32cc4004247efb483a (plain) (tree)



















                                                 
(define mean
  { (list number) --> number }
  Xs -> (/ (sum Xs) (length Xs)))
 
(define square
  { number --> number }
  X -> (* X X))
 
(define rms
  { (list number) --> number }
  Xs -> (sqrt (mean (map (function square) Xs))))
 
(define iota-h
  { number --> number --> (list number) }
  X X -> [X]
  X Lim -> (cons X (iota-h (+ X 1) Lim)))
 
(define iota
  { number --> (list number) }
  Lim -> (iota-h 1 Lim))