Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Haskell lists difference

Tags:

I'm trying make a lists difference. Found directly prelude operator \\\\ that makes lists difference. But errors Not in scope: '\\\\' occurs. Here is my simple from command line interpreter:

Prelude>  ([1,2,3] ++ [5,6])   -- works like expected
[1,2,3,4,5,6]

prelude>  ([1,2,3] \\\\ [1,2])   -- erros occurs
<interactive>:1:11: Not in scope: "\\\\"

Thanks for explanation where I make a mistake.

like image 751
user559354 Avatar asked Jan 01 '11 09:01

user559354


1 Answers

It's \\, not \\\\. You also need to import Data.List.

Prelude List> import Data.List
Prelude List> ([1,2,3] \\ [1,2])
[3]
like image 177
moinudin Avatar answered Sep 30 '22 19:09

moinudin