about summary refs log tree commit diff stats
path: root/shen/rms-defs.shen
blob: 7839a178a88ef18cd4d9cb32cc4004247efb483a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
(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))