Beginner Haskell learner here. I’ve solved Project Euler Problem 1, sum of multiples of 3 or 5 less than 1000, but I’m looking for a “more English-like” functional representation.
I created a function called multiples
multiples::(Integral a) => a -> [a]
multiples a = map (*a) [1..]
which I’m happy with, but I wish I could say
multiples of::(Integral a) => a -> [a]
multiples of a = map (*a) [1..]
to read more like English, but I get a parse error on input `of’
I want my functional declarations to read something like:
sum of multiples of::(Type)=>Type->Type
Any hope?
It’s kind of silly, but you can just define “words”, and ignore the arguments in your “English” function:
However in your example you’re out of luck, as
ofis a keyword (used incase of).By the way, here is another way of defining multiples: