שפת Haskell שאלה:
ניתנת פיסת הקוד הבאה:
safetail (_ : xs)
| null xs = []
| otherwise = tail xs
לאחר קומפילציה, מתקבלת ההודעה הבאה:
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
[1 of 1] Compiling Main ( safetail.hs, interpreted )
safetail.hs:1:1: Warning:
Top-level binding with no type signature:
safetail :: forall t. [t] -> [t]
safetail.hs:1:1: Warning:
Pattern match(es) are non-exhaustive
In an equation for `safetail': Patterns not matched: []
Ok, modules loaded: Main.
*Main>
השאלה: על מה מתלונן הקומפיילר פה,(מה מפריע לו):
Warning:
Pattern match(es) are non-exhaustive
In an equation for `safetail': Patterns not matched: []
ניתנת פיסת הקוד הבאה:
safetail (_ : xs)
| null xs = []
| otherwise = tail xs
לאחר קומפילציה, מתקבלת ההודעה הבאה:
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
[1 of 1] Compiling Main ( safetail.hs, interpreted )
safetail.hs:1:1: Warning:
Top-level binding with no type signature:
safetail :: forall t. [t] -> [t]
safetail.hs:1:1: Warning:
Pattern match(es) are non-exhaustive
In an equation for `safetail': Patterns not matched: []
Ok, modules loaded: Main.
*Main>
השאלה: על מה מתלונן הקומפיילר פה,(מה מפריע לו):
Warning:
Pattern match(es) are non-exhaustive
In an equation for `safetail': Patterns not matched: []