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
data Tree a = Branch (Tree a) (Tree a) | |
| Leaf a | |
treeOp :: (a -> b) -> (b -> b -> b) -> Tree a -> b | |
treeOp fL fB (Leaf a) = fL a | |
treeop fL fB (Branch t1 t2) = treeOp fL fB t1 `fB` treeOp fL fB t2 | |
myFringe :: Tree a -> [a] | |
myFringe = treeOp (:[]) (++) |
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
#!/bin/bash | |
# Install dependencies | |
sudo apt-get install ghc6 ghc6-prof ghc6-doc haddock libglut-dev happy alex \ | |
libedit-dev zlib1g-dev checkinstall | |
# Get haskell-platform | |
wget http://hackage.haskell.org/platform/2009.2.0.2/haskell-platform-2009.2.0.2.tar.gz | |
tar -xzf haskell-platform-2009.2.0.2.tar.gz | |
cd haskell-platform-2009.2.0.2 |
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
using System; | |
namespace Data | |
{ | |
public struct Maybe<T> where T : class | |
{ | |
public static implicit operator Maybe<T> (T value) | |
{ |
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
== Solution: <name of solution> == | |
=== Description === | |
# Briefly describe the solution. | |
=== Advantages === | |
# List advantages of the solution. | |
=== Disadvantages === | |
# List at least one disadvantage of the solution. |
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 YataWindow ( YataWindow | |
, new, showAll | |
, onMessagePost | |
, displayTweets | |
) | |
where | |
import Control.Applicative | |
import Text.Printf (printf) |
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
#!/usr/bin/runhaskell | |
import Data.List (isInfixOf) | |
import Web.Twitter (getUserTimeline) | |
import Web.Twitter.Monad (runTM) | |
import Web.Twitter.Fetch (nullAuthUser) | |
import Web.Twitter.Types (Status (..)) | |
username = "jonobacon" | |
patterns = ["rock", "awesome", "jam"] |
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
[~/Developer/ScalaMono]% cat ScalaMono.scala | |
object ScalaMono extends Application { | |
def fib (i: Int): Int = i match { | |
case 0 | 1 => 1 | |
case i => fib (i - 2) + fib (i - 1) | |
} | |
println (fib (35)) | |
} | |
[~/Developer/ScalaMono]% time mono ScalaMono.exe |
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
[~/Developer/ScalaMono]% scalac-net ScalaMono.scala | |
[~/Developer/ScalaMono]% ilasm ScalaMono.msil | |
Assembling 'ScalaMono.msil' , no listing file, to exe --> 'ScalaMono.exe' | |
Operation completed successfully | |
[~/Developer/ScalaMono]% mono ScalaMono.exe | |
Scala on Mono! fib (0) = 1 | |
Scala on Mono! fib (1) = 1 | |
Scala on Mono! fib (2) = 2 | |
Scala on Mono! fib (3) = 3 |
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 System._ | |
object ScalaMono extends Application { | |
def fib (i: Int): Int = i match { | |
case 0 | 1 => 1 | |
case i => fib (i - 2) + fib (i - 1) | |
} | |
for (i <- 0 until 10) { |
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
[~/Developer/ScalaMono]% time mono ScalaMono.exe | |
Scala on Mono! fib (0) = 1 | |
Scala on Mono! fib (1) = 1 | |
Scala on Mono! fib (2) = 2 | |
Scala on Mono! fib (3) = 3 | |
Scala on Mono! fib (4) = 5 | |
Scala on Mono! fib (5) = 8 | |
Scala on Mono! fib (6) = 13 | |
Scala on Mono! fib (7) = 21 | |
Scala on Mono! fib (8) = 34 |