Logo

Programming-Idioms

History of Idiom 165 > diff from v12 to v13

Edit summary for version 13 by foo:
[Haskell] set function as terminal function

Version 12

2017-12-22, 10:38:11

Version 13

2017-12-22, 10:40:34

Idiom #165 Last element of list

Assign to variable x the last element of list items.

Idiom #165 Last element of list

Assign to variable x the last element of list items.

Code
x = last items
Code
x = case items of
  [] -> []
  xs -> last xs
Comments bubble
items - list of homogenious elms
x - the last elm of this list
Comments bubble
items - list of homogenious elms
x - the last elm of this list