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
replicate2 :: Int -> a -> a -> [a] | |
replicate2 n x y = as where | |
(as, bs) = go n bs [] | |
go 0 as bs = (as, bs) | |
go n as bs = go (n-1) (x:as) (y:bs) |
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
#include <iostream> | |
#include <vector> | |
#include <complex> | |
#include <cmath> | |
#include <cstdint> | |
#include <immintrin.h> | |
const uint8_t flip_nibble[16] = { | |
0, 8, 4, 12, |
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 DNEtoEM where | |
data Bottom | |
type Not a = a -> Bottom | |
type DNE = forall a. Not (Not a) -> a | |
type EM = forall a. Either a (Not 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
module Sort where | |
import Control.Monad.ST | |
import Data.Vector as V | |
import Data.Vector.Mutable as MV | |
sort :: Ord a => Vector a -> Vector a | |
sort v = | |
if V.length v <= 1 then | |
v |
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 Data.Monoid | |
import Data.Functor.Const | |
powf :: (a -> a) -> Int -> a -> a | |
powf f n = (appEndo . getConst . replicateM_ n . Const . Endo) f |
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 | |
kime = import ./pkgs/kime.nix; | |
gtk3_cache = pkgs.runCommand "gtk3-immodule.cache" | |
{ preferLocalBuild = true; | |
allowSubstitutes = false; | |
buildInputs = [ pkgs.gtk3 kime ]; | |
} | |
'' | |
mkdir -p $out/etc/gtk-3.0/ | |
GTK_PATH=${kime}/lib/gtk-3.0/ gtk-query-immodules-3.0 > $out/etc/gtk-3.0/immodules.cache |
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 BangPatterns #-} | |
{-# LANGUAGE ScopedTypeVariables #-} | |
module Automaton where | |
import Data.Maybe | |
import Data.Map as M | |
import Data.Set as S | |
import Data.IntMap as IM | |
import Data.IntSet as IS |
NewerOlder