To make below listed activites simple (from SCM point of view)
- Adding new features
- Fixing bugs
- Preparing for release
- Deploying to production
- Applying hotfixes
- Versioning
# Problem Statement | |
# cons(a, b) constructs a pair, and car(pair) and cdr(pair) returns the first and last element of that pair. | |
# For example, car(cons(3, 4)) returns 3, and cdr(cons(3, 4)) returns 4. | |
# Given the below implementation for cons( ), please implement car & cdr | |
def cons(a, b): | |
def pair(f): | |
return f(a, b) | |
return pair |
data Point = Pt Int Int | |
data Expr a = Number Integer | Boolean Bool |
{-# LANGUAGE TypeFamilies | |
, DataKinds | |
, PolyKinds | |
, TypeInType | |
, TypeOperators | |
, UndecidableInstances | |
, RankNTypes | |
#-} | |
{-# LANGUAGE RankNTypes #-} | |
module RankN where | |
-- Rank 0: | |
-- add1 is momomorphic | |
add1 :: Int -> Int | |
add1 x = x + 1 | |
-- Rank 1 |
I hereby claim:
To claim this, I am signing this object:
-- 1 + 2 | |
-- (+) 1 2 | |
-- + (Just 1) (Just 2) | |
-- Monadic desugared | |
(Just 1) >>= (\x -> (Just 2) >>= \y -> return (x+y)) | |
-- Monadic sugar |
data Tree a = Empty | Node (Tree a) a (Tree a) | |
deriving (Show) | |
fromList :: [a] -> Tree a | |
fromList xs | |
| null xs = Empty | |
| otherwise = Node (fromList x1) x (fromList x2) | |
where (x1, x:x2) = splitAt (length xs `div` 2) xs | |
inorder :: Tree a -> [a] |