4
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

SATySFiでQuine

Last updated at Posted at 2021-12-18

SATySFiでQuine

やってるのを見かけなかったので.output,pdfともにquineになってるはずです.
↓のリンクを開いてpdfのコードをコピーするか,Chromeやお使いのOSに入っているpdf viewerで開いてコピーしてお手元のsatysfiコンパイラかplaygroundに食わせると同じ文字列が出力されるはずです.
permlink

let code = `let code = $@$ let (ss,sl,su) = (string-sub,string-length,string-unexplode) let-rec s2cl s = if sl s == 0 then [] else ss s 0 1 :: s2cl (ss s 1 (sl s - 1)) let q s = let-rec qa cl = match cl with | [] -> su [] | c :: l -> let f d = string-same c (su [d]) in (if f 64 then s else if f 36 then su [96] else c) ^ qa l in let s = qa (s2cl s) in let () = display-message s in s let-inline \d _ = {} let gic l = get-initial-context l (command \d) let qb = (read-inline (gic 4pt) (embed-string (q code))) let (w, h, d) = get-natural-metrics qb let (w, h) = (w +' 12pt, h +' d +' 12pt) in page-break (UserDefinedPaper(w +' 12pt, h)) (fun _ -> (|text-origin = (6pt, 6pt); text-height = h;|)) (fun _ -> (|header-origin = (0pt, 0pt); header-content = block-nil; footer-origin = (0pt, 0pt); footer-content = block-nil;|)) (line-break true true (gic w) qb)` let (ss,sl,su) = (string-sub,string-length,string-unexplode) let-rec s2cl s = if sl s == 0 then [] else ss s 0 1 :: s2cl (ss s 1 (sl s - 1)) let q s = let-rec qa cl = match cl with | [] -> su [] | c :: l -> let f d = string-same c (su [d]) in (if f 64 then s else if f 36 then su [96] else c) ^ qa l in let s = qa (s2cl s) in let () = display-message s in s let-inline \d _ = {} let gic l = get-initial-context l (command \d) let qb = (read-inline (gic 4pt) (embed-string (q code))) let (w, h, d) = get-natural-metrics qb let (w, h) = (w +' 12pt, h +' d +' 12pt) in page-break (UserDefinedPaper(w +' 12pt, h)) (fun _ -> (|text-origin = (6pt, 6pt); text-height = h;|)) (fun _ -> (|header-origin = (0pt, 0pt); header-content = block-nil; footer-origin = (0pt, 0pt); footer-content = block-nil;|)) (line-break true true (gic w) qb)
4
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
4
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?