Matthías Páll Gissurarson, @tritlo
Reykjavík Functional Programming
2020-07-31
//PlyReader.js (C) 2014 Matthias Pall Gissurarson. | |
//Partially based on https://github.com/gnomeby/canvas3D, which has no License. | |
/* | |
The MIT License (MIT) | |
Copyright (c) 2014 Matthias Pall Gissurarson | |
Permission is hereby granted, free of charge, to any person obtaining a copy | |
of this software and associated documentation files (the "Software"), to deal | |
in the Software without restriction, including without limitation the rights |
(defclass TailCall [Exception] | |
"An exeception to implement Proper Tail Recursion" | |
[[--init-- | |
(fn [self __TCFunc &rest args &kwargs kwargs] | |
(setv self.func __TCFunc) | |
(setv self.args args) | |
(setv self.kwargs kwargs) | |
nil)]]) | |
(defn TailRec [func] |
{-# LANGUAGE DataKinds #-} | |
{-# LANGUAGE KindSignatures #-} | |
{-# LANGUAGE TypeFamilies #-} | |
module M where | |
import GHC.TypeLits | |
data Merki = Leyndarmál | Opinbert | |
newtype LIO (l :: Merki) a = LIO {unLIO :: IO a} |
Sæktu https://github.com/tritlo/writ-plugin, búðu til nýja möppu sem heitir TestRFP, bættu því við í cabal.project og
afritaðu skjölin hér að ofan í möppuna, og keyrðu svocabal run test_rfp
til að keyra
import Data.Bits | |
printXY n = mapM_ print (gen n) | |
where gen 0 = [""] | |
gen n = map (f n) [0..2^(n-1)] | |
f :: Int -> Integer -> String | |
f n i = map (toXY . testBit i) [0..(n-1)] | |
toXY c = if c then 'X' else 'Y' | |
genRec n = (map ('X':) smaller) ++ (map ('Y':) smaller) | |
where smaller = genRec (n-1) |
import numpy as np | |
from PIL import Image | |
w,h = 384, 384 | |
data = np.zeros((w,h,3), dtype=np.uint8) | |
yellow = [255, 255,0] | |
black = [0,0,0] |
FROM ubuntu:16.04 | |
RUN apt-get update && apt-get install -y curl xz-utils build-essential unzip | |
RUN mkdir -p /rpi/ghc/ \ | |
&& curl -sSL http://releases.mobilehaskell.org/x86_64-linux/9824f6e473/ghc-8.4.0.20180109-arm-linux-gnueabihf.tar.xz -o ghc.tar.xz\ | |
&& tar -xvf ghc.tar.xz -C /rpi/ghc/\ | |
&& rm -f ghc.tar.xz | |
RUN mkdir -p /rpi/prebuilt/ \ |
{-# LANGUAGE TypeInType, TypeOperators, TypeFamilies, | |
UndecidableInstances, ConstraintKinds #-} | |
module ONotation where | |
import GHC.TypeLits as L | |
import Data.Type.Bool | |
import Data.Type.Equality | |
-- Simplistic asymptotic polynomials | |
data AsymP = NLogN Nat Nat |
{-# LANGUAGE GADTs #-} | |
import Data.List | |
import Data.Monoid | |
import Data.Typeable | |
import Data.Dynamic | |
import GHC.Err | |
import GHC.Prim |