Snippets created by Phillip Trelford

  • LinkedList extensions

    LinkedList functional extension providing find and findi higher order functions that take a predicate function.

    18 people like this
    Posted: 1 years ago by Phillip Trelford

  • Seq.unsort

    Randomizes order of specified sequence

    18 people like this
    Posted: 1 years ago by Phillip Trelford

  • Int32.tryParse

    Converts the string representation of a number in-place to an Int32. A return value of None indicates the conversion failed.

    14 people like this
    Posted: 1 years ago by Phillip Trelford

  • ObservableObject

    The ObservableObject type implements the INotifyPropertyChanged interface used in WPF and Silverlight to notify on changes to properties that are bound to a control. Specify property names type safely using F# Quotations, i.e. <@ this.PropertyName @> when invoking the NotifyPropertyChanged method. If you are following the MVVM pattern then your View Model class can inherit from the ObservableObject type.

    41 people like this
    Posted: 1 years ago by Phillip Trelford

  • Observable.Subject

    The Subject<T> type implements both IObserver<T> and IObservable<T>. It is functionally equivalent to the type of the same name in the Reactive Extensions (Rx) library.

    11 people like this
    Posted: 1 years ago by Phillip Trelford

  • Spreadsheet

    Spreadsheet script runnable inside http://tryfsharp.org includes a custom DataGrid and a parser for simple formulas e.g.: =1+1 =SUM(A1,A2) Add your own functions to the evaluate function. For a more comprehensive implementation check out http://cellz.codeplex.com

    1 people like this
    Posted: 10 months ago by Phillip Trelford

  • Calculator

    Simple Silverlight Calculator UI interactive sample runnable inside http://tryfsharp.org.

    0 people like this
    Posted: 9 months ago by Phillip Trelford

  • Calculator

    Simple Silverlight Calculator UI interactive sample runnable inside http://tryfsharp.org.

    0 people like this
    Posted: 9 months ago by Phillip Trelford

  • Formula Calculator

    Simple formula calculator including dynamic unit of measure support. Run as a script in Try F#, and try formula with units like 3m * 3m.

    0 people like this
    Posted: 9 months ago by Phillip Trelford

  • Miss Grant's Controller Parser

    State machine example, from Martin Fowler's Domain-Specific Languages book, implemented as an External DSL parser in F#. A set of mutually recursive functions are used to parse the string tokens and build the State Machine as an F# record type.

    6 people like this
    Posted: 8 months ago by Phillip Trelford

  • ReplaySubject

    The ReplaySubject<T> type implements both IObserver<T> and IObservable<T>. It is functionally equivalent to the class of the same name in the Reactive Extensions (Rx) library with a replay buffer of a specified size .

    1 people like this
    Posted: 8 months ago by Phillip Trelford

  • Tetris

    Playable Tetris mini-game. Use arrow keys to move left and right and up to rotate, down to drop. Try it out in the browser on TryFSharp.org

    8 people like this
    Posted: 8 months ago by Phillip Trelford

  • Still Mouse Click Event

    Detects a mouse down then up event without a move.

    3 people like this
    Posted: 7 months ago by Phillip Trelford

  • Turtle

    Turtle graphics library implemented as an internal DSL, providing a very similar syntax to Logo, it is runnable inside TryFSharp.org.

    5 people like this
    Posted: 7 months ago by Phillip Trelford

  • Times Table game

    Simple times table console based game.

    2 people like this
    Posted: 4 months ago by Phillip Trelford

  • JSON Parser

    JSON Parser using Regular Expressions & Active Patterns (just for fun).

    5 people like this
    Posted: 4 months ago by Phillip Trelford

  • Simple JS Calculator

    Simple calculator application for adding numbers, compiles to JavaScript via Pit (v0.1) (http://pitfw.posterous.com). Run: http://trelford.com/PitCalculatorApp.htm

    3 people like this
    Posted: 3 months ago by Phillip Trelford

  • Times Table JS game

    Simple times table browser based game., compiles to JavaScript via Pit (v0.1) (http://pitfw.posterous.com). Run: http://trelford.com/SevenSixes.htm

    2 people like this
    Posted: 3 months ago by Phillip Trelford

  • Poor Man's DI

    Minimal Dependency Injection (DI) Container in under 60 lines of code implementing the 3 Rs: Register, Resolve, Release. Note: missing thread safety, explicit cycle dependency checking and Fluent interface.

    6 people like this
    Posted: 3 months ago by Phillip Trelford

  • Starbucks

    Simple DSL for describing cups of Starbucks coffee and computing prices (in dollars).

    7 people like this
    Posted: 2 months ago by Phillip Trelford

  • Baccarat

    Shuffles a deck of cards, deals 2 hands applying punto banco rules before declaring a winner or a tie.

    4 people like this
    Posted: 1 months ago by Phillip Trelford

  • Point of Sale

    10 line Point of Sale (POS) application takes barcodes from a USB barcode scanner or keyboard adding matching products. Entering an empty string completes the action and gives the total.

    6 people like this
    Posted: 1 months ago by Phillip Trelford

  • PacMan Maze

    PacMan maze view runnable inside TryFSharp.org

    4 people like this
    Posted: 1 months ago by Phillip Trelford

  • Pong

    Pong video game runnable inside TryFSharp.org. Player 1 keys 'Q' - up, 'A' - down. Player 2 keys 'P' - up, 'L' - down.

    5 people like this
    Posted: 1 months ago by Phillip Trelford

  • WrapPanel

    Positions child elements in sequential position from left to right, breaking content to the next line at the edge of the containing box. Tryable at http://tryfsharp.org

    3 people like this
    Posted: 4 days ago by Phillip Trelford