From 77c5e06333999306829742dd90db5f0837448cd7 Mon Sep 17 00:00:00 2001 From: Hammy Date: Sun, 4 Apr 2021 23:07:49 +0100 Subject: [PATCH] Using Lambdas --- Unit 1/Lesson 4/firstClassFunctions.hs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Unit 1/Lesson 4/firstClassFunctions.hs b/Unit 1/Lesson 4/firstClassFunctions.hs index f363d32..4e4be99 100644 --- a/Unit 1/Lesson 4/firstClassFunctions.hs +++ b/Unit 1/Lesson 4/firstClassFunctions.hs @@ -10,10 +10,11 @@ isEven myFunction x = if even x then myFunction x else x - ifEvenDouble :: Integral p => p -> p ifEvenDouble x = isEven double x ifEvenInc :: Integral p => p -> p ifEvenInc x = isEven inc x ifEvenSquare :: Integral p => p -> p -ifEvenSquare x = isEven square x \ No newline at end of file +ifEvenSquare x = isEven square x +ifEvenCube :: Integral a => a -> a +ifEvenCube x = isEven (\x -> x ^ 3) x \ No newline at end of file