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
sealed trait TicTacToePlayer | |
case object X extends TicTacToePlayer | |
case object Y extends TicTacToePlayer | |
case class TicTacToeBoard(moves: List[(Int,TicTacToePlayer)]) { | |
val boardRange = 0 to 8 | |
val players = List(X,Y) | |
lazy val movesMap = moves.toMap |
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
(define-abbrev-table 'global-abbrev-table '( | |
("alpha" "α" nil 0) | |
("beta" "β" nil 0) | |
("gamma" "γ" nil 0) | |
("theta" "θ" nil 0) | |
("inf" "∞" nil 0) | |
("|@|" " ⊛" nil 0) | |
("forever" "∞" nil 0) | |
("jjoin" "μ" nil 0) | |
("cojoin" "υ" nil 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
/* | |
* Counterparty A receives: 1.43% absolute on amortising notional (decreasing periodically from an initial notional of £200m). | |
Counterparty B receives: Previous coupon + 5 x [Max(Ref Index – 6.65%, 0.00%) + Max(2% - Ref Index, 0.00%)] on fixed notional of £200m. | |
The reference index is CMS EUR 10y set in arrears, available on Reuters website at ISDAFIX2 | |
A Bermudan call option is conferred on Counterparty B who may terminate for 0 payment within a 10 day band every quarter. | |
Payment dates are quarterly, reset dates and accrual periods are also defined. |
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 scalaz._ | |
/** | |
* playing with some of the ideas from the Haskell fclabels library | |
* using the new Lens functionality in scalaz | |
* | |
* http://hackage.haskell.org/package/fclabels | |
*/ | |
object LensTest { |
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 Network.Mail.Mime | |
import qualified Data.ByteString.Lazy.UTF8 as LU | |
import qualified Data.ByteString.Lazy as B | |
import qualified Data.ByteString as S | |
import Control.Monad | |
import qualified HaskellNet.SMTP as HN | |
import Text.Pandoc | |
import Text.Hamlet | |
import Text.XHtml.Transitional hiding ( renderHtml ) |
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 scalaz._ | |
/** | |
* A simple example of how applicative functors can shorten code | |
* adapted from chapter 8? of Real World Haskell | |
*/ | |
object OptionGolf { |