User avatar
privTri Volpeon areon3NSmol @volpeon@icy.wyvern.rip
8mo
What I really love about it is that you can just replicate language features without changing anything about the compiler. They use async/await in the docs as an example for this. What I needed were list comprehensions, so I added
fun for(low: int, high: int, f: int -> list<b>): list<b>
  list(low, high).flatmap(f)

fun pure(a: a): list<a>
  [a]

fun guard(a : bool, f: () -> list<a>): list<a>
  if a then f() else []




and now I can use them like this:
pub fun cuboid(layers: int, rows: int, cols: int): cuboid
  val coords =
    with layer <- for(0, layers)
    with row <- for(0, rows)
    with col <- for(0, cols)
    pure((layer, row, col))
  // ...