Baseline: tree as shared
This commit is contained in:
commit
659c03bbf8
1471 files changed
+990535
No files matched your search
@@ -0,0 +1,20 @@
|
||||
// A HASHMAP of LISTs built up, then printed in sorted key order with KEYS.
|
||||
// Finding: the list cannot be called Keys, because built-in names are reserved whatever their case.
|
||||
// EXPECT: a: [1, 3]
|
||||
// EXPECT: b: [2]
|
||||
DECLARE Groups : HASHMAP OF STRING : LIST OF INTEGER
|
||||
DECLARE Ks : LIST OF STRING
|
||||
DECLARE Names : LIST OF STRING
|
||||
DECLARE Values : LIST OF INTEGER
|
||||
Names <- ["a", "b", "a"]
|
||||
Values <- [1, 2, 3]
|
||||
FOR I <- 0 TO LENGTH(Names)
|
||||
IF NOT (Names[I] IN Groups) THEN
|
||||
Groups[Names[I]] <- []
|
||||
ENDIF
|
||||
APPEND(Groups[Names[I]], Values[I])
|
||||
NEXT I
|
||||
Ks <- KEYS(Groups)
|
||||
FOR EACH K IN Ks
|
||||
OUTPUT K & ": " & TO_STRING(Groups[K])
|
||||
NEXT K
|
||||
Reference in new issue
Block a user