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
| /* Idiomatic C++11 program that prints the first 20 fibonacci numbers | |
| It uses the standard containers and smart pointers, so this is undeniably good code */ | |
| #include <iostream> | |
| #include <utility> | |
| #include <memory> | |
| #include <vector> | |
| template<int n> struct L {public: int h; L<n-1> t;}; template<> struct L<0> {}; |
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
| Honours Algebra 3 (MATH 456) | |
| ======= | |
| Assignment 4 | |
| ======= | |
| ### Julian C. Osorio -- 260 656 525 | |
| ### Submitted to Prof. Goren on Oct 24, 2016 | |
| ##Q1 |
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 <stdlib.h> | |
| #include <time.h> | |
| #include <string.h> | |
| #include <stdio.h> | |
| #include "prototypes.h" | |
| #define FITNESS fitness | |
| const char* words[35] = |
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
| import Html exposing (..) | |
| import Html.Events exposing (..) | |
| import Html.Attributes as Attr | |
| import StartApp.Simple as StartApp | |
| import Json.Decode as JD | |
| import String exposing (toInt) | |
| import List as L | |
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 <gmp.h> | |
| #include <stdio.h> | |
| #include <stdlib.h> | |
| int main() { | |
| FILE *cfile, *nfile, *sfile; | |
| mpz_t c, n, s, m; | |
| cfile = fopen("c", "r"); | |
| nfile = fopen("n", "r"); |
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
| import Codec.Picture -- From the package JuicyPixels | |
| height = 300 | |
| width = 1200 | |
| primes = prune (2:[3,5..]) | |
| where | |
| prune (x:xs) = x : (prune $ filter (not . divides x) xs) | |
| divides a b = b `rem` a == 0 |
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 <time.h> | |
| #include <math.h> | |
| void swap(int *a, int *b) { | |
| int temp = *a; | |
| *a = *b; | |
| *b = temp; | |
| } | |
| int gcd(int a, int b) { |
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
| module Deriv where | |
| --- Automatic differentiation implementation | |
| data Deriv a = Deriv a a | |
| deriving(Eq, Show) | |
| instance (Num a) => Num (Deriv a) where | |
| (Deriv a a') + (Deriv b b') = Deriv (a + b) (a' + b') | |
| (Deriv a a') - (Deriv b b') = Deriv (a - b) (a' - b') | |
| (Deriv a a') * (Deriv b b') = Deriv (a * b) (a*b' + a'*b) |
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
| import Data.Complex | |
| import qualified Data.Vector.Unboxed as V | |
| main = print test | |
| where | |
| test = fourier 0 (\x -> 3.2) | |
| fourier :: Int -> (Int -> Double) -> V.Vector (Complex Double) | |
| fourier 0 xs = V.singleton (xs 0 :+ 0) | |
| fourier power2 xs = V.generate n fourier' |
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 CPP, TemplateHaskell #-} | |
| ----------------------------------------------------------------------------- | |
| -- | |
| -- Module : pigLatin | |
| -- Copyright : | |
| -- License : AllRightsReserved | |
| -- | |
| -- Maintainer : Yu Chen Hou | |
| -- Stability : | |
| -- Portability : |
NewerOlder