Skip to content

Instantly share code, notes, and snippets.

View smallgeek's full-sized avatar
🤔
Now thinking...

smallgeek smallgeek

🤔
Now thinking...
View GitHub Profile
@kenmori
kenmori / TypeScriptPractice.md
Last active April 22, 2024 13:05
TypeScript 練習問題集

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 usually 'a -> M<'a>, so the type of do! e; results M<unit>.

@chomado
chomado / perfect.ml
Created May 26, 2013 18:23
n 以下の完全数をリストで返す
(* 完全数: 自分自身を除く約数の和がその数自身になる *)
(* n以下の整数一覧を並べたリスト *)
(* enumerate: int -> int list *)
let rec enumerate n = if n <= 0 then [] else n :: enumerate (n-1)
(* n 以下の完全数をリストで返す *)
(* perfect : int -> int list *)
let perfect n =
let perfectp n =