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
# Tetrahedron | |
# volume = 1/6 | |
# area = (3 + sqrt 3)/2 | |
tetrahedronMesh = | |
let vmap = [ 0. 1. 0. 0. | |
; 0. 0. 1. 0. | |
; 0. 0. 0. 1. | |
] | |
fmap = [ 0 0 0 1 |
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
#!/usr/bin/env bash | |
PROFILE_PATH=/nix/var/nix/profiles | |
get_list() { | |
find $PROFILE_PATH -type l \ | |
| awk "match(\$0, /^${PROFILE_PATH//\//\\\/}\/system-([0-9]*)-link\$/, res) { print res[1] }" \ | |
| sort | |
} | |
get_current() { |
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
{ | |
inputs = { | |
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; | |
flake-utils.url = "github:numtide/flake-utils"; | |
}; | |
outputs = { self, nixpkgs, flake-utils }: | |
flake-utils.lib.eachDefaultSystem (system: | |
let | |
pkgs = import nixpkgs { inherit system; }; |
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
{-# LANGUAGE KindSignatures #-} | |
{-# LANGUAGE GADTs #-} | |
module Main where | |
import GHC.Types | |
import Control.Monad | |
type Coffee = Integer | |
type Work = Integer |
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
{-# LANGUAGE ExplicitForAll #-} | |
{-# LANGUAGE ScopedTypeVariables #-} | |
module Rose where | |
data Tree a = Node a [Tree a] deriving (Eq, Show) | |
t1 :: Tree Int | |
t1 = Node 1 | |
[ Node 2 |
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
{ stdenv, coq }: | |
stdenv.mkDerivation { | |
pname = "coq${coq.coq-version}-coq-menhirlib"; | |
version = "20211125"; | |
src = builtins.fetchTarball { | |
url = "https://gitlab.inria.fr/fpottier/menhir/-/archive/20211125/archive.tar.gz"; | |
sha256 = "0ls13myx5g4d32rq5prnikql0wvsrisll88xhbwi3w9v13lwnal0"; | |
}; | |
buildInputs = [ coq ]; |
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
fmap2 :: (Functor f1, Functor f2) => (a -> b) -> f1 (f2 a) -> f1 (f2 b) | |
fmap2 = fmap . fmap | |
for :: Functor f => f a -> (a -> b) -> f b | |
for = flip fmap | |
infixr $: | |
($:) :: (Functor f, Functor g) => f (g a) -> (a -> b) -> f (g b) | |
($:) = flip fmap2 |
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
{-# LANGUAGE StandaloneDeriving #-} | |
{-# LANGUAGE DeriveFunctor #-} | |
{-# LANGUAGE MultiParamTypeClasses #-} | |
{-# LANGUAGE FunctionalDependencies #-} | |
{-# LANGUAGE PatternSynonyms #-} | |
{-# LANGUAGE ViewPatterns #-} | |
{-# LANGUAGE LambdaCase #-} | |
module Fibonacci where |
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
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 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
#include <iostream> | |
#include <vector> | |
#include <complex> | |
#include <cmath> | |
#include <cstdint> | |
#include <immintrin.h> | |
const uint8_t flip_nibble[16] = { | |
0, 8, 4, 12, |