diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2018-11-11 15:50:46 -0800 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2018-11-11 15:50:46 -0800 |
| commit | 4efe44ed271aeed8e25e909344788d92a0d9f82b (patch) | |
| tree | 73766440b53031d4fc8210dbe3b0aece47e6b852 /core/id.nom | |
| parent | ba03cb67c3c8ba53451eba25dd2186f095cd1db2 (diff) | |
Fully upgraded to 4.10.12.7, including deprecating the old list/dict
comprehension methods, in favor of the new native support.
Diffstat (limited to 'core/id.nom')
| -rw-r--r-- | core/id.nom | 33 |
1 files changed, 17 insertions, 16 deletions
diff --git a/core/id.nom b/core/id.nom index 8875696..9cf5820 100644 --- a/core/id.nom +++ b/core/id.nom @@ -1,7 +1,7 @@ -#!/usr/bin/env nomsu -V4.8.10 +#!/usr/bin/env nomsu -V4.10.12.7 # A simple UUID function based on RFC 4122: http://www.ietf.org/rfc/rfc4122.txt - + use "core/metaprogramming.nom" use "core/operators.nom" use "core/math.nom" @@ -13,21 +13,22 @@ use "core/control_flow.nom" %NaN_surrogate = {} %nil_surrogate = {} %obj_by_id = {} -set %obj_by_id's metatable to {__mode:"v"} +set %obj_by_id's metatable to {__mode: "v"} %id_by_obj = {} -set %id_by_obj 's metatable to {..} - __mode:"k", __index: (..) - [%self, %key] ->: - if (%key == (nil)): - return %self.%nil_surrogate - if (%key != %key): - return %self.%NaN_surrogate - --- (retry) --- - %id = (uuid) - if (%obj_by_id.%id != (nil)): go to (retry) - %self.%key = %id - %obj_by_id.%id = %key - return %id +set %id_by_obj's metatable to {..} + __mode: "k", __index: [%self, %key] ->: + if (%key == (nil)): + return %self.%nil_surrogate + + if (%key != %key): + return %self.%NaN_surrogate + + --- (retry) --- + %id = (uuid) + if (%obj_by_id.%id != (nil)): go to (retry) + %self.%key = %id + %obj_by_id.%id = %key + return %id externally (uuid) means: # Set all the other bits to randomly (or pseudo-randomly) chosen values. |
