Skip to content

Instantly share code, notes, and snippets.

@hanachin
Created June 7, 2019 05:30
Show Gist options
  • Save hanachin/9dfe08bc037e3421b453dc2179795f6b to your computer and use it in GitHub Desktop.
Save hanachin/9dfe08bc037e3421b453dc2179795f6b to your computer and use it in GitHub Desktop.
stackoverflow
@stage: 0
let-rec seq-int s e =
let-rec r n =
&(
if ~n > ~e then
[]
else
~n :: ~(r &(~n + 1))
)
in
&(fun -> (
if ~e == ~s then
[~s]
else if ~e < ~s then
[]
else
~(r s)
))
@stage: 1
@require: stdja
@require: list
@import: sequence0
let-inline \example =
~(seq-int &1 &5)
|> List.map (fun i -> (arabic i))
|> List.fold-left (fun acc s -> acc ^ s) ` `
|> embed-string
in
document (|
author = { Seiei MIYAGI };
show-title = true;
show-toc = false;
title = { SATySFiで数列 }
|) '<
+p { \example; }
>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment