Haskell - How do filter and head work in combination with where? -
Here's the code.
Largest Divisible :: (Integral A) => One of the largest divisible = head (filter p [10000099999 ..]) where p x = x` mod` 3829 == 0
I am a bit confused in this case what is P? Apart from this, I do not have an expression in this particular example, because we have got two exchanges on the left and P and X, and we have an alignment, which is actually a boolean.
I appreciate if someone can interpret the above code.
p
is a function, which is a logic x
accepts and returns true
, if x divides into x 3829. You can use where
to define local code as if you were local By defining "value", you use the same fx = y
syntax to define top-level functions.
Comments
Post a Comment