A “weeknote”, I am told is not like a blog post, and yet here I am putting this first one on my blog. I am sovereign of my domain name, I shall do as I see fit. Expect: bullet-journal style reflections. Also I think these are usually supposed to be a Friday sort of thing, but here I am writing one on a Thursday. It’s a really Friday-feeling Thursday, in my defense.

  -- calling Promise creates a Promise type
  p = seamstress.async.Promise(function()
    print('hello from the promise')
  -- output:
  -- seamstress.tui.Promise 0x[some address]
  -- 'hello from the promise'

  -- calling async creates a function which returns a Promise
  f = seamstress.async(function(x, y)
    return x + y

  -- we can either chain the Promise with `anon`
  -- (`then` is a reserved word in Lua)
  -- or when in an async context, we may `await` it
  f(5, 4):anon(function(x) print('we got ' .. x .. ' folks!') end)
  -- output:
  -- we got 9 folks!

  g = seamstress.async.Promise(function()
    local z = f(13 ,3):await()
    print('we got ' .. z .. ' this time folks!')
  -- output:
  -- we got 16 this time folks!