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
| newtype Doggo = BigOl Pupper | |
| newtype Pupper = Tiny Doggo |
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
| data List a = Nil | Cons a (List a) | |
| map :: (a -> b) -> List a -> List b | |
| map f Nil = Nil | |
| map f (Cons x xs) = Cons (f x) (map f xs) |
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 DeriveFunctor, DeriveFoldable, PatternSynonyms #-} | |
| import Graphics.Gloss (animate, Display(InWindow), white, Picture(Polygon)) | |
| import Data.Bifunctor (bimap) | |
| import Data.Monoid ((<>)) | |
| import Data.Foldable (fold) | |
| data TriTree a = Branch (TriTree a) (TriTree a) (TriTree a) | Leaf a deriving (Functor, Foldable) | |
| instance Applicative TriTree 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
| {-# LANGUAGE ConstraintKinds, DeriveFunctor #-} | |
| import Text.Printf (printf) | |
| import Data.Foldable (fold) | |
| import Data.Bifunctor (bimap) | |
| import Data.Monoid ((<>)) | |
| type PolynomialAble pow num = (Integral pow, Floating num) | |
| data Monomial pow = Ln | ToThe pow deriving (Functor, Eq, Show) |
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 GADTs, ConstraintKinds, KindSignatures #-} | |
| module CList (CList(..)) where | |
| import GHC.Exts (Constraint) | |
| infixr 9 `Cons` | |
| data CList :: (* -> Constraint) -> * where | |
| Nil :: CList k | |
| Cons :: k x => x -> CList k -> CList k |
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
| #lang s-exp "./stlc-core.rkt" | |
| (define x : Nat 5) | |
| (S x) |
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
| public static String repeat(String orig, int n) throws IllegalArgumentException { | |
| if(n < 0) throw new IllegalArgumentException("Argument was negative"); | |
| else if(n == 0) return ""; | |
| else if(n == 1) return orig; // this removes the need for 2 unneeded concatenations | |
| else if(n % 2 == 0) return repeat(orig + orig, n / 2); | |
| else return orig + repeat(orig + orig, n / 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
| public static int mystery6(int n, int k) { | |
| if(n == k || k == 0) return 1; | |
| return mystery6(n-1,k-1) + mystery6(n-1,k); | |
| } |
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
| ;;; pink-bliss.el --- a pink color theme for Emacs | |
| ;; Copyright (C) 2005–2015 Alex Schroeder <[email protected]> | |
| ;; This file is not part of GNU Emacs. | |
| ;; This is free software; you can redistribute it and/or modify it under | |
| ;; the terms of the GNU General Public License as published by the Free | |
| ;; Software Foundation; either version 2, or (at your option) any later | |
| ;; version. |
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 <stdio.h> | |
| #include <stdlib.h> | |
| #include <time.h> | |
| #define TRIALS 10000000 | |
| // double in range -1 to 1 | |
| #define RANDVAR() ((double)rand() / RAND_MAX * 2.0 - 1.0) | |
| double trial(void); |