> even mid-expression
well you can define procs anywhere you can define vars. like:
let x =
if false: 0
else:
proc foo(x: int): int = x*2 + 1
foo(3)
Run
or
type Foo = object
x: int
let foo = Foo(
x: block:
proc factorial(i: int): int =
if i <= 1: 1
else: i * factorial(i-1)
factorial(5)
)
Run
> I found out about the sugar package but it still doesn't allow
the `=>` macro just gives syntactic sugar for defining anonymous procs, so your
`=>` version gets extended to the exact same thing
