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
// Recursive bisection solver | |
// n: start iteration (0) | |
// N: max iterations | |
// f: function to solve (find root) | |
// a: lower range bound | |
// b: upper range bound | |
// t: tolerance | |
let rec bisect n N (f:float -> float) (a:float) (b:float) (t:float) : float = | |
if n >= N then -1.0 | |
else |
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
// The form | |
let form = new Form(Visible = true, Text = "Data grid #1", | |
TopMost = true, Size = Drawing.Size(600,600)) | |
// The grid | |
let data = new DataGridView(Dock = DockStyle.Fill, Text = "Data grid", | |
Font = new Drawing.Font("Lucida Console", 10.0f), | |
ForeColor = Drawing.Color.DarkBlue) | |
form.Controls.Add(data) |
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
<?xml version="1.0" encoding="utf-8"?> | |
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | |
<PropertyGroup> | |
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> | |
<Platform Condition=" '$(Platform)' == '' ">x86</Platform> | |
<ProductVersion>8.0.30703</ProductVersion> | |
<SchemaVersion>2.0</SchemaVersion> | |
<ProjectGuid>{a9120397-fd09-4e7f-9384-c7fd8976acc5}</ProjectGuid> | |
<OutputType>Exe</OutputType> | |
<RootNamespace>ApplicativeFParsec</RootNamespace> |
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
romimage: file=BIOS-bochs-latest, address=0xfffe0000 | |
vgaromimage: file=VGABIOS-lgpl-latest-debug | |
vga: extension=cirrus, update_freq=10 | |
vga: extension=vbe | |
floppya: 1_44=a:, status=inserted | |
log: OSDEV.log | |
error: action=report |
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 System.Environment | |
import Control.Monad | |
main :: IO () | |
main = do | |
args <- getArgs | |
putStrLn ("Hello, " ++ args !! 0) | |
-- using for |
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 | |
import System.IO | |
import Database.HDBC | |
import Database.HDBC.MySQL | |
import Data.Char | |
import qualified Data.Map as Map | |
main = do conn <- connectMySQL defaultMySQLConnectInfo { | |
mysqlUser = "testing", | |
mysqlPassword = "testing1234", |
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
-- JSON in Haskell using Aeson | |
{-# LANGUAGE OverloadedStrings #-} | |
import Control.Applicative ((<$>), (<*>), empty) | |
import Data.Aeson | |
import qualified Data.ByteString.Lazy.Char8 as BL | |
data Coord = Coord { | |
x :: Double, |
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 Control.Monad (msum) | |
import Data.Char (toLower) | |
import Happstack.Server (FromReqURI(..), dirs, dir, path, seeOther, nullConf, simpleHTTP, toResponse, ok) | |
--main :: IO () | |
--main = simpleHTTP nullConf $ ok (toResponse "Hello, World!") | |
data Subject = World | Haskell |
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 #-} | |
import Database.Redis | |
import Control.Monad.Trans | |
main :: IO () | |
main = do | |
conn <- connect defaultConnectInfo | |
runRedis conn $ do | |
set "foo" "123" |
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 qualified Data.ByteString.Lazy as B | |
import qualified Codec.Compression.Zlib as Zlib | |
Zlib.decompress <$> Zlib.compress <$> B.readFile "sample.txt" |
OlderNewer