package vals
Import Path
src.elv.sh/pkg/eval/vals (on go.dev)
Dependency Relation
imports 19 packages, and imported by 10 packages
Involved Source Files
aliased_types.go
assoc.go
bool.go
concat.go
conversion.go
dissoc.go
Package vals contains basic facilities for manipulating values used in the
Elvish runtime.
equal.go
feed.go
has_key.go
hash.go
index.go
index_list.go
index_string.go
iterate.go
iterate_keys.go
kind.go
len.go
num.go
pipe.go
reflect_wrappers.go
repr.go
repr_helpers.go
string.go
struct_map.go
testutils.go
Package-Level Type Names (total 38, in which 29 are exported)
Assocer wraps the Assoc method.
Assoc returns a slightly modified version of the receiver with key k
associated with value v.
src.elv.sh/pkg/edit.bindingsMap
Booler wraps the Bool method.
Bool computes the truth value of the receiver.
reflect.Value
*src.elv.sh/pkg/eval.exception
Concatter wraps the Concat method. See Concat for how it is used.
Concat concatenates the receiver with another value, the receiver being
the left operand. If concatenation is not supported for the given value,
the method can return the special error type ErrCatNotImplemented.
*src.elv.sh/pkg/ui.Segment
src.elv.sh/pkg/ui.Text
src.elv.sh/pkg/eval.globPattern
Dissocer wraps the Dissoc method.
Dissoc returns a slightly modified version of the receiver with key k
dissociated with any value.
src.elv.sh/pkg/edit.bindingsMap
Equaler wraps the Equal method.
Equal compares the receiver to another value. Two equal values must have
the same hash code.
Pipe
*src.elv.sh/pkg/eval.Ns
src.elv.sh/pkg/ui.Key
*src.elv.sh/pkg/eval.closure
*src.elv.sh/pkg/eval.exception
src.elv.sh/pkg/eval.externalCmd
*src.elv.sh/pkg/eval.goFn
src.elv.sh/pkg/edit.complexItem
ErrIndexer wraps the Index method.
Index retrieves one value from the receiver at the specified index.
src.elv.sh/pkg/ui.Text
src.elv.sh/pkg/eval.globPattern
src.elv.sh/pkg/edit.bindingsMap
File is an alias for *os.File.
var src.elv.sh/pkg/eval.DevNull
var os.Stderr
var os.Stdin
var os.Stdout
var src.elv.sh/pkg/logutil.outFile
var testing.testlogFile
Hasher wraps the Hash method.
Hash computes the hash code of the receiver.
Pipe
*src.elv.sh/pkg/eval.Ns
src.elv.sh/pkg/ui.Key
*src.elv.sh/pkg/eval.closure
*src.elv.sh/pkg/eval.exception
src.elv.sh/pkg/eval.externalCmd
*src.elv.sh/pkg/eval.goFn
src.elv.sh/pkg/edit.complexItem
HasKeyer wraps the HasKey method.
HasKey returns whether the receiver has the given argument as a valid
key.
src.elv.sh/pkg/edit.bindingsMap
Indexer wraps the Index method.
Index retrieves the value corresponding to the specified key in the
container. It returns the value (if any), and whether it actually exists.
*src.elv.sh/pkg/eval.Ns
src.elv.sh/pkg/persistent/hashmap.Map (interface)
*src.elv.sh/pkg/ui.Segment
src.elv.sh/pkg/edit.complexItem
*src.elv.sh/pkg/persistent/hashmap.hashMap
Iterator wraps the Iterate method.
Iterate calls the passed function with each value within the receiver.
The iteration is aborted if the function returns false.
KeysIterator wraps the IterateKeys method.
IterateKeys calls the passed function with each key within the receiver.
The iteration is aborted if the function returns false.
*src.elv.sh/pkg/eval.Ns
*src.elv.sh/pkg/ui.Segment
src.elv.sh/pkg/ui.Text
src.elv.sh/pkg/edit.complexItem
Kinder wraps the Kind method.
( T) Kind() string
Pipe
*src.elv.sh/pkg/eval.Ns
src.elv.sh/pkg/ui.Key
*src.elv.sh/pkg/ui.Segment
src.elv.sh/pkg/ui.Text
*src.elv.sh/pkg/eval.closure
*src.elv.sh/pkg/eval.exception
src.elv.sh/pkg/eval.externalCmd
*src.elv.sh/pkg/eval.goFn
src.elv.sh/pkg/edit.complexItem
Lener wraps the Len method.
Len computes the length of the receiver.
src.elv.sh/pkg/cli/tk.Items (interface)
src.elv.sh/pkg/cli/tk.TestItems
src.elv.sh/pkg/persistent/hashmap.Map (interface)
src.elv.sh/pkg/persistent/list.List (interface)
src.elv.sh/pkg/persistent/vector.Vector (interface)
src.elv.sh/pkg/ui.Keys
*bytes.Buffer
*bytes.Reader
*container/list.List
*internal/fmtsort.SortedMap
internal/reflectlite.Value
reflect.Type (interface)
reflect.Value
sort.Float64Slice
sort.Interface (interface)
sort.IntSlice
sort.StringSlice
*strings.Builder
*strings.Reader
src.elv.sh/pkg/cli/mode.completionItems
src.elv.sh/pkg/cli/mode.fileItems
src.elv.sh/pkg/cli/mode.histlistItems
src.elv.sh/pkg/cli/mode.lastcmdItems
src.elv.sh/pkg/cli/mode.listingItems
src.elv.sh/pkg/cli/mode.locationList
src.elv.sh/pkg/edit.bindingsMap
*src.elv.sh/pkg/persistent/hashmap.hashMap
*src.elv.sh/pkg/persistent/list.list
*src.elv.sh/pkg/persistent/vector.subVector
*src.elv.sh/pkg/persistent/vector.vector
src.elv.sh/pkg/store.dirList
compress/flate.byFreq
compress/flate.byLiteral
encoding/asn1.bitStringEncoder
encoding/asn1.byteEncoder
encoding/asn1.bytesEncoder
encoding/asn1.encoder (interface)
encoding/asn1.int64Encoder
encoding/asn1.multiEncoder
encoding/asn1.oidEncoder
encoding/asn1.setEncoder
encoding/asn1.stringEncoder
*encoding/asn1.taggedEncoder
*encoding/gob.decBuffer
*encoding/gob.encBuffer
encoding/json.byIndex
*encoding/json.encodeState
go.etcd.io/bbolt.nodes
go.etcd.io/bbolt.pages
go.etcd.io/bbolt.pgids
go.etcd.io/bbolt.txsById
*internal/reflectlite.arrayType
*internal/reflectlite.chanType
*internal/reflectlite.funcType
*internal/reflectlite.interfaceType
*internal/reflectlite.mapType
*internal/reflectlite.ptrType
*internal/reflectlite.rtype
*internal/reflectlite.sliceType
*internal/reflectlite.structType
*internal/reflectlite.structTypeUncommon
net.byMaskLength
net.byPref
net.byPriorityWeight
*net.byRFC6724
*net/http.headerSorter
*net/http.http2dataBuffer
*net/http.http2pipe
net/http.http2pipeBuffer (interface)
*net/http.http2sorter
net/http.http2sortPriorityNodeSiblings
*reflect.arrayType
*reflect.chanType
*reflect.funcType
*reflect.funcTypeFixed128
*reflect.funcTypeFixed16
*reflect.funcTypeFixed32
*reflect.funcTypeFixed4
*reflect.funcTypeFixed64
*reflect.funcTypeFixed8
*reflect.interfaceType
*reflect.mapType
*reflect.ptrType
*reflect.rtype
*reflect.sliceType
*reflect.structType
*reflect.structTypeUncommon
regexp.runeSlice
regexp/syntax.ranges
runtime/pprof.countProfile (interface)
*runtime/pprof.keysByCount
*runtime/pprof.runtimeProfile
runtime/pprof.stackProfile
sort.reverse
vendor/golang.org/x/text/unicode/bidi.bracketPairs
*vendor/golang.org/x/text/unicode/bidi.isolatingRunSequence
*vendor/golang.org/x/text/unicode/bidi.paragraph
List is an alias for the underlying type used for lists in Elvish.
ListIndex represents a (converted) list index.
Lower int
Slice bool
Upper int
func ConvertListIndex(rawIndex interface{}, n int) (*ListIndex, error)
ListReprBuilder helps to build Repr of list-like Values.
buf bytes.Buffer
indent int
String returns the representation that has been built. After it is called,
the ListReprBuilder may no longer be used.
WriteElem writes a new element.
*T : Stringer
*T : fmt.Stringer
*T : context.stringer
*T : os/signal.stringer
*T : runtime.stringer
func NewListReprBuilder(indent int) *ListReprBuilder
Map is an alias for the underlying type used for maps in Elvish.
MapReprBuilder helps building the Repr of a Map. It is also useful for
implementing other Map-like values. The zero value of a MapReprBuilder is
ready to use.
inner ListReprBuilder
String returns the representation that has been built. After it is called,
the MapReprBuilder should no longer be used.
WritePair writes a new pair.
*T : Stringer
*T : fmt.Stringer
*T : context.stringer
*T : os/signal.stringer
*T : runtime.stringer
func NewMapReprBuilder(indent int) *MapReprBuilder
Num is a stand-in type for int, *big.Int, *big.Rat or float64. This type
doesn't offer type safety, but is useful as a marker; for example, it is
respected when parsing function arguments.
func NormalizeBigInt(z *big.Int) Num
func NormalizeBigRat(z *big.Rat) Num
func ParseNum(s string) Num
func elvToNum(arg interface{}) (Num, error)
func src.elv.sh/pkg/eval.add(rawNums ...Num) Num
func src.elv.sh/pkg/eval.div(rawNums ...Num) (Num, error)
func src.elv.sh/pkg/eval.exactNum(n Num) (Num, error)
func src.elv.sh/pkg/eval.mul(rawNums ...Num) Num
func src.elv.sh/pkg/eval.num(n Num) Num
func src.elv.sh/pkg/eval.sub(rawNums ...Num) (Num, error)
func UnifyNums(nums []Num, typ NumType) NumSlice
func getNumType(n Num) NumType
func src.elv.sh/pkg/eval.add(rawNums ...Num) Num
func src.elv.sh/pkg/eval.chainCompare(nums []Num, p1 func(a, b int) bool, p2 func(a, b *big.Int) bool, p3 func(a, b *big.Rat) bool, p4 func(a, b float64) bool) bool
func src.elv.sh/pkg/eval.div(rawNums ...Num) (Num, error)
func src.elv.sh/pkg/eval.eqNum(nums ...Num) bool
func src.elv.sh/pkg/eval.exactNum(n Num) (Num, error)
func src.elv.sh/pkg/eval.ge(nums ...Num) bool
func src.elv.sh/pkg/eval.gt(nums ...Num) bool
func src.elv.sh/pkg/eval.le(nums ...Num) bool
func src.elv.sh/pkg/eval.lt(nums ...Num) bool
func src.elv.sh/pkg/eval.mul(rawNums ...Num) Num
func src.elv.sh/pkg/eval.ne(nums ...Num) bool
func src.elv.sh/pkg/eval.num(n Num) Num
func src.elv.sh/pkg/eval.rangeFn(fm *eval.Frame, opts eval.rangeOpts, args ...Num) error
func src.elv.sh/pkg/eval.slash(fm *eval.Frame, args ...Num) error
func src.elv.sh/pkg/eval.sub(rawNums ...Num) (Num, error)
NumSlice is a stand-in type for []int, []*big.Int, []*big.Rat or []float64.
This type doesn't offer type safety, but is useful as a marker.
func UnifyNums(nums []Num, typ NumType) NumSlice
NumType represents a number type.
func getNumType(n Num) NumType
func UnifyNums(nums []Num, typ NumType) NumSlice
const BigInt
const BigRat
const Float64
const Int
Pipe wraps a pair of pointers to os.File that are the two ends of the same
pipe.
ReadEnd *os.File
WriteEnd *os.File
Equal compares based on the equality of the two consistuent files.
Hash calculates the hash based on the two consituent files.
Kind returns "pipe".
Repr writes an opaque representation containing the FDs of the two
constituent files.
T : Equaler
T : Hasher
T : Kinder
T : Reprer
func NewPipe(r, w *os.File) Pipe
func src.elv.sh/pkg/eval.pipe() (Pipe, error)
func src.elv.sh/pkg/eval/mods/file.pipe() (Pipe, error)
func src.elv.sh/pkg/eval.prclose(p Pipe) error
func src.elv.sh/pkg/eval.pwclose(p Pipe) error
func src.elv.sh/pkg/eval/mods/file.prclose(p Pipe) error
func src.elv.sh/pkg/eval/mods/file.pwclose(p Pipe) error
PseudoStructMap may be implemented by a type to derive the Repr, Index,
HasKey and IterateKeys operations from the struct map returned by the Fields
method.
( T) Fields() StructMap
src.elv.sh/pkg/eval.ExternalCmdExit
src.elv.sh/pkg/eval.FailError
src.elv.sh/pkg/eval.Flow
src.elv.sh/pkg/eval.PipelineError
*src.elv.sh/pkg/eval.closure
*src.elv.sh/pkg/eval.exception
RConcatter wraps the RConcat method. See Concat for how it is used.
( T) RConcat(v interface{}) (interface{}, error)
*src.elv.sh/pkg/ui.Segment
src.elv.sh/pkg/ui.Text
src.elv.sh/pkg/eval.globPattern
Reprer wraps the Repr method.
Repr returns a string that represents a Value. The string either be a
literal of that Value that is preferably deep-equal to it (like `[a b c]`
for a list), or a string enclosed in "<>" containing the kind and
identity of the Value(like `<fn 0xdeadcafe>`).
If indent is at least 0, it should be pretty-printed with the current
indentation level of indent; the indent of the first line has already
been written and shall not be written in Repr. The returned string
should never contain a trailing newline.
Pipe
*src.elv.sh/pkg/eval.Ns
src.elv.sh/pkg/parse.Source
src.elv.sh/pkg/ui.Key
*src.elv.sh/pkg/ui.Segment
src.elv.sh/pkg/ui.Text
*src.elv.sh/pkg/eval.closure
*src.elv.sh/pkg/eval.exception
src.elv.sh/pkg/eval.externalCmd
*src.elv.sh/pkg/eval.goFn
src.elv.sh/pkg/edit.bindingsMap
src.elv.sh/pkg/edit.complexItem
Stringer wraps the String method.
( T) String() string
*ListReprBuilder
*MapReprBuilder
src.elv.sh/pkg/edit/complete.ComplexItem
src.elv.sh/pkg/edit/complete.PlainItem
src.elv.sh/pkg/edit/complete.RawItem (interface)
src.elv.sh/pkg/getopt.Config
src.elv.sh/pkg/getopt.ContextType
src.elv.sh/pkg/getopt.HasArg
src.elv.sh/pkg/parse.ExprCtx
src.elv.sh/pkg/parse.PrimaryType
src.elv.sh/pkg/parse.RedirMode
src.elv.sh/pkg/ui.Color (interface)
src.elv.sh/pkg/ui.Key
*src.elv.sh/pkg/ui.Segment
src.elv.sh/pkg/ui.Text
*bytes.Buffer
crypto.Hash
crypto/tls.ClientAuthType
crypto/tls.CurveID
crypto/tls.SignatureScheme
crypto/x509.PublicKeyAlgorithm
crypto/x509.SignatureAlgorithm
crypto/x509/pkix.Name
crypto/x509/pkix.RDNSequence
encoding/asn1.ObjectIdentifier
encoding/binary.ByteOrder (interface)
encoding/json.Delim
encoding/json.Number
flag.Getter (interface)
flag.Value (interface)
fmt.Stringer (interface)
*go.etcd.io/bbolt.DB
go/token.Position
go/token.Token
internal/reflectlite.Kind
internal/reflectlite.Type (interface)
io/fs.FileMode
math/big.Accuracy
*math/big.Float
*math/big.Int
*math/big.Rat
math/big.RoundingMode
net.Addr (interface)
net.Flags
net.HardwareAddr
net.IP
*net.IPAddr
net.IPMask
*net.IPNet
*net.TCPAddr
*net.UDPAddr
*net.UnixAddr
net/http.ConnState
*net/http.Cookie
*net/url.URL
*net/url.Userinfo
*os.ProcessState
os.Signal (interface)
*os/exec.Cmd
os/exec.ExitError
reflect.ChanDir
reflect.Kind
reflect.Type (interface)
reflect.Value
*regexp.Regexp
regexp/syntax.ErrorCode
*regexp/syntax.Inst
regexp/syntax.InstOp
regexp/syntax.Op
*regexp/syntax.Prog
*regexp/syntax.Regexp
*strings.Builder
syscall.Signal
testing.BenchmarkResult
time.Duration
*time.Location
time.Month
time.Time
time.Weekday
vendor/golang.org/x/net/dns/dnsmessage.Class
vendor/golang.org/x/net/dns/dnsmessage.Name
vendor/golang.org/x/net/dns/dnsmessage.RCode
vendor/golang.org/x/net/dns/dnsmessage.Type
vendor/golang.org/x/net/http2/hpack.HeaderField
*vendor/golang.org/x/net/idna.Profile
*vendor/golang.org/x/text/unicode/bidi.Run
src.elv.sh/pkg/edit/complete.noQuoteItem
src.elv.sh/pkg/ui.ansiBrightColor
src.elv.sh/pkg/ui.ansiColor
src.elv.sh/pkg/ui.trueColor
src.elv.sh/pkg/ui.xterm256Color
*context.cancelCtx
*context.emptyCtx
context.stringer (interface)
*context.timerCtx
*context.valueCtx
crypto/tls.alert
encoding/binary.bigEndian
encoding/binary.littleEndian
*encoding/json.encodeState
flag.boolFlag (interface)
*flag.boolValue
*flag.durationValue
*flag.float64Value
flag.funcValue
*flag.int64Value
*flag.intValue
*flag.stringValue
*flag.uint64Value
*flag.uintValue
*internal/reflectlite.arrayType
*internal/reflectlite.chanType
*internal/reflectlite.funcType
*internal/reflectlite.interfaceType
*internal/reflectlite.mapType
*internal/reflectlite.ptrType
*internal/reflectlite.rtype
*internal/reflectlite.sliceType
*internal/reflectlite.structType
*internal/reflectlite.structTypeUncommon
*math/big.decimal
net.fileAddr
net.hostLookupOrder
net.pipeAddr
net.sockaddr (interface)
net/http.connectMethodKey
*net/http.contextKey
net/http.http2ContinuationFrame
net/http.http2DataFrame
net/http.http2ErrCode
net/http.http2FrameHeader
net/http.http2FrameType
net/http.http2FrameWriteRequest
net/http.http2GoAwayFrame
net/http.http2HeadersFrame
net/http.http2MetaHeadersFrame
net/http.http2PingFrame
net/http.http2PriorityFrame
net/http.http2PushPromiseFrame
net/http.http2RSTStreamFrame
net/http.http2Setting
net/http.http2SettingID
net/http.http2SettingsFrame
net/http.http2streamState
net/http.http2UnknownFrame
net/http.http2WindowUpdateFrame
*net/http.http2writeData
*net/http.socksAddr
net/http.socksCommand
net/http.socksReply
*os/signal.signalCtx
os/signal.stringer (interface)
*reflect.arrayType
*reflect.chanType
*reflect.funcType
*reflect.funcTypeFixed128
*reflect.funcTypeFixed16
*reflect.funcTypeFixed32
*reflect.funcTypeFixed4
*reflect.funcTypeFixed64
*reflect.funcTypeFixed8
*reflect.interfaceType
*reflect.mapType
*reflect.ptrType
*reflect.rtype
*reflect.sliceType
*reflect.structType
*reflect.structTypeUncommon
*regexp.onePassInst
runtime.lockRank
runtime.stringer (interface)
runtime.waitReason
*runtime/pprof.labelMap
*strconv.decimal
*testing.benchTimeFlag
*vendor/golang.org/x/text/unicode/bidi.bracketPair
T : fmt.Stringer
T : context.stringer
T : os/signal.stringer
T : runtime.stringer
StructMap may be implemented by a struct to mark the struct as a "struct
map", which causes Elvish to treat it like a read-only map. Each exported,
named field and getter method (a method taking no argument and returning one
value) becomes a field of the map, with the name mapped to dash-case.
The following operations are derived for structmaps: Kind, Repr, Hash, Len,
Index, HasKey and IterateKeys.
Example:
type someStruct struct {
FooBar int
lorem string
}
func (someStruct) IsStructMap() { }
func (s SomeStruct) Ipsum() string { return s.lorem }
func (s SomeStruct) OtherMethod(int) { }
An instance of someStruct behaves like a read-only map with 3 fields:
foo-bar, lorem and ipsum.
( T) IsStructMap()
src.elv.sh/pkg/parse.Source
src.elv.sh/pkg/eval.closureFields
src.elv.sh/pkg/eval.dirHistoryEntry
src.elv.sh/pkg/eval.excFields
src.elv.sh/pkg/eval.exitFieldsCommon
src.elv.sh/pkg/eval.exitFieldsExited
src.elv.sh/pkg/eval.exitFieldsSignaled
src.elv.sh/pkg/eval.exitFieldsStopped
src.elv.sh/pkg/eval.exitFieldsUnknown
src.elv.sh/pkg/eval.failFields
src.elv.sh/pkg/eval.flowFields
src.elv.sh/pkg/eval.peFields
src.elv.sh/pkg/eval/mods/re.matchStruct
src.elv.sh/pkg/eval/mods/re.submatchStruct
func PseudoStructMap.Fields() StructMap
func src.elv.sh/pkg/eval.ExternalCmdExit.Fields() StructMap
func src.elv.sh/pkg/eval.FailError.Fields() StructMap
func src.elv.sh/pkg/eval.Flow.Fields() StructMap
func src.elv.sh/pkg/eval.PipelineError.Fields() StructMap
func equalStructMap(x, y StructMap) bool
func hasKeyStructMap(m StructMap, k interface{}) bool
func indexStructMap(a StructMap, k interface{}) (interface{}, error)
func iterateKeysStructMap(v StructMap, f func(interface{}) bool)
func reprStructMap(v StructMap, indent int) string
ValueTester is a helper for testing properties of a value.
t *testing.T
v interface{}
AllKeys tests that the given keys match what the result of IterateKeys on the
value.
NOTE: This now checks equality using reflect.DeepEqual, since all the builtin
types have string keys. This can be changed in future to use Equal is the
need arises.
Assoc tests that Assoc'ing the value with the given key-value pair returns
the wanted new value and no error.
AssocError tests that Assoc'ing the value with the given key-value pair
returns the given error.
Bool tests the Boool of the value.
Equal tests that the value is Equal to every of the given values.
HasKey tests that the value has each of the given keys.
HasNoKey tests that the value does not have any of the given keys.
Hash tests the Hash of the value.
Index tests that Index'ing the value with the given key returns the wanted value
and no error.
IndexError tests that Index'ing the value with the given key returns the given
error.
Kind tests the Kind of the value.
Len tests the Len of the value.
NotEqual tests that the value is not Equal to any of the given values.
Repr tests the Repr of the value.
func TestValue(t *testing.T, v interface{}) ValueTester
func ValueTester.AllKeys(wantKeys ...interface{}) ValueTester
func ValueTester.Assoc(key, val, wantNew interface{}) ValueTester
func ValueTester.AssocError(key, val interface{}, wantErr error) ValueTester
func ValueTester.Bool(wantBool bool) ValueTester
func ValueTester.Equal(others ...interface{}) ValueTester
func ValueTester.Hash(wantHash uint32) ValueTester
func ValueTester.HasKey(keys ...interface{}) ValueTester
func ValueTester.HasNoKey(keys ...interface{}) ValueTester
func ValueTester.Index(key, wantVal interface{}) ValueTester
func ValueTester.IndexError(key interface{}, wantErr error) ValueTester
func ValueTester.Kind(wantKind string) ValueTester
func ValueTester.Len(wantLen int) ValueTester
func ValueTester.NotEqual(others ...interface{}) ValueTester
func ValueTester.Repr(wantRepr string) ValueTester
Package-Level Functions (total 67, in which 34 are exported)
Assoc takes a container, a key and value, and returns a modified version of
the container, in which the key associated with the value. It is implemented
for the builtin type string, List and Map types, StructMap types, and types
satisfying the Assocer interface. For other types, it returns an error.
Bool converts a value to bool. It is implemented for nil, the builtin bool
type, and types implementing the Booler interface. For all other values, it
returns true.
CanIterate returns whether the value can be iterated. If CanIterate(v) is
true, calling Iterate(v, f) will not result in an error.
Collect collects all elements of an iterable value into a slice.
Concat concatenates two values. If both operands are strings, it returns lhs
+ rhs, nil. If the left operand implements Concatter, it calls
lhs.Concat(rhs). If lhs doesn't implement the interface or returned
ErrConcatNotImplemented, it then calls rhs.RConcat(lhs). If all attempts
fail, it returns nil and an error.
ConvertListIndex parses a list index, check whether it is valid, and returns
the converted structure.
Dissoc takes a container and a key, and returns a modified version of the
container, with the given key dissociated with any value. It is implemented
for the Map type and types satisfying the Dissocer interface. For other
types, it returns nil.
Eq returns a tt.Matcher that matches using the Equal function.
Equal returns whether two values are equal. It is implemented for the builtin
types bool and string, the File, List, Map types, StructMap types, and types
satisfying the Equaler interface. For other types, it uses reflect.DeepEqual
to compare the two values.
Feed calls the function with given values, breaking earlier if the function
returns false.
FromGo converts a Go value to an Elvish value. Most types are returned as
is, but exact numerical types are normalized to one of int, *big.Int and
*big.Rat, using the small representation that can hold the value, and runes
are converted to strings.
Hash returns the 32-bit hash of a value. It is implemented for the builtin
types bool and string, the File, List, Map types, StructMap types, and types
satisfying the Hasher interface. For other values, it returns 0 (which is OK
in terms of correctness).
HasKey returns whether a container has a key. It is implemented for the Map
type, StructMap types, and types satisfying the HasKeyer interface. It falls
back to iterating keys using IterateKeys, and if that fails, it falls back to
calling Len and checking if key is a valid numeric or slice index. Otherwise
it returns false.
Index indexes a value with the given key. It is implemented for the builtin
type string, *os.File, List, StructMap and PseudoStructMap types, and types
satisfying the ErrIndexer or Indexer interface (the Map type satisfies
Indexer). For other types, it returns a nil value and a non-nil error.
Iterate iterates the supplied value, and calls the supplied function in each
of its elements. The function can return false to break the iteration. It is
implemented for the builtin type string, the List type, and types satisfying
the Iterator interface. For these types, it always returns a nil error. For
other types, it doesn't do anything and returns an error.
IterateKeys iterates the keys of the supplied value, calling the supplied
function for each key. The function can return false to break the iteration.
It is implemented for the Map type, StructMap types, and types satisfying the
IterateKeyser interface. For these types, it always returns a nil error. For
other types, it doesn't do anything and returns an error.
Kind returns the "kind" of the value, a concept similar to type but not yet
very well defined. It is implemented for the builtin nil, bool and string,
the File, List, Map types, StructMap types, and types satisfying the Kinder
interface. For other types, it returns the Go type name of the argument
preceded by "!!".
TODO: Decide what `kind-of` should report for an external command object
and document the rationale for the choice in the doc string for `func
(ExternalCmd) Kind()` as well as user facing documentation. It's not
obvious why this returns "fn" rather than "external" for that case.
Len returns the length of the value, or -1 if the value does not have a
well-defined length. It is implemented for the builtin type string, StructMap
types, and types satisfying the Lener interface. For other types, it returns
-1.
MakeList creates a new List from values.
MakeMap creates a map from arguments that are alternately keys and values. It
panics if the number of arguments is odd.
NewListReprBuilder makes a new ListReprBuilder.
NewMapReprBuilder makes a new MapReprBuilder.
NewPipe creates a new Pipe value.
NormalizeBigInt converts a big.Int to an int if it is within the range of
int. Otherwise it returns n as is.
NormalizeBigRat converts a big.Rat to a big.Int (or an int if within the
range) if its denominator is 1.
NoSuchKey returns an error indicating that a key is not found in a map-like
value.
ParseNum parses a string into a suitable number type. If the string does not
represent a valid number, it returns nil.
Repr returns the representation for a value, a string that is preferably (but
not necessarily) an Elvish expression that evaluates to the argument. If
indent >= 0, the representation is pretty-printed. It is implemented for the
builtin types nil, bool and string, the File, List and Map types, StructMap
types, and types satisfying the Reprer interface. For other types, it uses
fmt.Sprint with the format "<unknown %v>".
ScanToGo converts an Elvish value to a Go value. the pointer points to. It
uses the type of the pointer to determine the destination type, and puts the
converted value in the location the pointer points to. Conversion only
happens when the destination type is int, float64 or rune; in other cases,
this function just checks that the source value is already assignable to the
destination.
TestValue returns a ValueTester.
ToString converts a Value to string. It is implemented for the builtin
float64 and string types, and type satisfying the Stringer interface. It
falls back to Repr(v, NoPretty).
TypeOf is like reflect.TypeOf, except that when given an argument of nil, it
does not return nil, but the Type for the empty interface.
UnifyNums unifies the given slice of numbers into the same type, converting
those with lower NumType to the higest NumType present in the slice. The typ
argument can be used to force the minimum NumType.
ValueOf is like reflect.ValueOf, except that when given an argument of nil,
it does not return a zero Value, but the Value for the zero value of the
empty interface.
Package-Level Variables (total 18, in which 3 are exported)
EmptyList is an empty list.
EmptyMap is an empty map.
ErrConcatNotImplemented is a special error value used to signal that
concatenation is not implemented. See Concat for how it is used.
Package-Level Constants (total 5, all are exported)
Possible values for NumType, sorted in the order of implicit conversion
(lower types can be implicitly converted to higher types).
Possible values for NumType, sorted in the order of implicit conversion
(lower types can be implicitly converted to higher types).
Possible values for NumType, sorted in the order of implicit conversion
(lower types can be implicitly converted to higher types).
Possible values for NumType, sorted in the order of implicit conversion
(lower types can be implicitly converted to higher types).
NoPretty can be passed to Repr to suppress pretty-printing.
The pages are generated with Golds v0.2.8-preview. (GOOS=darwin GOARCH=arm64)