26 lines
559 B
Plaintext
26 lines
559 B
Plaintext
import Lean
|
||
|
||
@[export my_function]
|
||
def my_function (s: String): String :=
|
||
s ++ s!" at callee"
|
||
|
||
-- Formats a string in 3 different forms
|
||
@[export stylize]
|
||
def stylize (s: String): (String × String × String) :=
|
||
(s.capitalize, s.decapitalize, s.toUpper)
|
||
|
||
inductive Think where
|
||
| Success (s: String)
|
||
| Failure (i: Nat)
|
||
|
||
@[export think]
|
||
def think (s: String): Think :=
|
||
if s.front == 'S' then
|
||
Think.Success (s.drop 1)
|
||
else
|
||
Think.Failure s.length
|
||
|
||
@[export print_in_upper]
|
||
def print_in_upper (s: String): IO Unit := do
|
||
IO.println s.toUpper
|