Skip to content

Instantly share code, notes, and snippets.

View bleis-tift's full-sized avatar

bleis-tift bleis-tift

View GitHub Profile
type FloatEq = FloatEq of float * float
let (=.) a b = FloatEq (a, b)
let (<+->) (FloatEq (a, b)) e = abs (a - b) < e
10.3 =. 9.9 <+-> 0.5 // => true
10.3 =. 9.9 <+-> 0.1 // => false
module main
open System
open FsXaml
type App = XAML<"App.xaml">
[<STAThread>]
[<EntryPoint>]
let main argv =
ๅ…ƒใฎใ‚ณใƒผใƒ‰ ๅค‰ๆ›ดๅพŒใฎใ‚ณใƒผใƒ‰ ใ‚ฝใƒผใ‚นไบ’ๆ›ๆ€ง ใƒใ‚คใƒŠใƒชไบ’ๆ›ๆ€ง ใƒกใƒข
let f x y = ... let f (x, y) = ... No
let f (x, y) = ... let f x y = ... No
type t = int type s = int No Yes ๅž‹็•ฅ็งฐใฎๅๅ‰ใ‚’ๅค‰ๆ›ดใ—ใฆใ‚‚F#็”จใฎใƒกใ‚ฟใƒ‡ใƒผใ‚ฟใซใ—ใ‹ๅฝฑ้Ÿฟใฏใชใ„
[<CN("a")>] type t = ... [<CN("a")>] type s = ... No Yes ILไธŠใฎ่จ€่ชžใ‹ใ‚‰ใฏCNใŒๅค‰ใ‚ใฃใฆใ„ใชใ‘ใ‚Œใฐใ„ใ„

็•ฅ่ชžไธ€่ฆง

  • CN ใฏ CompiledName
@bleis-tift
bleis-tift / sample.adoc
Last active April 22, 2016 01:49 — forked from xmeta/sample.adoc

ใ‚ฟใ‚คใƒˆใƒซ

็ฌฌไธ€็ซ 

350x150
ๅ›ณ1.1: hogehoge
@bleis-tift
bleis-tift / assertSeqEquals.fs
Created April 8, 2016 02:35 — forked from Gab-km/assertSeqEquals.fs
Persimmon ใฎๆšซๅฎš็š„ใช assertSeqEquals ใ‚’ๆ›ธใ„ใฆใฟใŸ
(*
* The MIT License (MIT)
*
* Copyright (c) 2016 Kazuhiro Matsushima
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the
* Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software,
* and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
open System
type Sound = Z | D | K
with
override this.ToString() =
match this with
| Z -> "ใ‚บใƒณ"
| D -> "ใƒ‰ใ‚ณ"
| K -> "ใ‚ญใƒปใƒจใƒปใ‚ท๏ผ"
1. Expect: [{Row = 0;
Column = 0;
MergedRows = 1;
MergedColumns = 1;
Format =
{RepresentationFormat =
OneReprFormat {Color = null;
Condition = null;
Format = NumericFormat [NFCLiteral "General"];};
Layout = {HorizontalLayout = HLStandard;
@bleis-tift
bleis-tift / StateMonad.cs
Created December 10, 2015 05:34
ๅž‹ใ ใ‘ๅˆใ‚ใ›ใฆใฟใŸC#ใงStateใƒขใƒŠใƒ‰
using System;
namespace StateMonad
{
// sample:
// var proc =
// from initVal in State.Get<int>()
// let x = initVal + 10
// from _ in State.Put(x * 2)
// select (x / 2).ToString();
@bleis-tift
bleis-tift / Program.cs
Last active October 19, 2015 08:41
ldc.i4.sใง่ฒ ๆ•ฐใ‚’intใฎใพใพemitใ™ใ‚‹ใจไธๆญฃใชILใŒ็”Ÿๆˆใ•ใ‚Œใ‚‹
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Reflection;
using System.Reflection.Emit;
namespace SampleApplication
{
@bleis-tift
bleis-tift / gist:c99f1627e6445d24d9cd
Created December 17, 2014 02:48
http://d.hatena.ne.jp/teramonagi/20141215/1418648845 ใ‚’ๅ‚่€ƒใซใžใ„ใ‚’ๆ•ฐใˆใฆใฟใŸ
open System
let dic = [ ["ไปŠๆ—ฅ"; "ใžใ„"]; ["ใ‚‚"]; ["1"; "ใžใ„"]; ["ๆ—ฅ"; "ใžใ„"]; ["ใŒใ‚“"; "ใžใ„"]; ["ใฐใ‚‹"; "ใžใ„"]; ["ใžใ„๏ผ"]]
let rnd = Random()
let makeZoi (xss: string list list) =
let rec makeZoi' (xss: string list list, count) =
match xss, count with
| xs::xss, count ->
let crnt = xs.[rnd.Next(List.length xs)]
let rest, count = makeZoi' (xss, if crnt.Contains("ใžใ„") then count + 1 else count)