MCPcopy
hub / github.com/google/mangle / ListValues

Method ListValues

ast/ast.go:495–505  ·  view source on GitHub ↗

ListValues provides the constants that make up the list via callback.

(cbCons func(Constant) error, cbNil func() error)

Source from the content-addressed store, hash-verified

493
494// ListValues provides the constants that make up the list via callback.
495func (c Constant) ListValues(cbCons func(Constant) error, cbNil func() error) (error, error) {
496 if c.Type != ListShape {
497 return fmt.Errorf("not a list constant %v", c), nil
498 }
499 for ; !c.IsListNil(); c = *c.snd {
500 if err := cbCons(*c.fst); err != nil {
501 return nil, err
502 }
503 }
504 return nil, cbNil()
505}
506
507// ListSeq returns an iterator over the list elements.
508func (c Constant) ListSeq() (iter.Seq[Constant], error) {

Callers 5

boundOfArgFunction · 0.80
TestListConstantFunction · 0.80
HasTypeMethod · 0.80
DecideFunction · 0.80
EvalApplyFnFunction · 0.80

Calls 1

IsListNilMethod · 0.95

Tested by 1

TestListConstantFunction · 0.64