-- Cooment --
{-
Multiline
-}
import Data.List
import System.IO
-- Int -- -2^63 2^63
maxInt = maxBound :: Int
minInt = minBound :: Int
-- Integer --
sumNumber = sum[1..1000]
sqrt16 = sqrt(fromIntegral 16)
primeNumber = [3,5,7,11]
-- conact list --
morePrimes = primeNumber ++ [13, 17, 19, 23, 29]
-- const operator for list --
{-- Cons operator very important / also called as : Operator --}
list = 2 : 3 : 5 : 7 : 9: []
-- Multilist --
multiList = [[1,2,3,4,5], [6,7,8,9,11]]
morePrimse2 = 2 : morePrimes
lenPrime = length morePrimse2
revPrime = reverse morePrimse2
isListEmpty = null revPrime
index2OfMorePrime = morePrimse2 !! 2
headOfrevPrime = head revPrime
lastOfrevPrime = last revPrime
-- Everything but the last value of revPrime --
revInit = init revPrime
-- Firs three Primes --
first3RevPrime = take 3 revPrime
-- remove 3 primes --
removed3Primes = drop 3 revPrime
is7inRevPrimes = 7 `elem` revPrime
is2inRevPrimes = 2 `elem` revPrime
maxValInPrime = maximum revPrime
minValInPrime = minimum revPrime
sumOfallRevPrime = sum revPrime
{-- Product of the value of the list,
A product of the value of the list is
a sum of all the values all can evenly divide by
--}
newList = [2,3,4]
productNewList = product newList
generateList = [0..100]
revGeneratedList = reverse generateList
genEventList = [2,4..100]
genOddList = [3,5..100]
-- Character list --
genCharList = ['A', 'C'..'Z']
genCharList2 = ['B', 'D'..'Z']
smallCharList = ['a'..'z']
infiniteList = [1..]
many2s = take 10 (repeat 2)
many3s = replicate 10 3
--cycle rev prime --
cycleRevPrime = take 20 (cycle revPrime)
-- manipulating list elements --
listTimes2 = [x * 2 | x <- [1..100], x * 2 <= 50]
listDivBy2And9 = [x | x <- [1..500], x `mod` 2 == 0, x `mod` 9 == 0]
workOnExistingList = [x * 2 | x <- revPrime, x * 2 <= 100]
workOnExisitingList2 = [x | x <- revPrime, x `mod` 2 == 0]
sumOf2Lists = zipWith (+) revPrime morePrimse2
listBiggerThan10 = filter (>10) revPrime
evensUpTo50 = takeWhile (<= 50) [2, 4..]
multiPleOflistFromLeft = foldl (*) 1 [2,10, 20]
substractionOfListFromRight = foldr (-) 0 [2, 9, 16, 90]
powerOf3RevPrime = [3^n | n <- revPrime]
multTable = [[x * y | y <- morePrimse2] | x <- revPrime]
multTable2 = [[x * y | y <- [2,4..20]] | x <- [3, 5..20]]
-- Tuples --
ranTuple = ("1", 32)
-- Tuple pair --
rehanKodekar = ("Rehan Kodekar", 27)
rehanSname = fst rehanKodekar
rehanSage = snd rehanKodekar
names = ["Rehan", "Asgar", "Saad"]
ages = [27, 28, 27]
namesAge = zip names ages