Haskell, passing a function to filter in one line? -


I want to filter everything that is not divided by 3 from a list in Hassel, it is technically I What to do

  Filters (`mod` 3) [1..100]   

The problem is that, mod x 3 returns a boolean value Will not it be a way of doing it in a row? Or do I need to type another function that gives boolean values? I have read about the CURD Functions, but I am not sure if this is possible because if I used (==) AB and a function, it would not work just.

You can use dot notation

  filter ( == 0). (`Mod`3)) [1..100]   

generates it

  [3,6 9, 12 , 15, 18, 21, 24, 27, 30,33,36,39,42,45,48,51,54,57,60,63,66,69,72,75,78,81,84,87 , 90,93,96,99]   

Dot type signatures are as follows:

  (.) :: (b -> c) - & gt; (A -> B) - & gt; A - & gt; C    

Comments

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

java - JPA TypedQuery: Parameter value element did not match expected type -

c++ - static template member variable has internal linkage but is not defined -