unison/unison-src/transcripts/scope-ref.md
Dan Doel bdd222a086 Transcripts
- Includes a new test transcript for ref usage
2021-08-24 12:20:23 -04:00

264 B

A short script to test mutable references with local scope.

.> builtins.mergeio
test = Scope.run 'let
  r = Scope.ref 0
  Ref.write r 1
  i = Ref.read r
  Ref.write r 2
  j = Ref.read r
  Ref.write r 5
  (i, j, Ref.read r)

> test