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
CREATE PROCEDURE [dbo].[spGetAutomobiles] | |
@Id int = 0, | |
@Make nvarchar(100) = '' | |
AS | |
BEGIN | |
SELECT * | |
FROM Automobiles a with (nolock) | |
WHERE (@Id = 0 OR a.Id = @Id) | |
AND (@Make = '' OR a.Make = @Make) | |
END |
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
open System | |
let getComparableUri uri = { | |
new Uri( uri) | |
interface IComparable<string> with | |
member this.CompareTo other = | |
compare (string this) other | |
} | |
let url = "http://news.google.com/" |
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 Symbology | |
open System | |
let yahoo symbol = | |
use wc = new Net.WebClient() | |
let yahoo = "http://download.finance.yahoo.com/d" | |
let uri = sprintf "%s/quotes.csv?s&f=nl1" yahoo symbol | |
wc.DownloadString(uri) | |
.Split([| "\n\r" |], StringSplitOptions.RemoveEmptyEntries) |
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
open FSharp.Data | |
type Get42 = SqlCommandProvider<"SELECT 42", "Data Source=.;Integrated Security=True;", SingleRow = true> | |
Get42.Create().Execute() |
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
open System | |
let sigmoid z = 1.0 / (1.0 + exp (- z)) | |
let logistic (weights:float[]) (features:float[]) = | |
let sumProd = (weights, features) ||> Array.map2 (*) |> Array.sum | |
sigmoid sumProd | |
let makeAllData (numFeatures, numRows, seed) = |
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
type IOOP = abstract Mutate: unit -> unit | |
type IFunctional<'T> = abstract Reduce: 'T list * ('T -> 'T -> 'T) -> 'T | |
type ProgramThatMatters = | |
static member Run<'T, 'a when 'a :> IOOP and 'a :> IFunctional<'T>>(paradigm: 'a) = () | |
let myCode = { | |
new IFunctional<int> with | |
member __.Reduce(xs, f) = List.reduce f xs | |
interface IOOP with |
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
[ DateTime.Today.AddDays(-5.0) .. TimeSpan.FromDays(1.0) .. DateTime.Today ] |
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
open System.IO | |
open System.Net | |
let wc = new WebClient() | |
let trainingSetFile = Path.Combine( __SOURCE_DIRECTORY__, "trainingSet.csv") | |
File.WriteAllText(trainingSetFile, | |
contents = wc.DownloadString("http://brandewinder.blob.core.windows.net/public/trainingsample.csv") | |
) |
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
//TYPES | |
//In the card game poker... | |
type Card = Face * Suit | |
and Suit = Spades | Diamonds | Clubs | Hearts | |
//The cards are valued in the order: |
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
#r "bin/Debug/SqlCommandTypeProvider.dll" | |
open FSharp.NYC.Tutorial | |
[<Literal>] | |
let connectionString="Data Source=.\SQLExpress;Initial Catalog=AdventureWorks2012;Integrated Security=True" | |
type QueryPersonInfo = SqlCommand<"SELECT * FROM dbo.ufnGetContactInformation(@PersonId)", connectionString> |
OlderNewer