Add isRecord(…) with arity descriminator
This commit is contained in:
parent
786342c39b
commit
5d3f7b94a3
|
@ -411,6 +411,12 @@ func isRecord*(pr: Preserve; label: string): bool {.inline.} =
|
|||
pr.record.len > 0 and
|
||||
pr.label.isSymbol(label)
|
||||
|
||||
func isRecord*(pr: Preserve; label: string; arity: Natural): bool {.inline.} =
|
||||
## Check if ``pr`` is a Preserves record with the given label symbol and field arity.
|
||||
pr.kind == pkRecord and
|
||||
pr.record.len == succ(arity) and
|
||||
pr.label.isSymbol(label)
|
||||
|
||||
proc isSequence*(pr: Preserve): bool {.inline.} = pr.kind == pkSequence
|
||||
## Check if ``pr`` is a Preserves sequence.
|
||||
|
||||
|
|
Loading…
Reference in New Issue