Skip to content

Instantly share code, notes, and snippets.

@vito
Created August 8, 2010 19:55
Show Gist options
  • Save vito/514462 to your computer and use it in GitHub Desktop.
Save vito/514462 to your computer and use it in GitHub Desktop.
val ensuring: p do: b := {
res = b call: [val]
p call: [val]
res
} call
with-output-to: (fn: String) do: b :=
Port (new: fn) ensuring: @close do: { file |
with-input-from: file do: b
}
with-output-to: (p: Port) do: b := {
current-output-port = p
join: b
} call
with-input-from: (fn: String) do: b :=
Port (new: fn) ensuring: @close do: { file |
with-input-from: file do: b
}
with-input-from: (p: Port) do: b := {
current-input-port = p
join: b
} call
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment