This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ι(ι(ι(ιι)))(ι(ι(ι(ιι)))(ι(ι(ιι))(ι(ι(ι(ιι)))(ιι)(ι(ι(ιι))(ι(ι(ι(ιι)))(ι(ι(ι(ιι)))(ι(ι(ιι))(ι(ι(ι(ιι)))))(ι(ι(ι(ιι)))(ι(ι(ιι))(ι(ι(ι(ιι)))(ι(ι(ιι))(ι(ι(ι(ιι)))))))(ι(ι(ι(ιι)))(ι(ι(ιι))(ι(ι(ι(ιι)))(ι(ι(ιι))(ι(ι(ι(ιι)))(ι(ι(ιι))(ι(ι(ι(ιι)))))))))(ι(ι(ι(ιι)))(ι(ι(ιι))(ι(ι(ι(ιι)))(ι(ι(ιι))(ι(ι(ι(ιι)))(ι(ι(ιι))(ι(ι(ι(ιι)))(ι(ι(ιι))(ι(ι(ι(ιι)))))))))))(ι(ι(ι(ιι)))(ι(ι(ιι))(ι(ι(ι(ιι)))(ι(ι(ιι))(ι(ι(ι(ιι)))(ι(ι(ιι))(ι(ι(ι(ιι)))(ι(ι(ιι))(ι(ι(ιι))))))))))(ι(ι(ι(ιι)))(ι(ι(ιι))(ι(ι(ι(ιι)))(ι(ι(ιι))(ι(ι(ι(ιι)))(ι(ι(ιι))(ι(ι(ι(ιι)))(ι(ι(ιι))(ι(ι(ι(ιι)))))))))))(ι(ι(ι(ιι)))(ι(ι(ιι))(ι(ι(ι(ιι)))(ι(ι(ιι))(ι(ι(ι(ιι)))(ι(ι(ιι))(ι(ι(ι(ιι)))(ι(ι(ιι))(ι(ι(ιι))))))))))(ι(ι(ι(ιι)))(ι(ι(ιι))(ι(ι(ι(ιι)))(ι(ι(ιι))(ι(ι(ι(ιι)))(ι(ι(ιι))(ι(ι(ι(ιι)))(ι(ι(ιι))(ι(ι(ι(ιι)))))))))))(ι(ι(ι(ιι)))(ι(ι(ιι))(ι(ι(ι(ιι)))(ι(ι(ιι))(ι(ι(ι(ιι)))(ι(ι(ιι))(ι(ι(ι(ιι)))(ι(ι(ιι))(ι(ι(ιι))))))))))(ι(ι(ι(ιι)))(ι(ι(ιι))(ι(ι(ι(ιι)))(ι(ι(ιι))(ι(ι(ι(ιι)))(ι(ι(ιι))(ι(ι(ι(ιι)))(ι(ι(ιι))(ι(ι(ι(ιι)))))))))))(ι(ι(ι(ιι)))(ι(ι(ιι))(ι(ι(ι(ιι)))(ι(ι(ιι))(ι(ι(ι(ιι)))(ι(ι(ιι) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE TemplateHaskell #-} | |
module Functions where | |
import FunctionsTemplate (generateFunctions) | |
generateFunctions |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Normal if statement, requires brackets or associative operators for nesting. | |
if' :: Bool -> a -> a -> a | |
if' b x y = if b then x else y | |
{- | |
Magic if statement, no brackets needed. | |
`magicIf` and `magicElseIf` pass on a function, that is either `id` or | |
`const x` saying what to do when a True or Else case is reached, to the next | |
`magicElseIf` or `magicElse`. | |
-} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import qualified DP | |
import Data.Map ((!)) | |
nextSubproblem :: DP.DPCalc Int Int () Int | |
nextSubproblem = do | |
this <- DP.thisSubproblem | |
return (this + 1) | |
subproblemSolver :: DP.DPCalc Int Int () Int | |
subproblemSolver = do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE TypeOperators, ExplicitNamespaces #-} | |
module Rates ( | |
Rate(..), | |
(&*), | |
rev, | |
(&/), | |
RatRate, | |
type (//) | |
) where |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SET POS 0 TO 2 | |
++ | |
WHILE POS 0 ISNT 0 | |
[ | |
SET POS 1 TO 2 | |
>++< | |
SET POS 2 TO POS 0 MINUS POS 1 | |
[->>+>+<<<]>>>[-<<<+>>>]<<[->->+<<]>>[-<<+>>]<<< | |
WHILE POS 1 ISNT POS 0 (POS 2 ISNT 0) | |
>>[<< |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
WHILE INPUT IS NONZERO | |
,[ | |
MOVE TO LEFT ELEMENT | |
<< | |
WHILE LEFT ELEMENT EXISTS | |
[ | |
ORDER POS 0 AND POS 2 WITH SMALLEST ON RIGHT | |
USING POS 0 & 1 & 2 & 3 & 5 & 7 | |
WHILE POS 0 ISNT 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
LOOP FOREVER | |
+[- | |
LOAD FIRST INPUT IN POS 0 & SECOND IN POS 1 | |
,>,< | |
WHILE POS 0 ISNT 0 | |
[ | |
MOVE TO POS 1 & COPY VALUE TO POS 3 & 4 | |
>[->>+>+>+<<<<]>>>>[-<<<<+>>>>]<<<< | |
MOVE TO POS 3 | |
>> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE RankNTypes #-} | |
module UnionFind ( | |
Getter, | |
Setter, | |
UnionFind, | |
UnionFindS, | |
new, | |
find, | |
union, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> let proplist = ((\x -> conj (prop $ 'a':show x) (prop $ 'b':show x)) <$> [0..2]) | |
> putStr . unlines $ fancyRender id <$> proplist | |
a0 ∧ b0 | |
a1 ∧ b1 | |
a2 ∧ b2 | |
> putStrLn $ fancyRender (either (('t':).show) id) $ disjSmall proplist | |
(¬t0 ∨ a0) ∧ (¬t0 ∨ b0) ∧ (¬t1 ∨ a1) ∧ (¬t1 ∨ b1) ∧ (¬t2 ∨ a2) ∧ (¬t2 ∨ b2) ∧ (t0 ∨ t1 ∨ t2) | |
> putStrLn $ fancyRender id $ foldl1 disjBig proplist | |
(a0 ∨ a1 ∨ a2) ∧ (a0 ∨ a1 ∨ b2) ∧ (a0 ∨ a2 ∨ b1) ∧ (a0 ∨ b1 ∨ b2) ∧ (a1 ∨ a2 ∨ b0) ∧ (a1 ∨ b0 ∨ b2) ∧ (a2 ∨ b0 ∨ b1) ∧ (b0 ∨ b1 ∨ b2) |