Skip to content

Instantly share code, notes, and snippets.

@hanachin
Created October 23, 2018 22:10
Show Gist options
  • Save hanachin/6f9892bfab44cb1240b84d6a77f1614e to your computer and use it in GitHub Desktop.
Save hanachin/6f9892bfab44cb1240b84d6a77f1614e to your computer and use it in GitHub Desktop.
SATySFiで二項演算子や単項演算子を定義する ref: https://qiita.com/hanachin_/items/14501730a3c065d63d09
let ( ここに演算子にしたい文字列を書く ) 引数1 引数2 = 結果
let ( ここに演算子にしたい文字列を書く ) 引数1 = 結果
@require: stdja
@require: list
let ( >> ) x lst = x :: lst
let-inline \dump lst =
let d = lst |> List.fold-left (fun acc n -> acc ^ (arabic n) ^ `;`) ` ` in
embed-string (`[` ^ (string-sub d 0 ((string-length d) - 1)) ^ `]`)
in
document (|
author = { Seiei MIYAGI };
show-title = true;
show-toc = false;
title = { SATySFiで演算子定義 }
|) '<
+p {
\dump(1 >> 2 >> 3 >> []);
}
>
@require: stdja
let ( !>^..^< ) s = {\>^..^\< .o( #s;にゃん )}
let message = !>^..^< { ねむ }
in
document (|
author = { Seiei MIYAGI };
show-title = true;
show-toc = false;
title = { SATySFiで演算子定義 }
|) '<
+p { #message; }
>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment