Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
cd $1
convertdir=`pwd`
cd "$convertdir"
mkdir results
from math import cos, sin, pi
def rotate(pos, theta):
x,y = pos
c = cos(theta)
s = sin(theta)
return (x*c + y*s, x*s - y*c)
# example
module BinaryLogic where
type PVar = Int
data Boolean = T | F deriving Show
data Logic a = Boole Boolean | Var PVar | Conn a (Logic a) (Logic a) deriving Show
type Assignment = (PVar -> Boolean)
foldLogic :: Connective b => (Boolean -> a) -> (PVar -> a) -> (b -> a -> a -> a) -> (Logic b) -> a
subFormulas :: PL -> [PL]
subFormulas = foldLogic
((:[]) . Boole)
((:[]) . Var)
(\p -> Not (head p) : p)
(\c p q -> Conn c (head p) (head q) : (p ++ q))
import Prelude hiding (print, negate)
import Data.List (nub)
data PVar = X Int deriving (Eq,Ord)
x = Var . X
data Connective = And | Or | Imp | Bi
data Boolean = T | F deriving Eq
data PL = Boole Boolean | Var PVar | Not PL | Conn Connective PL PL
type Substitution = (PVar -> PL)
MODULE exp;
IMPORT Out;
PROCEDURE exponent*(x,n: INTEGER):INTEGER;
VAR
y,z,k: INTEGER;
BEGIN
y := 1;
nub :: Eq a => [a] -> [a]
nub = foldr (\x ys->if x `elem` ys then ys else (x:ys)) []
type Perm = [Int]
data Parity = Odd | Even deriving Show
oddtest = [1,3,2,4,5] :: Perm
eventest = [1,4,2,3,5] :: Perm
genPairs :: Int -> [(Int, Int)]
genPairs l = [(a,b) | a <- [1..l], b <- [1..l], a < b]
<html>
<head>
<title>* Gwent Energy CIC *</title>
<link href="gecss.css" rel="stylesheet" type="text/css">
<meta http-equiv="content-type" content="text/html; charset=utf-8">
</head>
<body>
<div id="wrap">
<div id="header">
<img class="logo"
html, body {
background-color: #a0c060;
padding: 0;
}
#wrap {
width: 800px;
margin: 0 auto;
background-color: #80a020;
border: 1px solid black;