Skip to content

Instantly share code, notes, and snippets.

\sin x = \sum_{i=0}^{\infty}\frac{(-1)^i}{(2i+1)!}x^(2i+1)
import Control.Monad
import Data.Map
import Data.Maybe
newtype Triplet = Triplet (Integer, Integer, Integer)
compositeMany :: Integer -> (a -> a) -> (a -> a)
compositeMany 1 f = f
compositeMany n f = (compositeMany (n - 1) f).f
import Control.Monad
import Data.Map
import Data.Maybe
newtype Triplet = Triplet (Integer, Integer, Integer)
applyMany :: Integer -> (a -> a) -> a -> a
applyMany 0 f a = a
applyMany n f a = applyMany (n - 1) f $! (f a)
import Control.Monad
import Data.Map
import Data.Maybe
data Triplet = Triplet !Integer !Integer !Integer
applyMany :: Integer -> (a -> a) -> a -> a
applyMany 0 f a = a
applyMany n f a = a `seq` applyMany (n - 1) f (f a)
import Control.Monad
import Data.Map
import Data.Maybe
data Triplet = Triplet !(Integer, Integer, Integer)
applyMany :: Integer -> (a -> a) -> a -> a
applyMany 0 f a = a
applyMany n f a = a `seq` applyMany (n - 1) f (f a)
import Control.Monad
import Data.Map
import Data.Maybe
data Triplet = Triplet !(Integer, Integer, Integer)
applyMany :: Integer -> (a -> a) -> a -> a
applyMany 0 f a = a
applyMany n f a = a `seq` applyMany (n - 1) f (f a)
\begin{tikzpicture}
\draw plot[smooth cycle]
coordinates{
(-10:2cm)
(0:3cm) (30:3cm) (60:3cm) (90:3cm) (120:3cm) (150:3cm) (180:3cm) (210:3cm) (240:3cm) (270:3cm) (300:3cm) (330:3cm) (360:3cm)
(10:2cm)
(360:1cm) (330:1cm) (300:1cm) (270:1cm) (240:1cm) (210:1cm) (180:1cm) (150:1cm) (120:1cm) (90:1cm) (60:1cm) (30:1cm) (0:1cm)
};
\end{tikzpicture}
\begin{tikzpicture}[scale=5]
\draw plot [smooth cycle]
coordinates{
(1,-0.1) (1,1) (-1,1) (-1,-1) (1,-1) (1,0.1) (0.5,0)
(0.5,-0.5) (-0.5,-0.5) (-0.5,0.5) (0.5,0.5) (0.5,0)
};
\end{tikzpicture}
\begin{tikzpicture}[xshift=2cm]
\draw (0,0) -- (2,0);
\begin{scope}[xshift=2cm]
import Control.Applicative
main = do
let a = sequence $ repeat getLine
let b = (takeWhile (<5)) <$> ((read <$>) <$> a)
(putStrLn.show) <$> b
return ()
import Foundation
struct Point {
var x : Double;
var y : Double;
init(let inx : Double, let iny: Double){
x = inx;
y = iny;
}
};