Skip to content

Instantly share code, notes, and snippets.

@RyushiAok
Created October 9, 2023 12:56
Show Gist options
  • Save RyushiAok/e4d1c87c0d0c26370d59a395bd070c2b to your computer and use it in GitHub Desktop.
Save RyushiAok/e4d1c87c0d0c26370d59a395bd070c2b to your computer and use it in GitHub Desktop.
uncode💩
type NextChar = NextChar
type NextWidth = NextWidth of char
type NextHeight = NextHeight of char * int
type EndUnnko = EndUnnko of char * int * int
type UnnkoBuilder () =
member _.Yield(_: unit) = NextChar
member _.Run(EndUnnko (char, w, h): EndUnnko) =
let nChars n c = c |> Array.replicate n |> System.String
printfn "%s∫ ∫ ∫ " <| nChars h ' '
printfn "%sノヽ " <| nChars h ' '
for i in 1..h-1 do
printfn "%s(__%s)" ( nChars (h-i) ' ') ( nChars (i*w) char)
printfn "%s(__%s)\n" ( nChars 0 ' ') ( nChars (h*w) '_')
[<CustomOperation("char")>]
member _.MethodChar(_: NextChar, c) = NextWidth c
[<CustomOperation("width")>]
member _.MethodWidth(NextWidth c: NextWidth, w) = NextHeight (c,w)
[<CustomOperation("height")>]
member _.MethodHeight(NextHeight (c,w): NextHeight, h) = EndUnnko (c, w, h)
let unnko = UnnkoBuilder()
unnko { char ' '; width 2; height 3 }
unnko { char '.'; width 2; height 4 }
unnko { char '.'; width 3; height 6 }
(*
∫ ∫ ∫
ノヽ
(__ )
(__ )
(________)
∫ ∫ ∫
ノヽ
(__..)
(__....)
(__......)
(__________)
∫ ∫ ∫
ノヽ
(__...)
(__......)
(__.........)
(__............)
(__...............)
(____________________)
*)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment