我一直在学习一些哈斯凯尔(Haskell)程序, 并写一些非常简单的程序。 我想做一个功能, 返回给定位置的元素 。 以下是我试图做的...
elempos::Int->[a]->a
elempos n (b:_)=head (drop n (b:_) )
但是当我在GHCi编辑器上加载测试.hs文件时,我就会发现这个错误。
Pattern syntax in expression context: _
And it says Failed, modules loaded:none. Since I m very new to the language I don t really have a proper idea what the mistake is(currently at chapter 4 of learn you a haskell). Can anyone tell me what is wrong here?