I noticed that [H|T] = [1].succeeds, but [H|T] = [].fails. I suppose how this works, but is there any reason why the designer did not decide that this template corresponded to a successful result and led to the appointment of H=[]and T=[]?
[H|T] = [1].
[H|T] = [].
H=[]
T=[]
9> [H|T] = [1]. [1] 10> H. 1 11> T. [] 12> [H|T] = []. ** exception error: no match of right hand side value []
If [H|T]it matches []with H=T=[], then [[]]it will not differ from []using pattern matching.
[H|T]
[]
H=T=[]
[[]]
[] [H|T] , , [H|T] , [] , .
[] " " .
, @sepp2k , [] [_|_] , . .
[_|_]
Source: https://habr.com/ru/post/1793568/More articles:Is this behavior possible in Android applications - androiddidFinishPickingMediaWithInfo not called after receiving memory warnings - memoryResize rectangle by dragging its corners in Android? - androidhow to load a class from another application in android - javaCount the frequency of specific nodes in an XML document - xmlWeb conversion files are copied to root + bin - asp.netdoes vim create copies of my files after saving? - vimDiscriminated Union Match - enumsCreating a jQuery Plugin Job On a dynamically added element - jqueryprogressive combination of string words - stringAll Articles