This file contains hidden or 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
type HashTable s k v = C.HashTable s k v | |
type Stone = Int | |
type Memo s = HashTable s (Stone, Int) Int | |
solvePart2 :: BS.ByteString -> Result | |
solvePart2 contents = | |
Result $ runST $ do | |
memo :: Memo s <- H.new |
This file contains hidden or 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 itertools | |
program = [2, 4, 1, 3, 7, 5, 0, 3, 1, 5, 4, 1, 5, 5, 3, 0] | |
rp = list(reversed(program)) | |
def calc(ta): | |
b = (ta & 0b111) ^ 0b011 # Look at the 3 rightmost bits of "ta" | |
c = ( |
This file contains hidden or 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
module Main (main) where | |
import Control.Exception (bracket, bracket_) | |
import Control.Monad (unless, when) | |
import Control.Monad.IO.Class () | |
import Control.Monad.Managed | |
import DearImGui | |
import DearImGui.OpenGL3 | |
import DearImGui.SDL | |
import DearImGui.SDL.Renderer |
This file contains hidden or 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
main :: IO () | |
main = do | |
evalContT $ do | |
a <- ContT $ withFile "a.txt" ReadMode | |
b <- ContT $ withFile "b.txt" ReadMode | |
aContents <- liftIO $ hGetContents a | |
bContents <- liftIO $ hGetContents b | |
liftIO . putStrLn $ "contents of a: " <> show aContents | |
liftIO . putStrLn $ "contents of b: " <> show bContents |
OlderNewer