Arc Forumnew | comments | leaders | submitlogin
4 points by akkartik 1897 days ago | link | parent

A couple of other likely-crappy abstractions that I'd made long ago in similar vein:

once-only: execute arbitrary code but only the first time it's encountered. https://github.com/akkartik/readwarp/blob/master/utils.arc#1

init: like assign, but only if name isn't already bound. For arbitrary variables besides tables. https://github.com/akkartik/readwarp/blob/master/utils.arc#L...

inittab: probably same as your proposal, just a different name. Even uses `or=` under the hood. https://github.com/akkartik/readwarp/blob/master/utils.arc#L...