Home Blog CV Projects Patterns Notes Book Colophon Search

Whittled Example

3 Feb, 2017

log(args): 
  args.stdout.write(args.msg)
  {stdout, level="debug", topic="log", msg, correlation} = args
  formatted = `{level}[{topic}:{correlation}] {msg}\n`
  `{level="debug"}[{topic}:{correlation}] {msg}\n` = formatted
  stdout.write(formatted)
  if true:
    throw error({msg: "Not true"})
  newlog(args): resolve(log({}, {topic: "Error"}, args))
  return {newlog}

{stdout} = import('os')
newlog = log({stdout})
newlog({msg: "Hello"})

Copyright James Gardner 1996-2020 All Rights Reserved. Admin.