Created
September 3, 2024 06:42
-
-
Save nagat01/5fd0be3898d1889579b144528024f6df to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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