Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Haskell Code please solve ASAP 1. Define a function max3 :: Int -> Int -> Int -> (Int, Int, Int) that orders the three inputs,
Haskell Code please solve ASAP
1. Define a function max3 :: Int -> Int -> Int -> (Int, Int, Int) that orders the three inputs, e.g., max3 2 1 4(1,2,4) and max3 5 1 3(1,3,5) 2. Write a function iss?rted using recursion and pattern matching that checks whether a given 1ist of integers is sorted, e.g. isSorted [1,2,3,3,5,6] - True and isSorted [1,2,4,3,5,6]-False 3. A triple (x,y, z) of positive integers is called pythagorenan if x^2 + y^2-z"2. Using list comprehension, define a function pyths :: Int-> (Int, Int, Int)] that returns the list of all pythagorenian triples whose components are less or equal the given limit, e.g., pyths 10[ (3,4,5), (4,3,5), (6, 8,10), (8,6,10)] 4. Write a function sqrAlll : [Int] -> [Int] that squares al1 numbers in a list using list comprehension, e.g., sqrAll1 5. Use list comprehension in order to define a function addPairs :: [Int] -> [Int] -> [Int] that addPairs 11 12 contains all sums of the even elements from 11 and the odd elements from 12 Examples: addPairs [1..4] [1..4[3,5,5,7] addPairs [2, 5, 8] [5, 1,2] [7, 3, 13, 9]Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started