You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to
Hello Geniuses!
I am beginner in haskell and going through learn you a haskell.
In recursion chapter, there is an implementation of take function. I am trying to implement it another way but keep getting compiler error "Not in scope: 'as'"
Here is the code:
take' :: Int -> [a] -> [a]
take' _ [] = []
take' x _
| x _ <= 0 = []
| otherwise x (a:as) = a : take' (x-1) as
Can someone tell me what is wrong with this program?
Abhinav Gogna
unread,
Dec 20, 2014, 2:15:11 PM12/20/14
Delete
You do not have permission to delete messages in this group
Copy link
Report message
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to
I figured it out. I had to pass it before the guards.
Here is the code:
take'' :: Int -> [a] -> [a]
take'' _ [] = []
take'' x (a:as)
| x <= 0 = []
| otherwise = take' (x-1) as