File: Last.curry

package info (click to toggle)
curry-tools 1.0.1%2Bdfsg1-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 5,492 kB
  • ctags: 121
  • sloc: makefile: 470; sh: 421
file content (11 lines) | stat: -rw-r--r-- 190 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
-- The classical last element of a list:

import Test.EasyCheck

last :: [a] -> a
last xs | _ ++ [x] == xs = x  where x free

main :: Int
main = last [1,2,3]

test_last = last [1,2,3] -=- 3