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
// Inspired by http://arxiv.org/abs/1210.7463 | |
// reference accord framework | |
#r "../packages/Accord.3.0.2/lib/net45/Accord.dll" | |
#r "../packages/Accord.Controls.3.0.2/lib/net45/Accord.Controls.dll" | |
#r "../packages/Accord.IO.3.0.2/lib/net45/Accord.IO.dll" | |
#r "../packages/Accord.Math.3.0.2/lib/net45/Accord.Math.dll" | |
#r "../packages/Accord.Statistics.3.0.2/lib/net45/Accord.Statistics.dll" | |
//reference deelde with fsharp charting |
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
Date | Open | High | Low | Close | Volume | Adj Close | |
---|---|---|---|---|---|---|---|
2013-11-07 | 37.96 | 38.01 | 37.43 | 37.50 | 60437400 | 37.50 | |
2013-11-06 | 37.24 | 38.22 | 37.06 | 38.18 | 88615100 | 38.18 | |
2013-11-05 | 35.79 | 36.71 | 35.77 | 36.64 | 51646300 | 36.64 | |
2013-11-04 | 35.59 | 35.98 | 35.55 | 35.94 | 28060700 | 35.94 | |
2013-11-01 | 35.67 | 35.69 | 35.39 | 35.53 | 40264600 | 35.53 | |
2013-10-31 | 35.66 | 35.69 | 35.34 | 35.41 | 41682300 | 35.41 | |
2013-10-30 | 35.53 | 35.79 | 35.43 | 35.54 | 36997700 | 35.54 | |
2013-10-29 | 35.63 | 35.72 | 35.26 | 35.52 | 31702200 | 35.52 | |
2013-10-28 | 35.61 | 35.73 | 35.27 | 35.57 | 38383600 | 35.57 |
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
open Accord.MachineLearning.FSharp | |
open Deedle | |
let data = [ ("D1", "Sunny", "Hot", "High", "Weak", "No" ) | |
("D2", "Sunny", "Hot", "High", "Strong", "No" ) | |
("D3", "Overcast", "Hot", "High", "Weak", "Yes") | |
("D4", "Rain", "Mild", "High", "Weak", "Yes") | |
("D5", "Rain", "Cool", "Normal", "Weak", "Yes") | |
("D6", "Rain", "Cool", "Normal", "Strong", "No" ) | |
("D7", "Overcast", "Cool", "Normal", "Strong", "Yes") |
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
package extension.monad | |
trait Monad[A, M[_]] { | |
// >>= :: Monad m => m a -> (a -> m b) -> m b | |
def flatMap[B](input: A => M[B]): M[B] // AKA "bind" | |
} | |
trait Functor[A, F[_]] { | |
// fmap :: Functor f => (a -> b) -> f a -> f b | |
def map[B](input: A => B): F[B] // AKA "fmap" |
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
/* | |
* The trait Nat is provided by the text. | |
*/ | |
trait Nat { | |
def isZero: Boolean | |
def predecessor: Nat | |
def successor: Nat | |
def +(that: Nat): Nat | |
def -(that: Nat): Nat | |
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
package com.micronautics.paypal | |
import java.util.{ List, Map } | |
import collection.JavaConversions._ | |
import collection.immutable.HashMap | |
import controllers.Email | |
import org.joda.time.DateTime | |
import slick.driver.MySQLDriver.simple._ | |
import java.util |
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
// And by the way, please feel free to contribute, correct errors, etc! | |
trait Functor[F[_]] { | |
def fmap[A, B](f: A => B): F[A] => F[B] | |
} | |
object Functor { | |
val ListFunctor: Functor[List] = | |
new Functor[List] { | |
def fmap[A, B](f: 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
case class Circle(radius: Double) { | |
def area = radius * radius * Math.PI | |
} | |
case class Rectangle(side: Double) { | |
def area = side * side | |
} | |
case class Triangle(base: Double, height: Double) { | |
def area = 0.5d * base * height |
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
/* http://www.haskell.org/ghc/docs/latest/html/users_guide/data-type-extensions.html#gadt | |
Generalized Algebraic Datatypes in Scala */ | |
trait Term[A] | |
case class Lit(x: Int) extends Term[Int] | |
case class Succ(x: Term[Int]) extends Term[Int] | |
case class IsZero(x: Term[Int]) extends Term[Boolean] | |
case class If[A](guard: Term[Boolean], t: Term[A], y: Term[A]) extends Term[A] | |
case class Pair[A, B](x: Term[A], y: Term[B]) extends Term[(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
package funsets | |
import org.scalatest.FunSuite | |
import org.junit.runner.RunWith | |
import org.scalatest.junit.JUnitRunner | |
/** | |
* This class is a test suite for the methods in object FunSets. To run | |
* the test suite, you can either: |