- タイトル
Erlang ユーザーガイドから始めよう
- バージョン
6.2 / 7.1
- 原文
- 原文の著作権者
Ericsson AB.
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
(* | |
* 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. |
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 rec factorial n = | |
match n with | |
| 0 | 1 -> 1 | |
| _ -> n * (factorial (n - 1)) | |
type FactorialNumber(num: int) = | |
let infactorials = Seq.initInfinite <| fun i -> factorial (i+1) | |
let range = Seq.takeWhile (fun fc -> fc <= num) infactorials |> Seq.toList | |
let rec factSystemize n fcs acc = | |
match fcs 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
# -*- coding: utf-8 -*- | |
def class_extender(cls): | |
def __init__(self, value): | |
self.value = value | |
cls.__init__ = __init__ | |
return cls | |
@class_extender | |
class Hoge: |
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 undefined _ = failwith "undefined" | |
let hoge (x : string) : int = undefined() |
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 | |
//============================================ | |
// IOモナド | |
//============================================ | |
module IO = | |
type IO<'a> = IO of (unit -> 'a) | |
type IOBuilder() = | |
member this.Bind (IO x, f) = f (x()) |
- タイトル
Erlang ユーザーガイドから始めよう
- バージョン
7.2
- 原文
- 原文の著作権者
Ericsson AB.
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 ConsolePrinter = | |
open System.Text | |
open System.ComponentModel | |
[<EditorBrowsable(EditorBrowsableState.Never)>] | |
let private bit mask b = | |
b &&& mask = mask | |
[<EditorBrowsable(EditorBrowsableState.Never)>] | |
let private bit0 = bit 0b00000001uy |
今朝、 F# のインデントガイドライン という記事がアップされてました。大変興味深い内容だったんですが、ちょっと時間がなくて反応ができなかったんで、今やってしまおうと思います。
今回の概要としては、単純に「僕はこんなインデントルールでやってるよ!」という差分を紹介しよう、というものです。そのため、思想の一致を見るルールについては特に取り上げないこととします。
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
type Family = Blair | Smith | Kelly | Tavares | Chen | Singh | |
type Person = { First: string; Last: Family } | |
let blair's first = { First = first; Last = Blair } | |
let smith's first = { First = first; Last = Smith } | |
let kelly's first = { First = first; Last = Kelly } | |
let tavares' first = { First = first; Last = Tavares } | |
let chen's first = { First = first; Last = Chen } | |
let singh's first = { First = first; Last = Singh } |