This file contains hidden or 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
| # -*- coding: utf-8 -*- | |
| import subprocess | |
| import logging | |
| import tempfile | |
| import json | |
| import datetime | |
| azure_cli = "\"C:\\Program Files (x86)\\Microsoft SDKs\\Azure\\CLI\\wbin\\azure.cmd\"" | |
| def exec_azure_cli_cmd(cmd, skip_start_lines, input = ""): |
This file contains hidden or 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
| // C# | |
| // public class Test { | |
| // public FSharpSet<int> SetNull { get; set; } | |
| // } | |
| let s : Set<int> = (new Test()).SetNull | |
| //or let s : Set<int> = Unchecked.defaultof<Set<int>> | |
| //The type 'Set<int>' does not have 'null' as a proper value |
This file contains hidden or 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
| [<ReflectedDefinition>] | |
| module Program | |
| open FunScript | |
| open FunScript.TypeScript | |
| let main() = | |
| let scene : THREE.Scene = THREE.Scene.Create() | |
| let camera = THREE.PerspectiveCamera.Create( 75., Globals.window.innerWidth / Globals.window.innerHeight, 0.1, 1000. ); |
This file contains hidden or 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 countOfDisks = 10 | |
| let initialState = [for x in 1..countOfDisks do yield x], List.empty, List.empty | |
| let bottDiskSize = 4. | |
| let cylHeight = 4.0 | |
| let diskSize size = size * bottDiskSize / float(countOfDisks) | |
| let diskHeight = cylHeight / float(countOfDisks) | |
| let diskPosition pos = pos * diskHeight | |
| let cyl = |
This file contains hidden or 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.Net | |
| open System | |
| type System.Net.Sockets.UdpClient with | |
| member x.AsyncSend (bytes: byte[]) = | |
| Async.FromBeginEnd((fun (ar, s) -> x.BeginSend(bytes, bytes.Length, ar, s)), x.EndSend) | |
| member x.AsyncReceive (endPoint: IPEndPoint ref) = | |
| Async.FromBeginEnd(x.BeginReceive, fun ar -> x.EndReceive(ar, endPoint)) | |
| module Udp = |
This file contains hidden or 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 Transaction = | |
| open System | |
| type CommitReciever = bool -> Async<unit> | |
| let emptyReciever : CommitReciever= fun _ -> async.Return () | |
| let mergeRecievers (xs: CommitReciever seq) = | |
| fun res -> async{ | |
| for x in xs do | |
| do! x(res) | |
| } |
This file contains hidden or 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.Diagnostics | |
| let ringLength = 503 | |
| let cells = Array.zeroCreate ringLength | |
| let threads = Array.zeroCreate ringLength | |
| let answer = ref -1 | |
| let createWorker i = |
This file contains hidden or 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 | |
| type Pure = Pure of unit | |
| type Impure = Impure of unit | |
| type M<'a,'p> = M of 'a | |
| let purev x : M<_,Pure>= M(x) | |
| let purev x : M<_,Impure>= M(x) | |
| type ThingThatShows = | |
| static member show(x: Option<Pure> ) = sprintf "pure" | |
| static member show(x: Option<Impure>) = sprintf "impure" |
This file contains hidden or 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.Joinads.Joins | |
| open System | |
| [<EntryPoint>] | |
| let main argv = | |
| // Construct channels implementing the buffer | |
| let put = Channel<string>("put") | |
| let put2 = Channel<string>("put2") | |
| let get = SyncChannel<string>("get") | |
| let get2 = SyncChannel<string>("get2") |
This file contains hidden or 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 Promise = | |
| open System.Threading.Tasks | |
| type Promise<'a> = {signal: 'a -> bool; | |
| future : Async<'a>; | |
| cancel : unit -> bool} | |
| let create<'a> () = | |
| let tcs = new TaskCompletionSource<'a>() | |
| let ta: Async<'a> = Async.AwaitTask tcs.Task | |
| {signal = tcs.TrySetResult; | |
| future = ta; |