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
namespace ClassLibrary1 | |
open System | |
module SingleCase = | |
//definition | |
let (|UpperCase|) (x:string) = x.ToUpper() | |
//PM usage | |
match "foo" 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
open System | |
open Microsoft.FSharp.Quotations | |
open Microsoft.FSharp.Quotations.Patterns | |
open Microsoft.FSharp.Quotations.ExprShape | |
open Microsoft.FSharp.Quotations.DerivedPatterns | |
let qliteral = | |
<@ | |
let addAndMultiply a b = |
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 | |
open System.Globalization | |
open FParsec | |
type Token = | |
| KeyGroup of string list | |
| KeyValue of string * obj | |
let (<||>) p1 p2 = attempt (p1 |>> box) <|> attempt (p2 |>> box) | |
let spc = many (anyOf [' '; '\t']) |
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
namespace FSHelloSceneKit | |
open System | |
open MonoTouch.UIKit | |
open MonoTouch.Foundation | |
open MonoTouch.SceneKit | |
type FSHelloSceneKitViewController () = | |
inherit UIViewController() | |
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 EasyLayout | |
open System | |
open System.Drawing | |
open Microsoft.FSharp.Quotations | |
open Microsoft.FSharp.Quotations.Patterns | |
open Microsoft.FSharp.Quotations.DerivedPatterns | |
open MonoTouch.Foundation | |
open MonoTouch.UIKit | |
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
for i in {1..10}; do time fsharp hello world.fsx; done 2>&1 | grep ^real | sed -e s/.*m// | awk '{sum += $1} END {print sum / NR}' |
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
let idents tokens = | |
//reverse the tokens | |
let tokens = tokens |> Array.rev |> List.ofArray | |
let rec loop tokens result = | |
match tokens with | |
| [] -> result | |
| (name, token: TokenInformation) :: tail -> | |
match token.TokenName with | |
| "IDENT" -> loop tail (name :: result) | |
| "DOT" -> loop tail result |
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
let things = [|"One";"Two";"Three"|] | |
let things2 = [|"One" | |
"Two" | |
"Three"|] | |
let things3 = [| | |
"One" | |
"Two" | |
"Three" |
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
namespace BasicExample | |
open Microsoft.Xna.Framework | |
type Basic() as x = | |
inherit Game() | |
let graphics = new GraphicsDeviceManager(x) | |
override x.Draw (gameTime) = x.GraphicsDevice.Clear(Color.CornflowerBlue) |
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
[ProjectFileTypeDefinition(Name)] | |
public class HtmlProjectFileType : KnownProjectFileType | |
{ | |
public new const string Name = "HTML"; | |
public const string HTML_EXTENSION = ".html"; | |
public const string HTM_EXTENSION = ".htm"; | |
public new static readonly HtmlProjectFileType Instance; | |
private HtmlProjectFileType() : base(Name, "Html", new[] {HTML_EXTENSION, HTM_EXTENSION}) { } |
NewerOlder