Processing math: 96%

Sequence Notation

« Resources
Notation Equivalent SML with SEQUENCE library
S[i] nth S i
|S| length S
empty ()
v singleton v
i,,j tabulate (fn k => i + k) (j - i + 1)
Si,,j subseq S (i, j - i + 1)
e:pS map (fn p => e) S
e:0i<n tabulate (fn i => e) n
pS|e filter (fn p => e) S
e1:pS|e2 map (fn p => e1) (filter (fn p => e2) S)
e:p1S1,p2S2 flatten (map (fn p1 => map (fn p2 => e) S2) S1)
e:0i<n,0j<i flatten (tabulate (fn i => tabulate (fn j => e) i) n)
pSe reduce add 0 (map (fn p => e) S)
ni=ke reduce add 0 (map (fn i => e) k,,n)

The meaning of add and 0 in the reduce will depend on the type (e.g. Int.+ and 0 for integers or Real.+ and 0.0 for reals). We can also replace with other operations such as min and \max with the implied semantics.