NFun
NFun copied to clipboard
Incremental type interface
As char is arithmetic type - it can be used in such an expressions:
word = [/'a'../'c'] #'abc'
ips = [127.0.0.1.. 127.0.0.5] # [127.0.0.1, 127.0.0.2, 127.0.0.3, 127.0.0.4, 127.0.0.5]
range(a,b) = [a..b]
word2 = range(/'a',/'b') #'abc'
range2 = range(1,3) #[1,2,3]
so the arithmetic is inteface:
Incremental<T> <= IComparable<T>:
T Increment(T)
T Decrement(T)
T MaxValue()
T MinValue()
Numbers, chars, days, months, ip and other types has to implement the interface
any
|-----incremental : comaprable
|---------numbers
|---------char
|---------ip