import { AstType, EastFunction, NewArrayFunction, RangeFunction, SortFunction, ToArrayFunction, Variable } from '../functions'; import { ArrayType, BooleanType, DictType, EastType, IntegerType, SetType, SubType, ValueTypeOf } from '../types'; import { Expression } from './core'; /** * Construct an new array with the given values. * * @param value_type the {@link EastType} the values of the array will be * @param values a list of {@link Expression}s to insert as values into the new array (optional) * * @category Expression * * @example * ```typescript * // create a new empty array that can contain strings * NewArray(StringType) * // create a new array containing ["a", "b"] * NewArray(StringType, [Const("a"), Const("b")]) * ``` */ export declare function NewArray(value_type: T, values?: (ValueTypeOf> | { type: SubType>; ast_type: AstType; })[]): NewArrayFunction>; /** * Construct an array with a contiguous range of integers, `[start, start+1n, ..., stop-1n, stop]`. * * The range always includes both `start` and `stop`, unless `start` is greater than `stop` * in which case the output is an empty array. * * @param start an {@link Expression} for the first integer. * @param stop an {@link Expression} for the first integer. * * @category Expression * * @example * ```typescript * Range(1, Variable("n", IntegerType)) * ``` */ export declare function Range(start: Expression, stop: Expression): RangeFunction>; /** * Return an array where each output `value` is calculated from each element of the input `collection`. * * @param collection the {@link Expression} for the input set * @param value a function from input key to an {@link Expression} to calculate the output value * * @category Expression * * @example * ```typescript * // convert a set to an array * ToArray(set) * // create an array by applying the UpperCase function to each element of the set * ToArray(set, x => UpperCase(x)) * ``` */ export declare function ToArray(collection: EastFunction, value: ((key: Variable) => EastFunction) | (() => EastFunction)): ToArrayFunction>; export declare function ToArray(collection: EastFunction): ToArrayFunction>; /** * Return an array where each output `value` is calculated from each element of the input `collection`. * * @param collection the {@link Expression} for the input dictionary * @param value a function from input value and key to an {@link Expression} to calculate the output value * * @category Expression * * @example * ```typescript * // create an array from the values of a dictionary * ToArray(dict) * // create an array by applying the UpperCase function to keys of a dictionary * ToArray(dict, (value, key) => UpperCase(key)) * ``` */ export declare function ToArray(collection: EastFunction, value: (value: Variable, key: Variable) => EastFunction): ToArrayFunction>; export declare function ToArray(collection: EastFunction, value: (value: Variable) => EastFunction): ToArrayFunction>; export declare function ToArray(collection: EastFunction, value: () => EastFunction): ToArrayFunction>; export declare function ToArray(collection: EastFunction): ToArrayFunction>; /** * Return an array where each output `value` is calculated from each element of the input `collection`. * * @param collection the {@link Expression} for the input array * @param value a function from input value and key to an {@link Expression} to calculate the output value * * @category Expression * * @example * ```typescript * // create a new array by applying the UpperCase function to each element of the input * ToArray(array, x => UpperCase(x)) * ``` */ export declare function ToArray(collection: EastFunction, value: (value: Variable, key: Variable) => EastFunction): ToArrayFunction>; export declare function ToArray(collection: EastFunction, value: (value: Variable) => EastFunction): ToArrayFunction>; export declare function ToArray(collection: EastFunction, value: () => EastFunction): ToArrayFunction>; export declare function ToArray(collection: EastFunction): ToArrayFunction>; /** * Sort an array in place, according an ordering defined by the comparison function `isless`. * Primitive types will be sorted automatically according to `Less`. * * @param collection the {@link Expression} for the input array * @param isless a function from the `first` and `second` value to an {@link Expression} to calculate whether `first` is smaller than `second` (defaults to `Less`) * * @category Expression * * @example * ```typescript * // ... * // Sort an array of datetimes into ascending order * AscendingDates: Sort(array_of_dates) * // Sort an array of datetimes into descending order * DescendingDates: Sort(array_of_dates, Greater) * // ... * ``` */ export declare function Sort, second: Variable) => EastFunction>(collection: EastFunction, isless?: IsLess): SortFunction;