Skip to content

Instantly share code, notes, and snippets.

@lepinekong
Created December 28, 2017 13:23
Show Gist options
  • Save lepinekong/191f146659d058ed257b0edaea256e0a to your computer and use it in GitHub Desktop.
Save lepinekong/191f146659d058ed257b0edaea256e0a to your computer and use it in GitHub Desktop.
?? counter by @9214
context [
counter: 0
set '?? func ['value /reset][
if reset [counter: 0]
counter: counter + 1
print rejoin [
"[" counter "]" tab value ":" space
mold get/any value
]
]
]
>> foo: has [a sub][a: 1 ??/reset a sub: has [b c][b: 2 ?? b c: 3 ?? c] sub]
== func [/local a sub][a: 1 ??/reset a sub: has [b c] [b: 2 ?? b c: 3 ?? c] sub]
>> foo
[1] a: 1
[2] b: 2
[3] c: 3
>> foo
[1] a: 1
[2] b: 2
[3] c: 3
>> ?? abracadabra
[4] abracadabra: unset
>> ??/reset whatever
[1] whatever: unset
>> whatever: 'something
== something
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment