Antescofo Library
of Predefined Functions

header figure

Antescofo includes a set of predefined functions. They are described mostly in the chapters Expressions, Scalar values and Data structures. For the reader's convenience, we give here a list of these functions.

In the following pages, the sequence of names after the function defines the type of the arguments accepted by a function. For example numeric is used when an argument must satisfy the predicate @is_numeric, that is @is_int or @is_float. In addition, we use the term value when the function accepts any kind of argument.

Listable Functions and Listable Predicates

When a function f is marked as listable, the function is extended to accept tab arguments in addition to scalar arguments. Usually, the result of the application of f on a tab is the tab resulting on the point-wise application of f to the scalar elements of the tab. But for predicate, i.e. a function that returns a [bool], the result is the predicate that returns true if the scalar version returns true on all the elements of the tabs.

For example, @abs is a listable function on numeric, so it can be applied to a tab of numerics. The result is the tab of the absolute value of the elements of the tab argument.

Another example: the function @approx is a listable predicate and @approx(u, v) returns true if @approx(u[i], v[i]) returns true for all elements i of the tabs u and v.

Overloaded functions

Some functions accept different kinds of values for the same argument. For example @insert accepts tab or map as its first argument. Such functions are said overloaded: they gather under the same name several specialized version of the function.

A user-defined function can be overloaded: it recquires to check the type of the argument value to dispatch to the specialized versions (written elsewhere).

Overloading methods is more simple: the same identifier can be used to name a method in different objects.

Side-Effect

Most functions are pure functions, that is, they do not modify their arguments and build a new value for the result.

In some cases, the function works by a side-effect, like @push_back which modifies its argument in place. Such functions are marked as impure. We also qualify functions that may return different values when called with the same arguments as impure, even if they do not produce a side-effect (for example, functions that return a random number).

Special forms

Special forms are syntactic constructs similar to function calls but that are subject to some restriction or that behave differently of a function call.

For example, boolean predicates are a special form of function application because they do not always evaluate all their arguments (they are lazy). For instance, the conjunction && evaluates its second argument only if the first is not false.

Another example is @plot, @history_length or @dumpvar that only accepts a variable as an argument, not a general expression.

Special forms cannot be curryfied nor passed as an argument: they are not ordinary functional values. Note, howevever that they can be wrapped in a user-defined function which is an ordinary functional value.

Function call in infix form

A function call is usually written in prefix form:

      @drop($t, 1)
      @scramble($t)

It is possible to write function calls in infix form, as follows:

      $t.@drop(1)
      $t.@scramble()

The @ character is optional when naming a function in infix call, so we can also write:

      $t.drop(1)
      $t.scramble()

This syntax is the same as for a method call. The general form is:

      arg1 . @fct (arg2, arg3, ...)    ; or more simply
      arg1 . fct (arg2, arg3, ...)  

The argi are expressions. Notice that the infix call, with or without the @ in the function name, is not ambiguous with the notation used to refer to a variable local $x in a compound action from the exe of this action, exe.$x, because $x cannot be the name of a function.

The infix notation is less general than the prefix notation. In the prefix notation, the function can be given by an expression. For example, functions can be stored into an array and then called following the result of an expression:

      $t := [@f, @g]
      ; ...
      ($t[exp])()

will call @f or @g following the value returned by the evaluation of exp. Only function name (with or without @) are accepted in the infix notation.


Listing by categories

Mathematical Functions

@abs,    @acos,    @asin,    @atan,    @atan2,    @between,    @ceil,    @clear,    @cos,    @cosh,    @exp,    @floor,    @log,    @log10,    @log2,    @max,    @min,    @pow,    @rand,    @rand_int,    @random,    @rnd_bernoulli,    @rnd_binomial,    @rnd_exponential,    @rnd_gamma,    @rnd_geometric,    @rnd_normal,    @rnd_uniform_float,    @rnd_uniform_int,    @round,    @sin,    @sinh,    @sqrt,    @tan

@rand,    @rand_int,    @random,    @rnd_bernoulli,    @rnd_binomial,    @rnd_exponential,    @rnd_gamma,    @rnd_geometric,    @rnd_normal,    @rnd_uniform_float,    @rnd_uniform_int   

@car,    @cdr,    @clear,    @concat,    @cons,    @copy,    @count,    @dim,    @domain,    @drop,    @empty,    @explode,    @find,    @flatten,    @gnuplot,    @insert,    @iota,    @is_list,    @is_prefix,    @is_subsequence,    @is_suffix,    @lace,    @last,    @listify,    @map,    @max_val,    @median,    @member,    @normalize,    @occurs,    @permute,    @push_back,    @push_front,    @range,    @reduce,    @remove,    @remove_duplicate,    @replace,    @resize,    @reverse,    @rotate,    @scan,    @scramble,    @size,    @slice,    @sort,    @sputter,    @stutter,    @tab_history,    @tab_history_date,    @tab_history_rdate,    @take   

in addition, see listable functions.

Listable Functions

@!=,    @%,    @&&,    @!=,    @%,    @&&,    @*,    @+,    @-,    @<,    @<=,    @==,    @>,    @>=,    @div,    @||,    @+,    @-,    @<,    @<=,    @==,    @>,    @>=,    @div,    @||,    @/,    @abs,    @acos,    @approx,    @asin,    @atan,    @atan2    @between,    @ceil,    @cos,    @cosh,    @exp,    @floor,    @log,    @log10,    @log2,    @pow,    @round,    @sin,    @sinh,    @sqrt,    @tan   

@aggregate,    @align_breakpoints,    @dim,    @filter_max_t,    @filter_median_t,    @filter_min_t,    @integrate,    @linearize,    @max_key,    @max_val,    @min,    @min_key,    @min_val,    @projection,    @push_back,    @push_front,    @sample,    @simplify_lang_v,    @simplify_radial_distance_t,    @simplify_radial_distance_v,    @window_filter_t   

@add_pair,    @clear,    @count,    @domain,    @find,    @gshift_map,    @insert,    @is_defined,    @is_function,    @is_map,    @listify,    @make_duration_map,    @make_label_bpm,    @make_label_duration,    @make_label_pitches,    @make_label_pos,    @make_score_map,    @map,    @map_compose,    @map_concat,    @map_history,    @map_history_date,    @map_history_rdate,    @map_normalize,    @map_reverse,    @mapval,    @max_key,    @max_val,    @member,    @merge,    @min_key,    @min_val,    @occurs,    @range,    @remove,    @select_map,    @shift_map   

@count,    @dump,    @dumpvar,    @explode,    @find,    @is_prefix,    @is_string,    @is_subsequence,    @is_suffix,    @member,    @occurs,    @push_back,    @string2fun,    @string2proc,    @system,    @Tracing,    @UnTracing   

Predicates

@!=,    @&&,    @||,    @<=,    @<,    @==,    @>=,    @>,    @approx,    @arch_darwin,    @arch_linux,    @arch_windows,    @between,    @empty,    @find,    @is_bool,    @is_defined,    @is_exec,    @is_fct,    @is_float,    @is_function,    @is_int,    @is_integer_indexed,    @is_list,    @is_map,    @is_nim,    @is_numeric,    @is_obj,    @is_obj_xxx,    @is_prefix,    @is_string,    @is_subsequence,    @is_suffix,    @is_symbol,    @is_undef,    @is_vector,    @member,    @occurs

@bach_score,   @make_bpm_map,   @make_bpm_tab,   @make_duration_map,   @make_duration_tab,   @make_label_bpm,   @make_label_duration,   @make_label_pitches,   @make_label_pos,   @make_pitch_tab,   @make_score_map   @score_tempi   @score_duration    @specified_duration   

@hz2midi    @hz2midicent    @hz2symb    @midi_getChannel,    @midi_getCommandByte,    @midi_getCommand,    @midi_getMetaType,    @midi_isAftertouch,    @midi_isController,    @midi_isEndOfTrack,    @midi_isMeta,    @midi_isNoteOff,    @midi_isNoteOn,    @midi_isNote,    @midi_isPatchChange,    @midi_isPitchbend,    @midi_isPressure,    @midi_isTempo,    @midi_read,    @midi_track2ascii    @midi2hz    @midicent2hz    @symb2midicent   

Data Exchange Functions:

@dump,    @dumpvar,    @gnuplot,    @json_read,    @json_string,    @json_write,    @loadvalue,    @loadvar,    @nim2vezer    @plot,    @rplot,    @savevalue,    @set_osc_handling_double,    @set_osc_handling_int64,    @set_osc_handling_tab,    @string2fun,    @string2obj,    @string2proc    @xml_read    @xml_string   

@arch_darwin,    @arch_linux,    @arch_windows,    @configuration_arch,    @configuration_audiosample,    @configuration_debug,    @configuration_faust,    @configuration_host,    @configuration_release,    @configuration_target_architecture,    @current_load_directory,    @directory_read,    @exe_child_of,    @exe_parent,    @history_length,    @host_date,    @is_fastforward,    @is_following_on,    @is_paused,    @is_playing_on,    @is_running,    @is_stopped,    @pwd,    @system,    @Tracing,    @UnTracing    @usage_resident_memory_size,    @usage_statistics,    @usage_virtual_memory_size   


Alphabetical Listing of Antescofo Predefined Functions

@!=

@%

@&&

@!=

@%

@&&

@*

@+

@-

@<

@<=

@==

@>

@>=

@div

@||

@+

@-

@<

@<=

@==

@>

@>=

@div

@||

@abs

@acos

@active

@add_pair

@aggregate

@align_breakpoints

@approx

@arch_darwin

@arch_linux

@arch_windows

@asin

@atan

@atan2

@bach_score

@between

@bounded_integrate

@bounded_integrate_inv

@car

@cdr

@ceil

@clear

@concat

@configuration_arch

@configuration_audiosample

@configuration_debug

@configuration_faust

@configuration_host

@configuration_release

@configuration_target_architecture

@cons

@copy

@cos

@cosh

@count

@current_load_directory

@dim

@directory_read

@domain

@drop

@dump

@dumpvar

@empty

@exe_child_of

@exe_parent

@exp

@explode

@filter_max_t

@filter_median_t

@filter_min_t

@find

@flatten

@floor

@gnuplot

@gshift_map

@history_length

@host_date

@hz2midi

@hz2midicent

@hz2symb

@insert

@integrate

@iota

@is_bool

@is_defined

@is_exec

@is_fastforward

@is_fct

@is_float

@is_following_on

@is_function

@is_int

@is_integer_indexed

@is_interpolatedmap

@is_list

@is_map

@is_nim

@is_numeric

@is_obj

@is_obj_xxx

@is_paused

@is_playing_on

@is_prefix

@is_proc

@is_running

@is_stopped

@is_string

@is_subsequence

@is_suffix

@is_symbol

@is_tab

@is_undef

@is_vector

@json_string

@json_read

@json_write

@lace

@last

@linearize

@listify

@loadvalue

@loadvar

@log

@log10

@log2

@make_bpm_map

@make_bpm_tab

@make_duration_map

@make_duration_tab

@make_label_bpm

@make_label_duration

@make_label_pitches

@make_label_pos

@make_score_map

@map

@map_compose

@map_concat

@map_history

@map_history_date

@map_history_rdate

@map_normalize

@map_reverse

@mapval

@max

@max_key

@max_val

@median

@member

@merge

@midi_getChannel

@midi_getCommand

@midi_getCommandByte

@midi_getMetaType

@midi_isAftertouch

@midi_isController

@midi_isEndOfTrack

@midi_isMeta

@midi_isNote

@midi_isNoteOff

@midi_isNoteOn

@midi_isPatchChange

@midi_isPitchbend

@midi_isPressure

@midi_isTempo

@midi_read

@midi_track2ascii

@midi2hz

@midicent2hz

@min

@min_key

@min_val

@nim2vezer

@normalize

@number_active

@occurs

@permute

@plot

@pow

@projection

@push_back

@push_front

@pwd

@rand

@rand_int

@random

@range

@reduce

@remove

@remove_duplicate

@replace

@reshape

@resize

@reverse

@rnd_bernoulli

@rnd_binomial

@rnd_exponential

@rnd_gamma

@rnd_geometric

@rnd_normal

@rnd_uniform_float

@rnd_uniform_int

@rotate

@round

@rplot

@sample

@savevalue

@scan

@score_duration

@score_tempi

@scramble

@select_map

@set_osc_handling_double

@set_osc_handling_int64

@set_osc_handling_tab

@shape

@shift_map

@simplify_lang_v

@simplify_radial_distance_t

@simplify_radial_distance_v

@sin

@sinh

@size

@slice

@sort

@specified_duration

@sputter

@sqrt

@string2fun

@string2proc

@stutter

@symb2midicent

@system

@tab_history

@tab_history_date

@tab_history_rdate

@take

@tan

@Tracing

@UnTracing

@usage_resident_memory_size

@usage_statistics

@usage_virtual_memory_size

@window_filter_t

@xml_read

@xml_string