mirror of
https://github.com/go-sylixos/elvish.git
synced 2024-12-15 03:37:52 +08:00
25 lines
395 B
Go
25 lines
395 B
Go
package eval
|
|
|
|
import "errors"
|
|
|
|
var mustBeListOfFnValue = errors.New("must be a list of fn")
|
|
|
|
func IsListOfFnValue(v Value) error {
|
|
li, ok := v.(ListLike)
|
|
if !ok {
|
|
return mustBeListOfFnValue
|
|
}
|
|
listok := true
|
|
li.Iterate(func(v Value) bool {
|
|
if _, ok := v.(FnValue); !ok {
|
|
listok = false
|
|
return false
|
|
}
|
|
return true
|
|
})
|
|
if !listok {
|
|
return mustBeListOfFnValue
|
|
}
|
|
return nil
|
|
}
|