Module: Expressions
The
Expressions module facilitates creation of statically typed functional data Expression's, as well as providing a set of standard libraries for common Expression patterns.Example
// Given a `set` of `key`s, calculate the sum of the corresponding values in
// an integer dictionary `dict`
Count: Reduce(
set,
(previous, key) => Add(previous, Get(dict, key),
Const(0n)
)
Example
// ...
// if name is null, replace with 'Unknown' string
Wage: Let(
Max(0, Subtract(Variable("Hours", FloatType), 8),
overtime => Add(
Multiply(
Variable("NormalRate", FloatType),
Subtract(Variable("Hours", FloatType), overtime)
),
Multiply(
Variable("OvertimeRate", FloatType),
overtime
)
)
),
// ...
Aggregation
AggregationDefinition
Ƭ AggregationDefinition<T
>:
CustomAggregationDefinition
<T
> | StandardAggregationDefinition
<T
>A
AggregationDefinition is either a CustomAggregationDefinition or StandardAggregationDefinition.Type parameters
Name | Type |
---|---|
T | extends EastType = EastType |
CustomAggregationDefinition
Ƭ CustomAggregationDefinition<T
, U
>: Object
An
CustomAggregationDefinition represents a reduction over rows followed by an optional final transformation.Type parameters
Name | Type |
---|---|
T | extends EastType = EastType |
U | extends EastType = EastType |
Type declaration
Name | Type |
---|---|
aggregation_type | "Custom" |
finalizer | EastFunction <T > |
initial | EastFunction <U > |
inverse_reducer | EastFunction <U > |
previous | Variable <U > |
reducer | EastFunction <U > |
type | T |
StandardAggregationDefinition
Ƭ StandardAggregationDefinition<T
, U
>: Object
A
StandardAggregationDefinition calculates one of a handful of built-in reductions over rows.Type parameters
Name | Type |
---|---|
T | extends EastType = EastType |
U | extends StandardAggregationType = StandardAggregationType |
Type declaration
Name | Type |
---|---|
aggregation_type | U |
key? | EastFunction |
type | T |
value | EastFunction |
Any
▸ Any(value
):
StandardAggregationDefinition
<BooleanType
>Create an
AggregationDefinition that returns true if one or more value istrue
.Example
// ...
aggregations: {
// return true if a category value is null
CategoryMissing: fields => Any(IsNull(fields.Category)),
// ...
}
Parameters
Name | Type | Description |
---|---|---|
value | EastFunction <BooleanType > | the value to aggregate |
Returns
StandardAggregationDefinition
<BooleanType
>the
Any StandardAggregationDefinitionCollectDict
▸ CollectDict<K
, T
>(key
, value
):
StandardAggregationDefinition
<DictType
<K
, T
>>Create an
AggregationDefinition to create a dictionary of distinct key-value pairs. If multiple distinct, non-null values exist for a given key, then the value isnull
for that key.Example
// ...
aggregations: {
// collect all non-null HourlyRate's into a dictionary by EmployeeId
HourlyRatePerEmployee: fields => CollectDict(
fields.EmployeeId,
fields.HourlyRate
),
// ...
}
Type parameters
Name | Type |
---|---|
K | extends StringType |
T | extends EastType |
Parameters
Name | Type | Description |
---|---|---|
key | EastFunction <K > | the dict key value |
value | EastFunction <T > | the value to aggregate |
Returns
StandardAggregationDefinition
<DictType
<K
, T
>>the
CollectDict StandardAggregationDefinitionCollectDictCount
▸ CollectDictCount(value
):
StandardAggregationDefinition
<DictType
<StringType
, IntegerType
>>Create an
AggregationDefinition to create a dictionary of the count of non-null keysExample
// ...
aggregations: {
// create a dictionary with the count of products by Category
ProductsPerCategory: fields => CollectDictCount(
fields.Category,
),
// ...
}
Parameters
Name | Type | Description |
---|---|---|
value | EastFunction <StringType > | the dict key value |
Returns
StandardAggregationDefinition
<DictType
<StringType
, IntegerType
>>the
CollectDictCount StandardAggregationDefinitionCollectDictMean
▸ CollectDictMean(key
, value
):
StandardAggregationDefinition
<DictType
<StringType
, FloatType
>>Create an
AggregationDefinition to create a dictionary of the sum of non-null values for key-value pairs.Example
// ...
aggregations: {
// create a dictionary with the average of Price per Category
MeanPricePerCategory: fields => CollectDictMean(
fields.Category,
fields.Price
),
// ...
}
Parameters
Name | Type | Description |
---|---|---|
key | EastFunction <StringType > | the dict key value |
value | EastFunction <IntegerType | FloatType > | the value to aggregate |
Returns
StandardAggregationDefinition
<DictType
<StringType
, FloatType
>>the
CollectDictMean StandardAggregationDefinitionCollectDictSum
▸ CollectDictSum<T
>(key
, value
): T
extends NullType
?
StandardAggregationDefinition
<DictType
<StringType
, NonNullable
<T
>>> : StandardAggregationDefinition
<DictType
<StringType
, T
>>Create an
AggregationDefinition to create a dictionary of the sum of non-null values for key-value pairs.Example
// ...
aggregations: {
// create a dictionary with the sum of Qty's by Category
QtyPerCategory: fields => CollectDictSum(
fields.Category,
fields.Qty
),
// ...
}
Type parameters
Name | Type |
---|---|
T | extends IntegerType | FloatType |
Parameters
Name | Type | Description |
---|---|---|
key | EastFunction <StringType > | the dict key value |
value | EastFunction <T > | the value to aggregate |
Returns
T
extends NullType
?
StandardAggregationDefinition
<DictType
<StringType
, NonNullable
<T
>>> : StandardAggregationDefinition
<DictType
<StringType
, T
>>the
CollectDictSum StandardAggregationDefinitionCollectSet
▸ CollectSet<K
>(value
):
StandardAggregationDefinition
<SetType
<K
>>Create an
AggregationDefinition to find the set of the non-null string values ofvalue
(which defaults to field
).Example
// ...
aggregations: {
// collect all non-null Categorie's into a set
Categories: fields => CollectSet(fields.Category),
// ...
}
Type parameters
Name | Type |
---|---|
K | extends StringType |
Parameters
Name | Type | Description |
---|---|---|
value | EastFunction <K > | the value to aggregate |
Returns
StandardAggregationDefinition
<SetType
<K
>>the
CollectSet StandardAggregationDefinitionCount
▸ Count(value?
):
StandardAggregationDefinition
<IntegerType
>Create an Aggregation
to count the number of rows where value
is not null.
Example
// ...
aggregations: {
// count the number of Category's that aren't null
ValidCategories: fields => Count(fields.Category),
// ...
}
Parameters
Name | Type | Description |
---|---|---|
value? | EastFunction <EastType > | the value to aggregate |
Returns
StandardAggregationDefinition
<IntegerType
>the
Count StandardAggregationDefinitionDistinctCount
▸ DistinctCount(value
):
StandardAggregationDefinition
<IntegerType
>Create an Aggregation
to count the number of distinct, non-null values of value
.
Example
// ...
aggregations: {
// count the number of distinct non-null Category's
Categories: fields => DistinctCount(fields.Category),
// ...
}
Parameters
Name | Type | Description |
---|---|---|
value | EastFunction <EastType > | the value to aggregate |
Returns
StandardAggregationDefinition
<IntegerType
>the
DistinctCount StandardAggregationDefinitionEvery
▸ Every(value
):
StandardAggregationDefinition
<BooleanType
>Create an
AggregationDefinition that returns true if all values aretrue
Example
// ...
aggregations: {
// return true if all category values are null
AllCategoriesMissing: fields => Every(
IsNull(fields.Category)
),
// ...
}
Parameters
Name | Type | Description |
---|---|---|
value | EastFunction <BooleanType > | the value to aggregate |
Returns
StandardAggregationDefinition
<BooleanType
>the
Every StandardAggregationDefinitionFindMaximum
▸ FindMaximum<K
, T
>(value
, key
): K
extends NullType
? T
extends NullType
?
StandardAggregationDefinition
<T
> : StandardAggregationDefinition
<Nullable
<T
>> : StandardAggregationDefinition
<T
>Create an
AggregationDefinition to find thekey
corresponding to the largest, non-null value of value
(which defaults to field
).Example
// ...
aggregations: {
// return Product with the lowest Price
HighestPriceProduct: fields => FindMaximum(
fields.Price,
fields.Product
),
// ...
}
Type parameters
Name | Type |
---|---|
K | extends EastType |
T | extends EastType |
Parameters
Name | Type | Description |
---|---|---|
value | EastFunction <K > | the value to aggregate |
key | EastFunction <T > | the value to find the minimum of |
Returns
K
extends NullType
? T
extends NullType
?
StandardAggregationDefinition
<T
> : StandardAggregationDefinition
<Nullable
<T
>> : StandardAggregationDefinition
<T
>the
FindMaximum StandardAggregationDefinitionFindMinimum
▸ FindMinimum<K
, T
>(value
, key
): K
extends NullType
? T
extends NullType
?
StandardAggregationDefinition
<T
> : StandardAggregationDefinition
<Nullable
<T
>> : StandardAggregationDefinition
<T
>Create an
AggregationDefinition to find the smallest, non-null value ofvalue
(which defaults to field
).Example
// ...
aggregations: {
// return Product with the lowest Price
LowestPriceProduct: fields => FindMinimum(
fields.Price,
fields.Product
),
// ...
}
Type parameters
Name | Type |
---|---|
K | extends EastType |
T | extends EastType |
Parameters
Name | Type | Description |
---|---|---|
value | EastFunction <K > | the value to aggregate |
key | EastFunction <T > | the value to find the minimum of |
Returns
K
extends NullType
? T
extends NullType
?
StandardAggregationDefinition
<T
> : StandardAggregationDefinition
<Nullable
<T
>> : StandardAggregationDefinition
<T
>the
FindMinimum StandardAggregationDefinitionMaximum
▸ Maximum<T
>(value
):
StandardAggregationDefinition
<T
>Create an
AggregationDefinition to find the largest, non-null value ofvalue
(which defaults to field
).Example
// ...
aggregations: {
// return the highest Price
MaxPrice: fields => Maximum(fields.Price),
// ...
}
Type parameters
Name | Type |
---|---|
T | extends EastType |
Parameters
Name | Type | Description |
---|---|---|
value | EastFunction <T > | the value to aggregate |
Returns
StandardAggregationDefinition
<T
>the
Maximum StandardAggregationDefinitionMean
▸ Mean(value
):
StandardAggregationDefinition
<FloatType
>Create an
AggregationDefinition to find the mean of the non-null values ofvalue
(which defaults to field
).Example
// ...
aggregations: {
// find the mean Qty's
MeanQty: fields => Mean(fields.Qty),
// ...
}
Parameters
Name | Type | Description |
---|---|---|
value | EastFunction <IntegerType | FloatType > | the value to aggregate |
Returns
StandardAggregationDefinition
<FloatType
>the
Mean StandardAggregationDefinitionMedian
▸ Median<T
>(value
):
StandardAggregationDefinition
<T
>Create an
AggregationDefinition to find the median of the non-null values ofvalue
(which defaults to field
). In case of a tie, the greater number is returned.Example
// ...
aggregations: {
// return the middle Price
MedianPrice: fields => Median(fields.Price),
// ...
}
Type parameters
Name | Type |
---|---|
T | extends IntegerType | FloatType |
Parameters
Name | Type | Description |
---|---|---|
value | EastFunction <T > | the value to aggregate |
Returns
StandardAggregationDefinition
<T
>the
Median StandardAggregationDefinitionMinimum
▸ Minimum<T
>(value
):
StandardAggregationDefinition
<T
>Create an
AggregationDefinition to find the smallest, non-null value ofvalue
(which defaults to field
).Example
// ...
aggregations: {
// return the lowest Price
MinPrice: fields => Minimum(fields.Price),
// ...
}
Type parameters
Name | Type |
---|---|
T | extends EastType |
Parameters
Name | Type | Description |
---|---|---|
value | EastFunction <T > | the value to aggregate |
Returns
StandardAggregationDefinition
<T
>the
Minimum StandardAggregationDefinitionMode
▸ Mode<T
>(value
):
StandardAggregationDefinition
<T
>Create an
AggregationDefinition to find the most common, non-null value ofvalue
(which defaults to field
). If a tie is encountered, any one of the most-common values is chosen.Example
// ...
aggregations: {
// return the mode of prices
ModalPrice: fields => Mode(fields.Price),
// ...
}
Type parameters
Name | Type |
---|---|
T | extends EastType |
Parameters
Name | Type | Description |
---|---|---|
value | EastFunction <T > | the value to aggregate |
Returns
StandardAggregationDefinition
<T
>the
Mode StandardAggregationDefinitionSpan
▸ Span<T
>(value
):
StandardAggregationDefinition
<T
>Create an
AggregationDefinition to find the span of the non-null values ofvalue
(which defaults to field
), meaning the difference between the largest and smallest values.Example
// ...
aggregations: {
// return the Price span
PriceSpan: fields => Span(fields.Price),
// ...
}
Type parameters
Name | Type |
---|---|
T | extends IntegerType | FloatType |
Parameters
Name | Type | Description |
---|---|---|
value | EastFunction <T > | the value to aggregate |
Returns
StandardAggregationDefinition
<T
>the
Span StandardAggregationDefinitionSparseDictCovariance
▸ SparseDictCovariance(value_expr
):
AggregationDefinition
<DictType
<StringType
, DictType
<StringType
, FloatType
>>>Create an
AggregationDefinition to calculate the covariance of the values of a "sparse" dictionary where missing elements are presumed to have value of zero.Example
// ...
aggregations: {
// return the ...
PriceCardCoVariance: fields => SparseDictCovariance(fields.PriceCard, DictType(StringType,FloatType))),
// ...
}
Parameters
Name | Type | Description |
---|---|---|
value_expr | Expression <DictType <StringType , FloatType >> | the value to aggregate |
Returns
AggregationDefinition
<DictType
<StringType
, DictType
<StringType
, FloatType
>>>the
SparseDictMean CustomAggregationDefinitionSparseDictMean
▸ SparseDictMean(value_expr
):
AggregationDefinition
<DictType
<StringType
, FloatType
>>Create an
AggregationDefinition to calculate the average values of a "sparse" dictionary where missing elements are presumed to have value of zero.Example
// ...
aggregations: {
// return the ...
PriceCardAvg: fields => SparseDictMean(fields.PriceCard, DictType(StringType,FloatType))),
// ...
}
Parameters
Name | Type | Description |
---|---|---|
value_expr | Expression <DictType <StringType , IntegerType >> | the value to aggregate |
Returns
AggregationDefinition
<DictType
<StringType
, FloatType
>>the
SparseDictMean CustomAggregationDefinitionSparseDictSum
▸ SparseDictSum(value_expr
):
AggregationDefinition
<DictType
<StringType
, FloatType
>>Create an
AggregationDefinition to calculate the sum of the values of a "sparse" dictionary where missing elements are presumed to have value of zero.Example
// ...
aggregations: {
// return the ...
PriceCardTotal: fields => SparseDictSum(fields.PriceCard, DictType(StringType,FloatType))),
// ...
}
Parameters
Name | Type | Description |
---|---|---|
value_expr | Expression <DictType <StringType , FloatType >> | the value to aggregate |
Returns
AggregationDefinition
<DictType
<StringType
, FloatType
>>the
SparseDictSum CustomAggregationDefinitionSparseDictVariance
▸ SparseDictVariance(value_expr
):
AggregationDefinition
<DictType
<StringType
, FloatType
>>Create an
AggregationDefinition to calculate the variance of the values of a "sparse" dictionary where missing elements are presumed to have value of zero.Example
// ...
aggregations: {
// return the ...
PriceCardVariance: fields => SparseDictVariance(fields.PriceCard, DictType(StringType,FloatType))),
// ...
}
Parameters
Name | Type | Description |
---|---|---|
value_expr | Expression <DictType <StringType , FloatType >> | the value to aggregate |
Returns
AggregationDefinition
<DictType
<StringType
, FloatType
>>the
SparseDictMean CustomAggregationDefinitionStdDev
▸ StdDev(value
):
StandardAggregationDefinition
<FloatType
>Create an
AggregationDefinition to find the standard deviation of the non-null values ofvalue
(which defaults to field
).Example
// ...
aggregations: {
// find the std deviation of Qty's
StdDevQty: fields => StdDev(fields.Qty),
// ...
}
Parameters
Name | Type | Description |
---|---|---|
value | EastFunction <IntegerType | FloatType > | the value to aggregate |
Returns
StandardAggregationDefinition
<FloatType
>the
StdDev StandardAggregationDefinitionSum
▸ Sum(value
):
StandardAggregationDefinition
<IntegerType
>Create an
AggregationDefinition to find the sum of the non-null values ofvalue
(which defaults to field
).Example
// ...
aggregations: {
// sum all Qty's to find the total
TotalQty: fields => Sum(fields.Qty),
// ...
}
Parameters
Name | Type | Description |
---|---|---|
value | EastFunction <IntegerType > | the value to aggregate |
Returns
StandardAggregationDefinition
<IntegerType
>the
Sum StandardAggregationDefinitionUnique
▸ Unique<T
>(value
): T
extends NullType
?
StandardAggregationDefinition
<T
> : StandardAggregationDefinition
<Nullable
<T
>>Create an Aggregation
to find the unique non-null value of value
. If multiple non-null values are encountered, it returns null.
Example
// ...
aggregations: {
// count the number of unique non-null Category's
Categories: fields => Unique(fields.Category),
// ...
}
Type parameters
Name | Type |
---|---|
T | extends EastType |
Parameters
Name | Type | Description |
---|---|---|
value | EastFunction <T > | the value to aggregate |
Returns
T
extends NullType
?
StandardAggregationDefinition
<T
> : StandardAggregationDefinition
<Nullable
<T
>>the
Unique StandardAggregationDefinitionStdLib
OptionType
Ƭ OptionType<T
>: VariantType
<{ none
: NullType
; some
: T
}>
Return an EastType for the Option variant with cases "none" (indicating the lack of data) and "some" (indicating the presence of data).
This is an alias for VariantType({ none: NullType, some: type })
.
Param
The EastType
associated with the "some" case.
See
Type parameters
Name | Type |
---|---|
T | extends EastType = EastType |
None
• Const
None: ConstFunction
<VariantType
<{ none
: NullType
}>>
An EastFunction containing the "none" case of the Option variant. This is an alias for Const(none)
.
See
Abs
▸ Abs(x
): EastFunction
<IntegerType
>
Return the absolute value of a number or integer Expression.
Parameters
Name | Type |
---|---|
x | Expression <IntegerType > |
Returns
EastFunction
<IntegerType
>
AddAll
▸ AddAll(collection
): EastFunction
<FloatType
>
Add all collection values into a single float or integer Expression.
Parameters
Name | Type |
---|---|
collection | EastFunction <ArrayType <FloatType >> |
Returns
EastFunction
<FloatType
>
AddDict
▸ AddDict<T
>(d1
, d2
): MapValuesFunction
<DictType
<StringType
, any
>>
Add first
to second
where both are dictionaries.
Remarks
Missing keys between first and second are assumed to have a value of 0.
Example
// ...
// return the prices by dividing the total amounts by the qtys
NewBalance: AddDict(
Variable('InitialBalance', DictType(StringType, FloatType)),
Variable('Amount', DictType(StringType, FloatType))
),
// ...
Type parameters
Name | Type |
---|---|
T | extends NumericType |
Parameters
Name | Type |
---|---|
d1 | EastFunction <DictType <StringType , T >> |
d2 | EastFunction <DictType <StringType , T >> |
Returns
MapValuesFunction
<DictType
<StringType
, any
>>
Ceiling
▸ Ceiling<T
>(value
, unit
): EastFunction
<T
>
Round datetime value
up to a whole time unit
("year", "month", "week", "day", "hour", "minute", "second").
Type parameters
Name | Type |
---|---|
T | extends DateTimeType |
Parameters
Name | Type |
---|---|
value | EastFunction <T > |
unit | TimeUnit | CalendarUnit |
Returns
EastFunction
<T
>
▸ Ceiling<T
>(value
, type?
): EastFunction
<T
>
Round number value
up to a whole number.
Type parameters
Name | Type |
---|---|
T | extends FloatType |
Parameters
Name | Type |
---|---|
value | EastFunction <T > |
type? | "float" |
Returns
EastFunction
<T
>
▸ Ceiling<T
>(value
, type?
): EastFunction
<T
extends NullType
? Nullable
<IntegerType
> : IntegerType
>
Round number value
up to nearest integer.
Type parameters
Name | Type |
---|---|
T | extends FloatType |
Parameters
Name | Type |
---|---|
value | EastFunction <T > |
type? | "integer" |
Returns
EastFunction
<T
extends NullType
? Nullable
<IntegerType
> : IntegerType
>
ConvertFloatDict
▸ ConvertFloatDict(dict
): EastFunction
<DictType
<StringType
, IntegerType
>>
Convert a float DictType to an integer DictType.
Parameters
Name | Type |
---|---|
dict | EastFunction <DictType <StringType , FloatType >> |
Returns
EastFunction
<DictType
<StringType
, IntegerType
>>
ConvertIntegerDict
▸ ConvertIntegerDict(dict
): EastFunction
<DictType
<StringType
, FloatType
>>
Convert an integer DictType to an float DictType.
Parameters
Name | Type |
---|---|
dict | EastFunction <DictType <StringType , IntegerType >> |
Returns
EastFunction
<DictType
<StringType
, FloatType
>>
DateKey
▸ DateKey(value
, unit?
): EastFunction
<StringType
>
Convenience function to convert a datetime into a string for a key, rounding optional.
Parameters
Name | Type |
---|---|
value | EastFunction <DateTimeType > |
unit? | TimeUnit | CalendarUnit |
Returns
EastFunction
<StringType
>
DayName
▸ DayName(date
): GetFunction
<StringType
>
Return a Print function to convert a datetime Expression to a day of week name.
Parameters
Name | Type |
---|---|
date | EastFunction <DateTimeType > |
Returns
GetFunction
<StringType
>
DayNameShort
▸ DayNameShort(date
): GetFunction
<StringType
>
Return a Print function to convert a datetime Expression to an abbreviated day of week name.
Parameters
Name | Type |
---|---|
date | EastFunction <DateTimeType > |
Returns
GetFunction
<StringType
>
Default
▸ Default<T
>(type
): ConstFunction
<T
>
Create a Const expression with the default value of a given type
.
See
Type parameters
Name | Type |
---|---|
T | extends EastType |
Parameters
Name | Type | Description |
---|---|---|
type | T | the EastType |
Returns
ConstFunction
<T
>
DefaultValue
▸ DefaultValue<T
>(type
): ValueTypeOf
<T
>
Create a Value of a given East type
.
Remarks
For nullable types this is null
, otherwise numeric types default to zero,
Boolean to false, strings, arrays, sets and dictionaries are empty, for variants the
first variant type is chosen, and structs are created recursively.
Type parameters
Name | Type |
---|---|
T | extends EastType |
Parameters
Name | Type | Description |
---|---|---|
type | T | the EastType |
Returns
ValueTypeOf
<T
>
Floor
▸ Floor<T
>(value
, unit
): EastFunction
<T
>
Round datetime value
down to a whole time unit
("year", "month", "week", "day", "hour", "minute", "second").
Type parameters
Name | Type |
---|---|
T | extends DateTimeType |
Parameters
Name | Type |
---|---|
value | EastFunction <T > |
unit | TimeUnit | CalendarUnit |
Returns
EastFunction
<T
>
▸ Floor<T
>(value
, type
): EastFunction
<T
extends NullType
? Nullable
<IntegerType
> : IntegerType
>
Round number value
down to nearest integer
Type parameters
Name | Type |
---|---|
T | extends FloatType |
Parameters
Name | Type |
---|---|
value | EastFunction <T > |
type | "integer" |
Returns
EastFunction
<T
extends NullType
? Nullable
<IntegerType
> : IntegerType
>
▸ Floor<T
>(value
, type?
): EastFunction
<T
>
Round number value
down to a whole number.
Type parameters
Name | Type |
---|---|
T | extends FloatType |
Parameters
Name | Type |
---|---|
value | EastFunction <T > |
type? | "float" |
Returns
EastFunction
<T
>
GetTag
▸ GetTag<Variants
, Fs
>(value
): EastFunction
<StringType
>
Returns a StringType EastFunction for the VariantType Tag
.
Type parameters
Name | Type |
---|---|
Variants | extends Record <string , EastType > |
Fs | extends { [K in string | number | symbol]: Function } |
Parameters
Name | Type | Description |
---|---|---|
value | EastFunction <VariantType <Variants >> | An EastFunction for the Option variant. |
Returns
EastFunction
<StringType
>
Importance
▸ Importance(domain
, range?
): EastFunction
<StringType
>
Convert a number Expression to a magnitude string between ['negligible', 'moderate', 'large'].
Parameters
Name | Type |
---|---|
domain | Expression <FloatType > |
range | [negligible: number, moderate: number] |
Returns
EastFunction
<StringType
>
IsEmpty
▸ IsEmpty(collection
): EastFunction
<BooleanType
>
Return true
if collection
has zero elements, or false
otherwise.
Parameters
Name | Type |
---|---|
collection | EastFunction <SetType <StringType > | DictType <StringType , EastType >> |
Returns
EastFunction
<BooleanType
>
IsFriday
▸ IsFriday(date
): EastFunction
<BooleanType
>
Return the a boolean function to determine if a datetime Expression falls on a Friday.
Parameters
Name | Type |
---|---|
date | EastFunction <DateTimeType > |
Returns
EastFunction
<BooleanType
>
IsMonday
▸ IsMonday(date
): EastFunction
<BooleanType
>
Return the a boolean function to determine if a datetime Expression falls on a Monday.
Parameters
Name | Type |
---|---|
date | EastFunction <DateTimeType > |
Returns
EastFunction
<BooleanType
>
IsNotNull
▸ IsNotNull(value
): EastFunction
<BooleanType
>
Return true if value
is null
or false
otherwise.
Parameters
Name | Type |
---|---|
value | EastFunction <EastType > |
Returns
EastFunction
<BooleanType
>
IsNull
▸ IsNull(value
): EastFunction
<BooleanType
>
Return true if value
is null
or false
otherwise.
Parameters
Name | Type |
---|---|
value | EastFunction <EastType > |
Returns
EastFunction
<BooleanType
>
IsSaturday
▸ IsSaturday(date
): EastFunction
<BooleanType
>
Return the a boolean function to determine if a datetime Expression falls on a Saturday.
Parameters
Name | Type |
---|---|
date | EastFunction <DateTimeType > |
Returns
EastFunction
<BooleanType
>
IsSunday
▸ IsSunday(date
): EastFunction
<BooleanType
>
Return the a boolean function to determine if a datetime Expression falls on a Sunday.
Parameters
Name | Type |
---|---|
date | EastFunction <DateTimeType > |
Returns
EastFunction
<BooleanType
>
IsThursday
▸ IsThursday(date
): EastFunction
<BooleanType
>
Return the a boolean function to determine if a datetime Expression falls on a Thursday.
Parameters
Name | Type |
---|---|
date | EastFunction <DateTimeType > |
Returns
EastFunction
<BooleanType
>
IsTuesday
▸ IsTuesday(date
): EastFunction
<BooleanType
>
Return the a boolean function to determine if a datetime Expression falls on a Tuesday.
Parameters
Name | Type |
---|---|
date | EastFunction <DateTimeType > |
Returns
EastFunction
<BooleanType
>
IsWednesday
▸ IsWednesday(date
): EastFunction
<BooleanType
>
Return the a boolean function to determine if a datetime Expression falls on a Wednesday.
Parameters
Name | Type |
---|---|
date | EastFunction <DateTimeType > |
Returns
EastFunction
<BooleanType
>
IsWeekday
▸ IsWeekday(date
): EastFunction
<BooleanType
>
Return the a boolean function to determine if a datetime Expression falls on a weekday.
Parameters
Name | Type |
---|---|
date | EastFunction <DateTimeType > |
Returns
EastFunction
<BooleanType
>
IsWeekend
▸ IsWeekend(date
): EastFunction
<BooleanType
>
Return the a boolean function to determine if a datetime Expression falls on a weekend.
Parameters
Name | Type |
---|---|
date | EastFunction <DateTimeType > |
Returns
EastFunction
<BooleanType
>
MapOption
▸ MapOption<T
, F
>(value
, f
): EastFunction
<
OptionType
<ReturnType
<F
>["type"
]>>Returns an EastFunction to map the data corresponding to the "some" case an Option variant through a function, while leaving the "none" case alone.
See
Type parameters
Name | Type |
---|---|
T | extends EastType |
F | extends (data : Variable <T >) => EastFunction <EastType > |
Parameters
Name | Type | Description |
---|---|---|
value | EastFunction <OptionType <T >> | An EastFunction for the Option variant. |
f | F | A function of data associated with the "some" case returning an EastFunction for the new associated data. |
Returns
EastFunction
<
OptionType
<ReturnType
<F
>["type"
]>>Max
▸ Max<T
, U
>(a
, b
): EastFunction
<U
>
Return the greater of a
and b
(note that null
and NaN
are greater than every other value).
Type parameters
Name | Type |
---|---|
T | extends PrimitiveType |
U | extends PrimitiveType |
Parameters
Name | Type |
---|---|
a | Expression <U > |
b | Expression <T > |
Returns
EastFunction
<U
>
Min
▸ Min<T
, U
>(a
, b
): EastFunction
<U
>
Return the lesser of a
and b
(note that null
and NaN
are greater than every other value).
Type parameters
Name | Type |
---|---|
T | extends PrimitiveType |
U | extends PrimitiveType |
Parameters
Name | Type |
---|---|
a | Expression <U > |
b | Expression <T > |
Returns
EastFunction
<U
>
MonthNameShort
▸ MonthNameShort(date
): GetFunction
<StringType
>
Return a Print function to convert a datetime Expression to an abbreviated month name.
Parameters
Name | Type |
---|---|
date | EastFunction <DateTimeType > |
Returns
GetFunction
<StringType
>
MultiplyDict
▸ MultiplyDict<X
, Y
>(first
, second
): EastFunction
<DictType
<StringType
, PromoteType
<X
, Y
>>>
Multiply first
by second
where both are dictionaries.
Example
// ...
// return the products revenue by multiplying the prices by the qtys
Amounts: MultiplyDict(
Variable('UnitPrices', DictType(StringType, FloatType)),
Variable('Quantities', DictType(StringType, FloatType))
),
// ...
Type parameters
Name | Type |
---|---|
X | extends IntegerType | FloatType |
Y | extends IntegerType | FloatType |
Parameters
Name | Type | Description |
---|---|---|
first | Expression <DictType <StringType , X >> | the first Expression to multiply |
second | Expression <DictType <StringType , Y >> | the second Expression to multiply |
Returns
EastFunction
<DictType
<StringType
, PromoteType
<X
, Y
>>>
OptionType
▸ OptionType<T
>(type
): VariantType
<{ none
: NullType
= NullType; some
: T
= type }>
Return an EastType for the option variant with cases "none" (indicating the lack of data) and "some" (indicating the presence of data).
This is an alias for VariantType({ none: NullType, some: type })
.
See
Type parameters
Name | Type |
---|---|
T | extends EastType |
Parameters
Name | Type | Description |
---|---|---|
type | T | The EastType associated with the "some" case. |
Returns
VariantType
<{ none
: NullType
= NullType; some
: T
= type }>
PrimaryKey
▸ PrimaryKey(...values
): EastFunction
<StringType
>
Convenience function to convert one or more expressions into a string for a key.
Parameters
Name | Type |
---|---|
...values | EastFunction <PrimitiveType >[] |
Returns
EastFunction
<StringType
>
PrintSeperated
▸ PrintSeperated(x
, thousands_seperator
): EastFunction
<StringType
>
Print a number with a seperator between the thousands, e.g. 1234 as "1,234"
Parameters
Name | Type |
---|---|
x | Expression <IntegerType | FloatType > |
thousands_seperator | string |
Returns
EastFunction
<StringType
>
PrintTruncatedCurrency
▸ PrintTruncatedCurrency(value
): EastFunction
<StringType
>
Return a comma seperated and rounded currency string from an integer.
Parameters
Name | Type |
---|---|
value | Expression <IntegerType > |
Returns
EastFunction
<StringType
>
▸ PrintTruncatedCurrency(value
): EastFunction
<StringType
>
Return a comma seperated and rounded currency string from a number.
Parameters
Name | Type |
---|---|
value | Expression <FloatType > |
Returns
EastFunction
<StringType
>
RandomExponential
▸ RandomExponential(): EastFunction
<FloatType
>
Return a random number drawn from an exponential distribution.
Returns
EastFunction
<FloatType
>
RandomKeys
▸ RandomKeys<T
>(collection
, n
): EastFunction
<SetType
<T
>>
Return a random subset of at most n
keys from the input collection
.
Type parameters
Name | Type |
---|---|
T | extends StringType |
Parameters
Name | Type |
---|---|
collection | EastFunction <DictType <T , EastType >> |
n | EastFunction <IntegerType > |
Returns
EastFunction
<SetType
<T
>>
RandomValues
▸ RandomValues<I
>(collection
, n
): EastFunction
<DictType
<StringType
, I
>>
Return a random subset of at most n
values from the input collection
(using sampling without replacement).
Type parameters
Name | Type |
---|---|
I | extends EastType |
Parameters
Name | Type |
---|---|
collection | EastFunction <DictType <StringType , I >> |
n | EastFunction <IntegerType > |
Returns
EastFunction
<DictType
<StringType
, I
>>
RandomWeibull
▸ RandomWeibull(shape
): EastFunction
<FloatType
>
Return a random number drawn from an exponential distribution.
Parameters
Name | Type |
---|---|
shape | EastFunction <FloatType > |
Returns
EastFunction
<FloatType
>
Replace
▸ Replace<T
, U
, V
>(value
, from
, to
): EastFunction
<T
>
Return value
unless it equals from
, in which case replace it with to
.
Type parameters
Name | Type |
---|---|
T | extends PrimitiveType |
U | extends PrimitiveType |
V | extends PrimitiveType |
Parameters
Name | Type |
---|---|
value | EastFunction <T > |
from | Expression <U > |
to | Expression <V > |
Returns
EastFunction
<T
>
Sigmoid
▸ Sigmoid<T
>(x
): EastFunction
<T
>
Return a number EastFunction to peform ...
Type parameters
Name | Type |
---|---|
T | extends FloatType |
Parameters
Name | Type |
---|---|
x | EastFunction <T > |
Returns
EastFunction
<T
>
Some
▸ Some<T
>(data
): NewVariantFunction
<VariantType
<{ some
: T
}>>
Returns an EastFunction to construct the "some" case of the Option variant with associated data. This is an alias for NewVariant("some", value)
.
See
None
, Unwrap
, MapOption
, OptionType
, some
.
Type parameters
Name | Type |
---|---|
T | extends EastType |
Parameters
Name | Type | Description |
---|---|---|
data | EastFunction <T > | An EastFunction containing the associated data. |
Returns
NewVariantFunction
<VariantType
<{ some
: T
}>>
ToEntries
▸ ToEntries<T
>(dict
): EastFunction
<ArrayType
<StructType
<{ Key
: StringType
; Value
: T
}>>>
Return a ArrayType EastFunction to convert a dictionary into an array of key & value pairs
Type parameters
Name | Type |
---|---|
T | extends EastType |
Parameters
Name | Type |
---|---|
dict | EastFunction <DictType <StringType , T >> |
Returns
EastFunction
<ArrayType
<StructType
<{ Key
: StringType
; Value
: T
}>>>
Truncate
▸ Truncate<T
>(value
, type?
): EastFunction
<T
>
Round number value
towards zero to a whole number.
Type parameters
Name | Type |
---|---|
T | extends FloatType |
Parameters
Name | Type |
---|---|
value | EastFunction <T > |
type? | "float" |
Returns
EastFunction
<T
>
▸ Truncate<T
>(value
, type?
): EastFunction
<T
extends NullType
? Nullable
<IntegerType
> : IntegerType
>
Round number value
towards zero to the nearest integer.
Type parameters
Name | Type |
---|---|
T | extends FloatType |
Parameters
Name | Type |
---|---|
value | EastFunction <T > |
type? | "integer" |
Returns
EastFunction
<T
extends NullType
? Nullable
<IntegerType
> : IntegerType
>
UnionAll
▸ UnionAll<T
>(collection
): EastFunction
<T
>
Union all sets in collection
into a single set Expression.
Type parameters
Name | Type |
---|---|
T | extends SetType <StringType > |
Parameters
Name | Type |
---|---|
collection | EastFunction <ArrayType <T > | DictType <StringType , T >> |
Returns
EastFunction
<T
>
Unwrap
▸ Unwrap<T
, U
>(value
, defaultValue
): EastFunction
<T
& U
>
Returns an EastFunction to unwrap an Option variant, replacing the "none" case with defaultValue
.
See
Type parameters
Name | Type |
---|---|
T | extends EastType |
U | extends EastType |
Parameters
Name | Type | Description |
---|---|---|
value | EastFunction <OptionType <T >> | An EastFunction for the Option variant. |
defaultValue | EastFunction <U > | An EastFunction containing the associated data. |
Returns
EastFunction
<T
& U
>
WeekDescription
▸ WeekDescription(cycle
): EastFunction
<StringType
>
Return a Print function to convert a cycle Expression to an abbreviated week description.
Parameters
Name | Type |
---|---|
cycle | EastFunction <IntegerType > |
Returns
EastFunction
<StringType
>
WeekOfMonth
▸ WeekOfMonth(date
): EastFunction
<IntegerType
>
Return the number of whole weeks elapsed since the first Monday prior to or of the first day of the month.
Parameters
Name | Type |
---|---|
date | EastFunction <DateTimeType > |
Returns
EastFunction
<IntegerType
>