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
% http://www.tutorialspoint.com/execute_matlab_online.php | |
n = 8; | |
N = zeros(n+1); | |
c = linspace(1,n+1,n+1); | |
for i=1:n+1 | |
for j=1:n+1 | |
N(i,j)= ((j-1)/n)^(i-1); | |
end | |
c(i)=1/c(i); | |
end |
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
module Calculus where | |
import Control.Monad (liftM2) | |
import Data.List (sort, permutations, nub) | |
import Data.Char (chr) | |
import Debug.Trace | |
data Formula = Formula Int | |
| Not Formula |
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
{-# LANGUAGE GADTs #-} | |
{-# LANGUAGE DataKinds #-} | |
{-# LANGUAGE KindSignatures #-} | |
{-# LANGUAGE ExistentialQuantification #-} | |
{-# LANGUAGE TypeFamilies #-} | |
{-# LANGUAGE StandaloneDeriving #-} | |
{-# LANGUAGE TypeOperators #-} | |
{-# LANGUAGE TypeSynonymInstances #-} | |
{-# LANGUAGE FlexibleInstances #-} |
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
{-# LANGUAGE NoMonomorphismRestriction #-} | |
module KMP3 (buildKMP , matchKMP , State) where | |
data State a = | |
State (State a) (State a) a -- State next fail char | |
| Aux (State a) -- Aux next | |
| Finish (State a) -- Finish fail | |
nextOf :: Eq a => State a -> a -> State a |
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
import Control.Monad.State | |
import System.Random | |
type Range = (Int, Int) -> Int | |
rangify :: Int -> Range | |
rangify x (lo, hi) = x `mod` (hi - lo + 1) + lo | |
getRandomsR :: RandomGen g => State g [Range] | |
getRandomsR = map rangify . randoms <$> state split |
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
{-# LANGUAGE FlexibleContexts #-} | |
import Control.Monad.Writer | |
listify :: Writer [a] () -> [a] | |
listify = execWriter | |
item x = tell [x] | |
main = do |
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
rm -f /private/var/folders/*/*/*/com.apple.DeveloperTools/*/Xcode/PlugInCache-Debug.xcplugincache | |
rm -rf /private/var/folders/*/*/*/com.apple.DeveloperTools/*/Xcode/PlugInCache.xcplugincache |
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
{-# LANGUAGE OverloadedStrings #-} | |
{-# LANGUAGE NoMonomorphismRestriction #-} | |
{-# LANGUAGE UnicodeSyntax #-} | |
import Prelude hiding (putStrLn) | |
import Data.Text.Lazy.IO (putStrLn) | |
import Control.Monad.Writer | |
-- Monoid Instance -- |
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
<style> | |
html { | |
font-family: Helvetica; | |
} | |
body { | |
width: 30em; | |
margin: auto; | |
} | |
p { | |
width: 581px; |
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
module Main where | |
import Prelude hiding (id, (.)) | |
import Control.Category | |
import Control.Monad ((>=>)) | |
import Data.List (stripPrefix) | |
type URL = [String] | |
type Route a = (URL, a) |