Skip to content

Instantly share code, notes, and snippets.

@nagat01
Created September 3, 2024 06:42
Show Gist options
  • Save nagat01/5fd0be3898d1889579b144528024f6df to your computer and use it in GitHub Desktop.
Save nagat01/5fd0be3898d1889579b144528024f6df to your computer and use it in GitHub Desktop.
import scala.collection.mutable.ArrayBuffer
type A = ArrayBuffer[Int]
def builder (init: A ?=> Unit) =
given e: A = new A
init
e
def add(x: Int)(using e: A) =
e += x
@main def main =
println(builder {
add(1)
add(2)
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment