Skip to content

Instantly share code, notes, and snippets.

let rot n (s:string) = (s + s).Substring(n, s.Length)
let tonum (c:char) = ((int c - int 'A') * 5 + 15) % 26
let conv s = s |> rot 2 |> Seq.map tonum |> Seq.fold (fun a c -> a + (sprintf "%02d" c)) ""
let test s =
printfn "%s -> %s" s (conv s)
test "CAT"
test "DOG"
test "EULER"
@yukitos
yukitos / result.txt
Last active April 3, 2017 08:12
FSC 12.0.2 test
Chars
Length
Clone
CompareTo
Contains
CopyTo
EndsWith
Equals
GetEnumerator
GetHashCode

Computation Expression Problems

1. The translation rule of do! e;

In the language specification, the translation rule of do! e; is defined as follows:

T(do! e;, V, C, q) = T(let! () = src(e) in b.Return(), V, C, q)

And the signature of Return is 'a -> M<'a>, so the type of do! e; results M<unit>.

.assembly extern mscorlib { auto }
.assembly YDD { }
.module YDD.dll
.corflags 0x00000002
.vtfixup [1] int32 fromunmanaged at VT_01 // First v-table fixup
.vtfixup [1] int32 fromunmanaged at VT_02 // Second v-table fixup
.vtfixup [1] int32 fromunmanaged at VT_03 // Third v-table fixup
.data VT_01 = int32(0) // First v-table entry
.data VT_02 = int32(0) // Second v-table entry
.data VT_03 = int32(0) // Third v-table entry

FSDN: F# API Search Engine Web Application

FSDN is a web application that uses F# API Search library. F# API Search library supports the standard signature of F# with some extentions as its criteria. This document describes the F# API Search library specific formats.

Query format specifications

Supported API signatures

@yukitos
yukitos / gist:55f79eafcd7bce84e68b
Created December 2, 2015 15:22
VS2015 Update1 installation failed.
[4B2C:2DC8][2015-12-01T21:40:22]i338: Acquiring package: netfx_46mtpacklp_enu, payload: cab7896C7D6E9FB44EFA16EB57DED6BDB85, download from: bits://go.microsoft.com/fwlink/?prd=12514&pver=Dev14&sbp=d14rel&plcid=0x409&clcid=0x409&ar=24720.00&sar=S80_RCPrep&o1=D49EE7CB38851D80AE3F6CE7544656845EE3B426
[4980:4198][2015-12-01T21:40:30]i304: Verified existing payload: cab7896C7D6E9FB44EFA16EB57DED6BDB85 at path: C:\ProgramData\Package Cache\.unverified\cab7896C7D6E9FB44EFA16EB57DED6BDB85.
[4980:4198][2015-12-01T21:40:30]i305: Verified acquired payload: cab7896C7D6E9FB44EFA16EB57DED6BDB85 at path: C:\ProgramData\Package Cache\.unverified\cab7896C7D6E9FB44EFA16EB57DED6BDB85, moving to: C:\ProgramData\Package Cache\{034547E9-D8FA-49E7-8B9C-4C9861FB9146}v4.6.00127\packages\netfx_46mtpack\enu\cab1.cab.
[4B2C:2DC8][2015-12-01T21:40:30]i000: MUX: Source confirmed
[4980:3D44][2015-12-02T07:34:01]i400: Received system request to shut down the process: critical: No, elevated: Yes, allowed: No
[4B2C:5CB4][2015-12-02T07:34:01]
type IFizzBuzz =
abstract member check : int -> bool
abstract member getVal : unit -> string
type Fizz() =
interface IFizzBuzz with
member x.check n = (n % 3 = 0)
member x.getVal() = "Fizz"
type Buzz() =
class Program
{
static void Main()
{
var result =
Expr.If(DateTime.Now.Second % 2 == 0)
.Then(() =>
{
Console.WriteLine("Then clause handled.");
return 0;
// (snip)
let endCol =
if r.StartLine = r.EndLine then
r.EndColumn
else
buffer.CurrentSnapshot.GetLineFromLineNumber(r.StartLine).End.Position
@yukitos
yukitos / Collector.fs
Last active October 3, 2015 16:02
WIP: Trying to fix MissingMethodException of Persimmon.VisualStudio.TestExplorer.
namespace Persimmon.Runner.Wrapper
open Microsoft.VisualStudio.TestPlatform.ObjectModel.Logging
open System
open System.Collections.Generic
open System.Reflection
module private TestCollectorImpl =
open Persimmon