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
for haskell repl: | |
:set prompt "\ESC[34mλ> \ESC[m" | |
for python repl: | |
sys.ps1 = '\x01\x1b[1;49;31m\x02λ>\x01\x1b[0m\x02' | |
sys.ps2 = '\x01\x1b[1;49;31m\x02λ>\x01\x1b[0m\x02' |
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
fif() { | |
rg \ | |
--column \ | |
--no-heading \ | |
--fixed-strings \ | |
--ignore-case \ | |
--hidden \ | |
--follow \ | |
--glob '!.git/*' \ | |
--glob '!.vscode-server/*' \ |
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
-- video https://youtu.be/uj2N5fBZnCA | |
import Data.Array.MArray | |
import Data.Array.IO.Internals (IOArray(IOArray)) | |
import Control.Monad.ST | |
import Data.Array.ST | |
workio = do | |
a <- newArray (0,3) 'a' :: IO ( IOArray Int Char) | |
writeArray a 3 'x' | |
a_ <- getAssocs a |
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
-- video https://youtu.be/RPEtIZ44RSc | |
import Data.Array.IArray | |
import Data.Char (toUpper) | |
-- elements that is associated with some kind of numerical index | |
-- truly constant time (O(1)) access. | |
-- store their data more efficiently in memory. | |
-- modification function must create an entirely new array (partially can be fixed with Monad context) | |
-- math look: |
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
-- video https://www.youtube.com/watch?v=9JDPGvc6UmI | |
import Control.Monad.ST | |
import Data.IntMap.Strict | |
import Data.STRef (newSTRef, readSTRef, writeSTRef, modifySTRef) | |
import Control.Monad | |
until_ :: Monad m => m a -> m Bool -> m () | |
until_ a p = do | |
a | |
b <- p |
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
-- see video https://www.youtube.com/watch?v=MJscn-m4KIo&t=3943s | |
import Data.STRef | |
import Control.Monad.ST | |
import Data.Maybe | |
import Control.Monad | |
import Data.Either (fromRight, isLeft, fromLeft) | |
import Debug.Trace | |
data Llist s a = Llist {llen:: STRef s Int, lhead:: STRef s (Maybe (Node s a)) } |
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
-- explain video https://youtu.be/Ln_tVErialQ | |
-- GHCi, version 8.8.4 | |
{-# LANGUAGE RankNTypes #-} | |
{-# LANGUAGE TypeOperators #-} | |
{-# OPTIONS_GHC -Wno-incomplete-patterns #-} | |
import PrettyT -- https://www.youtube.com/watch?v=Ud-1Z0hBlB8&t=379s | |
-- data Btree a = Empty | Node a (Btree a) (Btree a) deriving Show | |
import Data.Ord | |
import Data.List |
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
-- video https://youtu.be/E8Fxtpr24Zg | |
-- GHCi, version 8.8.4 | |
{-# LANGUAGE RankNTypes #-} | |
{-# LANGUAGE TypeOperators #-} | |
{-# OPTIONS_GHC -Wno-incomplete-patterns #-} | |
import PrettyT -- https://www.youtube.com/watch?v=Ud-1Z0hBlB8&t=379s | |
-- data Btree a = Empty | Node a (Btree a) (Btree a) deriving Show | |
import Data.Ord | |
import Data.List |
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
-- video https://www.youtube.com/watch?v=nckWiHmeNXU&feature=youtu.be | |
{-# LANGUAGE RankNTypes #-} | |
-- GHCi, version 8.8.4 | |
-- data Btree a = Empty | Node a (Btree a) (Btree a) deriving Show | |
-- https://www.youtube.com/watch?v=Ud-1Z0hBlB8&t=379s | |
-- data Btree a = Empty | Node a (Btree a) (Btree a) deriving Show | |
{-# OPTIONS_GHC -Wno-incomplete-patterns #-} | |
import PrettyT -- https://www.youtube.com/watch?v=Ud-1Z0hBlB8&t=3s | |
import Data.List.Split (chunksOf, whenElt) |
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
-- GHCi, version 8.8.4 | |
-- data Btree a = Empty | Node a (Btree a) (Btree a) deriving Show | |
import PrettyT -- https://www.youtube.com/watch?v=Ud-1Z0hBlB8&t=379s | |
import Data.Hashable | |
import Data.List.Split | |
h v = show $ hash v | |
merkle :: (String -> String) -> [String] -> Btree String | |
merkle h d = go nl |
NewerOlder