mirror of
https://github.com/Noratrieb/idris-learning.git
synced 2026-01-14 13:05:02 +01:00
ch3
This commit is contained in:
parent
c52bc19021
commit
940f03eb01
1 changed files with 15 additions and 0 deletions
15
chapter3/PatternMatching.idr
Normal file
15
chapter3/PatternMatching.idr
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
module Main
|
||||
|
||||
surrond_with_braces : String -> String
|
||||
surrond_with_braces x = "{" ++ x ++ "}"
|
||||
|
||||
allLengths : List String -> List Nat
|
||||
allLengths strs = map length strs
|
||||
|
||||
invert : Bool -> Bool
|
||||
invert True = False
|
||||
invert False = True
|
||||
|
||||
describeList : Show a => List a -> String
|
||||
describeList [] = "Empty"
|
||||
describeList (x :: xs) = "Non-empty (" ++ show x ++ "), tail = " ++ show xs
|
||||
Loading…
Add table
Add a link
Reference in a new issue