系统内置函数
Flux 包含许多预赋值。这些预赋值在各种内置包的源文件中定义。
当内置值无法在 Flux 中表达时,其值可以由宿主环境定义。所有这些值都必须具有相应的 builtin 语句来声明内置值的存在和类型。
BuiltinStatement = "builtin" identifier ":" TypeExpression .
TypeExpression = MonoType ["where" Constraints] .
MonoType = Tvar | BasicType | ArrayType | StreamType | VectorType | RecordType | FunctionType .
Tvar = "A" … "Z" .
BasicType = "int" | "uint" | "float" | "string" | "bool" | "time" | "duration" | "bytes" | "regexp" .
ArrayType = "[" MonoType "]" .
StreamType = "stream" "[" MonoType "]" .
VectorType = "vector" "[" MonoType "]" .
RecordType = ( "{" [RecordTypeProperties] "}" ) | ( "{" Tvar "with" RecordTypeProperties "}" ) .
FunctionType = "(" [FunctionTypeParameters] ")" "=>" MonoType .
RecordTypeProperties = RecordTypeProperty { "," RecordTypeProperty } .
RecordTypeProperty = Label ":" MonoType .
Label = identifier | string_lit
FunctionTypeParameters = FunctionTypeParameter { "," FunctionTypeParameter } .
FunctionTypeParameter = [ "<-" | "?" ] identifier ":" MonoType .
Constraints = Constraint { "," Constraint } .
Constraint = Tvar ":" Kinds .
Kinds = identifier { "+" identifier } .
示例
builtin filter : (<-tables: stream[T], fn: (r: T) => bool) => stream[T]
此页是否对您有帮助?
感谢您的反馈!