diff options
Diffstat (limited to 'man/man3/tomo-Table.get_or_set.3')
| -rw-r--r-- | man/man3/tomo-Table.get_or_set.3 | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/man/man3/tomo-Table.get_or_set.3 b/man/man3/tomo-Table.get_or_set.3 index d607171a..5361faf4 100644 --- a/man/man3/tomo-Table.get_or_set.3 +++ b/man/man3/tomo-Table.get_or_set.3 @@ -2,14 +2,14 @@ .\" Copyright (c) 2025 Bruce Hill .\" All rights reserved. .\" -.TH Table.get_or_set 3 2025-05-17 "Tomo man-pages" +.TH Table.get_or_set 3 2025-09-06 "Tomo man-pages" .SH NAME Table.get_or_set \- get an item or set a default if absent .SH LIBRARY Tomo Standard Library .SH SYNOPSIS .nf -.BI Table.get_or_set\ :\ func(t:\ &{K=V},\ key:\ K,\ default:\ V\ ->\ V?) +.BI Table.get_or_set\ :\ func(t:\ &{K:V},\ key:\ K,\ default:\ V\ ->\ V?) .fi .SH DESCRIPTION If the given key is in the table, return the associated value. Otherwise, insert the given default value into the table and return it. @@ -22,7 +22,7 @@ allbox; lb lb lbx lb l l l l. Name Type Description Default -t &{K=V} The table. - +t &{K:V} The table. - key K The key whose associated value is to be retrieved. - default V The default value to insert and return if the key is not present in the table. - .TE @@ -35,14 +35,14 @@ The default value is only evaluated if the key is missing. .SH EXAMPLES .EX ->> t := &{"A"=@[1, 2, 3]; default=@[]} +>> t := &{"A": @[1, 2, 3]; default=@[]} >> t.get_or_set("A").insert(4) >> t.get_or_set("B").insert(99) >> t -= &{"A"=@[1, 2, 3, 4], "B"=@[99]} += &{"A": @[1, 2, 3, 4], "B": @[99]} >> t.get_or_set("C", @[0, 0, 0]) = @[0, 0, 0] >> t -= &{"A"=@[1, 2, 3, 4], "B"=@[99], "C"=@[0, 0, 0]} += &{"A": @[1, 2, 3, 4], "B": @[99], "C": @[0, 0, 0]} .EE |
