From 4efe44ed271aeed8e25e909344788d92a0d9f82b Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Sun, 11 Nov 2018 15:50:46 -0800 Subject: Fully upgraded to 4.10.12.7, including deprecating the old list/dict comprehension methods, in favor of the new native support. --- core/id.nom | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) (limited to 'core/id.nom') 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. -- cgit v1.2.3