1. In Haskell, the string is indeed the syntactic sugar of the character array.
2. merge list
In Haskell, the combined list is implemented using the ++ OPERATOR:
Here, we can also see the relationship between strings and character arrays.
However, the ++ operator traverses the list on the left. The longer the list, the slower the access. In this case, it is better to use:
However, the: operator can only connect one element and one list:
So from above, why can't it be [[, 3], 6], but an error is reported? This is because the Haskell list can only accommodate the same type of elements:
Also, since we have all said that the string is actually a character array, you can put these operations in the string as well:
3. List Index
In conventional languages, we usually get used to brackets and subscripts to take an element in the list. But this syntax of Haskell is very strange!
4. List compare size
In fact, it is easy to imagine that the comparison is always from the first element:
However, the comparison can only be based on the same type; otherwise, an error is returned!
5. Common functions
When the list is a stack and a queue, such a function is generated:
Some frequently used:
6. Range
Interval is a very useful thing. Now every time I see the for loop assigning values to arrays, It is a headache.
This is a smart guy.
But he is not smart enough. I want to output 2, 4, 8, 16, and he will be powerless.
7. Evaluate inertia
In the previousArticleThe value of inertia.
Both cycle and repeat generate an infinitely long list, .................
Haskell does not persistently calculate all and then calculate, but calculates the value based on the calculation. This is called the inert value.