I think you just need all : Prelude> :t all all :: (a -> Bool) -> a -> Bool Prelude> all (>0) -10..10 False Prelude> all (>0) 1..10 True Or, if you want, you can do: Prelude> let f1 x = x > 5 && x let func xs = all f1 xs Prelude> func 6..9 True Prelude> func 1..10 False which allows you to create a function f1 to do a complex check. In any case, you can use all for your func.
I think you just need all: Prelude> :t all all :: (a -> Bool) -> a -> Bool Prelude> all (>0) -10..10 False Prelude> all (>0) 1..10 True Or, if you want, you can do: Prelude> let f1 x = x > 5 && x let func xs = all f1 xs Prelude> func 6..9 True Prelude> func 1..10 False which allows you to create a function f1 to do a complex check. In any case, you can use all for your func.
Actually I have a complex pattern checking in ff1 so this is not suitable :) – Sudantha Jun 8 at 11:50 @Sudantha: I edited my answer to address your comment :) – MarcoS Jun 8 at 11:55 all f1 xs is the answer without parenthesis :-) – Sudantha Jun 8 at 12:02 1 Pointlessly: func = all f1 – Dan Burton Jun 8 at 21:23.
This should work: func ls = all ff1 ls Or this: func ls = and (map ff1 ls).
Nope :-( it not working! – Sudantha Jun 8 at 11:49 @Sudantha Can you give an example of input it doesn't work for, and the output that should be generated instead? Landei's answer should work for your question as I understand it, so perhaps we misunderstand your question.
Could you expand it with example input and example output please? – dave4420 Jun 8 at 11:58 Yes, I tried it out in GHCI, and it worked. Note that I edited the question, as ff1 j > 0 = True made no sense at all, and a =was missing in func.
– Landei Jun 8 at 12:15.
Maybe something like this -- assuming you wish to perform an "and" between all Bool results. Func::Int->Bool func = True func (l:ls) = ff1 (l) && func (ls) ff1::Int->Bool ff1 j = j > 0 main = do let a = func -1, -2, 1, 2, 3 print a.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.