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
#!/usr/bin/env bash | |
set -ex pipefile | |
cd "$HOME" || exit | |
cabal new-update | |
cabal new-install hscolour | |
rm -f "$HOME/.local/bin/cabal" "$HOME/.cabal/bin/cabal" | |
rm -rf "$HOME/.ghcjs" | |
cabal new-install cabal-install --constraint='cabal-install == 1.24.0.2' -w ghc-8.0.2 |
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 <errno.h> | |
#include <stdbool.h> | |
#include <stdio.h> | |
#include <string.h> | |
#include <sys/mman.h> | |
#include <unistd.h> | |
int getpagesize(void); | |
void n_primes(int); |
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
#!/usr/bin/env bash | |
# forked from Moritz Angerman https://github.com/angerman/haskell-to-web/blob/master/ghcjs-build-notes.org | |
set -e pipefail | |
cabal new-install happy --overwrite-policy=always | |
cabal new-install alex --overwrite-policy=always | |
cabal new-install hscolour --overwrite-policy=always | |
cabal new-install hsc2hs --overwrite-policy=always |
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 cowsay = | |
λ(txt : Text) → | |
'' | |
${txt} | |
------ | |
\ ^__^ | |
\ (oo)\_______ | |
(__)\ )\/\ | |
||----w | |
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
NB. I used https://towardsdatascience.com/implementing-the-xor-gate-using-backpropagation-in-neural-networks-c1f255b4f20d | |
NB. input data | |
X =: 4 2 $ 0 0 0 1 1 0 1 1 | |
NB. target data, ~: is 'not-eq' aka xor | |
Y =: , (i.2) ~:/ (i.2) | |
scale =: (-&1)@:(*&2) |
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
-- cypm add fl-parser | |
-- ported from: https://www-ps.informatik.uni-kiel.de/~cpm/DOC/fl-parser-3.0.0/Parser_curry.html | |
import Parser | |
num = Parser.some digit l >>> numeric_value l | |
where l free | |
numeric_value ds = foldl1 (\acc x -> 10*acc+x) (map (\c -> ord c-ord '0') ds) | |
expr = term m Parser.<*> terminal '+' Parser.<*> expr n >>> m+n | |
<||> term m Parser.<*> terminal '-' Parser.<*> expr n >>> m-n |