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
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}) { } |
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 compilertesting.Main | |
open System | |
open System.IO | |
open System.Text | |
open Microsoft.FSharp.Compiler.SimpleSourceCodeServices | |
[<EntryPoint>] | |
let main args = | |
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
[<Activity (Label = "HelloBarometer", MainLauncher = true)>] | |
type MainActivity () = | |
inherit Activity () | |
let calculateAltitudeInFeet hPAs = | |
let pstd = 1013.25 | |
(1.0 - Math.Pow((hPAs/pstd), 0.190284)) * 145366.45 | |
let mainLabel = ref Unchecked.defaultof<_> | |
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 colourStyles = Mono.TextEditor.Highlighting.SyntaxModeService.GetColorStyle(MonoDevelop.Ide.IdeApp.Preferences.ColorScheme) | |
let keywordColour = colourStyle.GetForeground (colourStyle.KeywordProperty) | |
let cairoToHsl (c:Cairo.Color) = HslColor.op_Implicit(c) | |
let gdkToHsl (c:Gdk.Color) = HslColor.op_Implicit(c) | |
let hslToCairo (c:HslColor) : Cairo.Color = HslColor.op_Implicit(c) | |
let hslToGdk (c:HslColor) : Gdk.Color = HslColor.op_Implicit(c) | |
let cairoToGdk = cairoToHsl >> hslToGdk |
NewerOlder