only elements of the same type can be stored in a list.
+ +: Merges two lists into a list. example, [1,2,3]++[4,5,6], the result is [1,2,3,4,5,6].
: : Add the preceding element of ":" to the list after ":". The newly added element is in the head position of the list. Example, 1:[2,3,4,5,6], the result is [1,2,3,4,5,6].
!! : Takes the element of the list subscript position. example, [1,2,3,4,5,6]!! 0, the result is 1.
Elem: Determines whether an element exists in the list. example, Elem 1 [1,2,3,4,5,6], the result is true. infix form, 1 ' elem ' [1,2,3,4,5,6].
PS: ' is not a single quote in infix form, it is the symbol below the ' ~ ' key on the keyboard.
Second, compare list.
[3] The result of > [2,1] is true.
head: Takes out the first element of the list.
tail: Remove all elements except the first element of the list.
Last: Takes out the final element of the list.
init: Takes out all elements except the last element of the list.
Length: Returns the Long value of the list.
NULL: Determines whether the list is empty.
Reverse: Returns a list's inverse list.
Maximum: Takes the maximum value in the list.
minimum: Takes the minimum value from the list.
sum: Calculates the sum in the list element.
Take: Takes the first n elements of a list. example, take 2 [1,2,3,4,5,6], the result is [+].
Drop: Takes the second x element of the list. example, Drop 2 [1,2,3,4,5,6], the result is [3,4,5,6].
Three, range related
[1..10] equivalent to [1,2,3,4,5,6,7,8,9,10]
[' A ' ... ' G '] equivalent to [' A ', ' B ', ' C ', ' d ', ' e ', ' f ', ' G ']
[3,6..10] equivalent to [3,6,9]
cycle: Infinite repetition of subsequent content. example, take 3 (cycle []), the result is [1,2,1].
repeat: infinite repetition of subsequent elements. example, take 2 (repeat 1), the result is [+].
replicate: Repeats the element after N times. example, replicate 2 [[1,2],[1,2]] and the result is [[]].
Iv. representation of a set
MoD: Take the remainder operation.
Odd: Determine if a number is odd.
[x*2|x<-[1..10]] equivalent [2,4,6,8,10]
[X|x<-[1..10],odd x,mod x 3 = = 0] equivalent to [3,9]
Haskell List related Operations