Skip to content

Instantly share code, notes, and snippets.

View cbilson's full-sized avatar

Chris Bilson cbilson

View GitHub Profile
#light
type Currency = { Code : string; Name : string; }
type Money = { Amount : float; Currency : Currency }
type Asset =
| Equity of string * Money
| FixedIncome of string * Money
| Cash of Money
#light
let rec printList xs =
match xs with
| [] -> printfn ""
| [x] -> printf "%d" x
printList []
| x :: xs -> printf "%d, " x
printList xs
public static IEnumerable<T> As<T>(this IEnumerable genericEnumerable) {
foreach (T item in genericEnumerable)
yield return item;
}
#light
(*
Translating some functions in the Polynomials chapter of
"The Haskell Road to Logic Maths and Programming"
(chapter 9)
http://fldit-www.cs.uni-dortmund.de/~peter/PS07/HR.pdf
*)
let N = Seq.init_infinite (fun x -> x)
#light
namespace SqlFuckTests
open NUnit.Framework
// Didn't find the extension methods you referenced, so made these
module Extensions =
type System.Object with
member this.ShouldBeOfType (a:System.Type) : unit =
module Polynomials
where
difs :: [Integer] -> [Integer]
difs [] = []
difs [n] = []
difs (n:m:ks) = m-n : difs (m:ks)
difLists :: [[Integer]]->[[Integer]]
use Broker_Recon_Data
go
begin transaction
select
*
from
Broker_Recon_Data.dbo.t_Bond_Reference
WHERE
<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!-- Trying to make a build file for a pure (no-xaml) f# silverlight application -->
<PropertyGroup>
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
<SchemaVersion>2.0</SchemaVersion>
<NoStdLib>true</NoStdLib>
<NoStdCfg>true</NoStdCfg>
select
position.BrokerAccount
, position.Contract
, contractDetails.Future_Index_Contracts as Name
, contractDetails.Market_Sector_Code as MarketSectorCode
, position.Currency
, contract.BloombergTicker
, Sum(position.Quantity) as Quantity
from
( select
public void GetSql() {
var cfg = new NHibernate.Cfg.Configuration();
SessionFactoryManager.Configurers.Get("fx").ConfigureProperties(cfg);
SessionFactoryManager.Models.Get("fx").Configure(cfg);
var exporter = new SchemaExport(cfg);
CancelView();
Response.Write("<html><body>");
exporter.Create(x => Response.Write("<br /><pre>" + x + "</pre>"), false);
Response.Write("</body></html>");