Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- unitaryN :: Int ->[[Int]]
- unitaryN n=[[ if i==j then 1 else 0 |i <- [1..n]]| j<-[1..n]]
- myNu :: Int -> String
- myNu 5 = "Happy Child"
- myNu 10 = "Some troubles?"
- myNu 17 = "I want to travel"
- myNu 20 = "The world is mine"
- myNu x = "I do not know this number"
- age :: Int -> String
- age x
- | x<=0 = "Wrong age!"
- | x< 7 = "Sweet child"
- | x<18 = "Youth"
- | otherwise = "Work"
- disc :: Double -> Double
- disc r = pi*r*r
- disc' r = pi*sq -- We can use prim ' on the name as have disc2 or 1
- where
- sq=r*r
- disc'' r =
- let
- sq=r*r
- in pi*sq
- --charN :: Int -> String -> Char
- charN n s = s !! (n-1)
- second (a,b,c) = b
- second' (_,b,_) = b
- pair [] _ = (0,0)
- pair _ [] = (0,0)
- pair x y = (head x, last y)
- {-
- Ex. 2.
- =======
- Define two lists: listA, listB;
- listA is a list of 6 ordered pairs of strings - names and surnames of certain people;
- listB consists of two-digit numbers with the digits of tens 3, 5 or 7 and the digits of unity 3 or 4.
- a) Define the list named listA1 consisting only of the names from the list listA.
- b) Define the list named listA2 consisting only of the surnames from the list listA.
- c) Define the list named people - the list of triples of all possible systems (name, surname, age), where the age is from listB.
- -}
- listA = [ ("Nicolas", "Mazard") , ("Manuel", "Curral")]
- listA1' = map fst ListA
- listB = [10*a+b|a<-[3,5,7],b<-[3,4]]
- --write ListA2
- people = [(n,s,a)| n<-ListA1,s<-ListA2,q<-ListB]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement