Skip to content

Instantly share code, notes, and snippets.

@wingeng
wingeng / hierarchy_test.go
Created October 12, 2018 01:13
Example of using gojay JSON decoder on Recursive structure
//
// An example of using gojay to decode a 'recursive' data-structure
// typical of hierarchal data used in a cli.
//
// Keywords: Decode JSON recursive
//
package main
import (
"testing"
@wingeng
wingeng / iterator.lua
Last active November 7, 2018 07:29
Description of making a stateless iterator for Lua.
-- The section describing iterators was configusing to me. http://www.lua.org/pil/7.1.html
--
-- I think it simpler to describe the 'stateless' iterator first, then
-- go into the nitty details of a 'stateful' iterator using closures.
--
--
-- Example of making an iterator in lua
--
-- The 'real' syntax for the 'for' statement is this
-- for <v> in <iter-fn>, <thing_2_iterate>, <initial-key> do