Open leafo opened 6 years ago
The above syntax won't work, since we need a type that represents the tuple together. Additionally, we need a default case to let check_value
match on. Maybe it will split each ngram into arrays that you then have to check?
types.array_ngram(2, types.shape { 2, types.number / function(n) return n + 1 end } + types.any)
The usecase for this was a way to optimize generated moonscript that has
--- some other code....
local hello
hello = function() end
-- some other code....
The pair of statements would represent the ngram in the array
If you have a flat array of items:
And you want to match for every n items starting from every position that yields n items. This will add 1 to every that comes after 2: