LoginSignup
2
0

More than 5 years have passed since last update.

SATySFiで可変な変数を使う

Posted at

let-mutableで宣言する。参照するときは変数の頭に!をつける。
上書きして代入するときはlet () = 変数名 <- 新しい値のような形で入れ直す。

@require: stdja

let-mutable count <- 0

let-inline \counter =
  let c = !count in
  let () = count <- !count + 1 in
  embed-string (arabic c)
in

document (|
  author = { Seiei MIYAGI };
  show-title = true;
  show-toc = false;
  title = { SATySFiで可変な変数を使う }
|) '<
 +p {
   \counter;
   \counter;
   \counter;
   \counter;
   \counter;
   \counter;
   \counter;
   \counter;
   \counter;
   \counter;
 }
>

実行結果

Screenshot from 2018-10-20 11-54-53.png

2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0