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
{-#LANGUAGE TypeFamilies, MultiParamTypeClasses, FlexibleInstances #-} | |
class Overload a b where | |
type Out a b :: * | |
(+):: a -> b -> Out a b | |
instance Overload Int Int where | |
type Out Int Int = Int | |
(+) = (Prelude.+) |
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
$ smlsharp -v | |
SML# 3.4.0 (2017-08-31 19:31:44 JST) for x86_64-pc-linux-gnu with LLVM 3.7.1 | |
$ smlsharp -O3 inner_prod.sml -o inner_prod_smlsharp | |
$ ./inner_prod_smlsharp | |
compose | |
Time: | |
[Total] 9101 ms/10calls | |
[Average] 910.1 ms/call | |
loop | |
Time: |
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 Ip = usize; | |
type Var = usize; | |
#[derive(Debug)] | |
enum Instr { | |
Const(i32), | |
Add, | |
Sub, | |
Get(Var), | |
Set(Var), |
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
#![recursion_limit = "256"] | |
// スタックは以下のような形。 | |
// [(マクロ名, (まだ評価していない引数...), (評価が終わった引数...)), ...] | |
// | |
// ck(スタック, 式)という形で評価していく。なんとなく継続を起動してるイメージ | |
// 評価が終わったら`q!(値)`という形で目印を付ける | |
// | |
// ただしここで受け取るマクロは全てスタックを第一引数に取るものとする。CPSでいう継続にあたる。 | |
macro_rules! ck { |
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
#!/usr/bin/zsh | |
# cargo install cargo-scriptしておく。これだけでも便利 | |
# 下記関数でタイプ数節約できる & ツールチェーン切り替えられる | |
rust() { | |
local toolchain=+stable | |
if [[ "$1" =~ "\+.+" ]]; then | |
toolchain="$1" |
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
datatype range | |
= to of int * int | |
| below of int * int | |
infix to below | |
structure List = struct | |
open List | |
local |
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
A. 本ソフトウェアは Everyone'sWare です。このソフトを手にした一人一人が、 | |
ご自分の作ったものを扱うのと同じように、自由に利用することが出来ます。 | |
A-1. フリーウェアです。作者からは使用料等を要求しません。 | |
A-2. 有料無料や媒体の如何を問わず、自由に転載・再配布できます。 | |
A-3. いかなる種類の 改変・他プログラムでの利用 を行っても構いません。 | |
A-4. 変更したものや部分的に使用したものは、あなたのものになります。 | |
公開する場合は、あなたの名前の下で行って下さい。 | |
B. このソフトを利用することによって生じた損害等について、作者は |
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
$ ghc -O3 fold_elem.hs | |
$ time ./fold_elem foldr | |
True | |
./fold_elem foldr 1.59s user 0.01s system 99% cpu 1.602 total | |
$ time ./fold_elem foldl | |
True | |
./fold_elem foldl 2.96s user 0.01s system 99% cpu 2.978 total | |
$ time ./fold_elem rec | |
True | |
./fold_elem rec 1.63s user 0.00s system 99% cpu 1.638 total |
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
$ cargo build | |
Compiling swagger_client v1.0.0 (file:///home/kim/Idein/actcast/specification/server) | |
error: no rules expected the token `.` | |
--> src/mimetypes.rs:9:97 | |
| | |
9 | pub static ref PET_FIND_BY_STATUS_GET_SUCCESSFUL_OPERATION: Mime = mime!(Application/Vnd.petstore.v1+json); | |
| ^ | |
error: aborting due to previous error |
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
{ | |
"swagger": "2.0", | |
"info": { | |
"version": "1.0.0", | |
"title": "Swagger Petstore" | |
}, | |
"paths": { | |
"/pet": { | |
"post": { | |
"responses": { |