« first day (656 days earlier)      last day (1210 days later) » 

01:47
Sunday funday!
02:10
fib improved:
> fib@(_:tfib) = 0:1: zipWith (+) fib tfib
> take 10 fib
[0,1,1,2,3,5,8,13,21,34]
the @ is a lazy pattern called an as-pattern
gotta love all the builtin higher order functions...
zipWith is basically map combined with zip
not sure if this is better:
> fib@(0:tfib) = 0:1: zipWith (+) fib tfib
The underscore matches anything, but the 0 only matches zero... nevertheless, it works
finally... the (+) is called a section of an infix operator...
If anyone knows better or more precisely then please correct me.
This (@) is also called a pattern binding - the pattern has an implicit ~ and so it always succeeds... this is what makes it lazy, yet it provides output...
on to the lexical scoping section of the tutorial!
 
2 hours later…
04:45
Clearly one must be careful with floating point arithmetic:
> 0.1+0.1+0.1+0.1+0.1+0.1+0.1+0.1+0.1+0.1
0.9999999999999999
> 0.1+0.1+0.1+0.1+0.1+0.1+0.1+0.1+0.1+0.1 == 1
False
 
10 hours later…
14:32
@AaronHall Hi, thanks for welcoming me! sorry could not reply before (not enough reputation).
14:56
@Klorax no big deal
I hope you stick with it and keep building a good reputation here.
 
6 hours later…
21:21
@Byte Once I saw a talk with one of the creators of Julia (a language for numerical computation, with features like user-defined numeric types). He said "the problem with floats is that they are not numbers." Too many rules of numbers just don't apply to them.
2

« first day (656 days earlier)      last day (1210 days later) »