Antescofo Library
of Predefined Functions

header figure

Antescofo includes more than 360 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 and there is a description page for each of them in the next section.

In these following sections, 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.

In the rest of this page, we recall some useful features of Antescofo functions (see chapter Functions for a more detailed treatment) and we list the predefined functions using several categories in order to facilitate their identification according to their uses.

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.


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.

Infix function call

A function call is usually written in prefix form:

      @drop($t, 1)

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


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


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]
      ; ...

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.

Named parameters and optional arguments in functions applications

The identifier of the arguments in a function definition can be used, withoout the leading $ as a name for an out-of-order argument passing in function application. See section Named parameters and out-of-order application (this also holds for processes and methods).

Arguments may have a default value, as explained in section Optional arguments and default argument's value. In case of partial application, these arguments take their default value if they are not explicitly specified in the call.

line divider

Listing by categories

Function names in square brackets are either reserved for internal use or awaiting documentation.

Mathematical Functions

@abs    @acos    @asin    @atan    @atan2    @between    @bit_and    @bit_or    @bit_shiftl    @bit_shiftr    @ceil    @clear    @cos    @cosh    @exp    @floor    @knn_create    @knn_rebuild    @knn_delete    @knn_rnd    @knn_search    @knn_rsearch    @knn_scan    @knn_rscan    @knn_combine    @knn_rcombine    @log    @log10    @log2    @max    @min    @ode_solve    @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    @y0    @y1   

Random Generators

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

Tab Manipulations

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

in addition, see listable operators.

Listable Operators

@!=    @%    @&&    @!=    @%    @&&    @*    @+    @-    @<    @<=    @==    @>    @>=    @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    [@clone]    [@compose]    @concat_nim    @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    [@scale_x]    [@scale_y]    @simplify_lang_v    @simplify_radial_distance_t    @simplify_radial_distance_v    @window_filter_t   

Map (aka dictionnary)

@add_pair    @clear    [@clone]    @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   

String Management

@car    @cdr    @char_is_alnum    @char_is_alpha    @char_is_ascii    @char_is_blank    @char_is_cntrl    @char_is_digit    @char_is_graph    @char_is_lower    @char_is_print    @char_is_punct    @char_is_space    @char_is_upper    @char_is_xdigit    @copy    @count    @drop    @dump    @dumpvar    @empty    @explode    @find    @is_prefix    @is_string    @is_subsequence    @is_suffix    @last    @member    @occurs    @parse    @permute    @push_back    @r_compile    @r_findall    @r_match    @r_search    @remove    @remove_duplicate    @replace    @scramble    @slice    @sort    @split    @sputter    @string2fun    @string2proc    @strip_path    @stutter    @system    @take    @to_num    @Tracing    @UnTracing   

Most functions acting on tabs operate also on strings.

For regular expressions, see @r_compile and also @parse.


@!=    @&&    @||    @<=    @<    @==    @>=    @>    @approx    @arch_darwin    @arch_linux    @arch_windows    @between    @empty    @find    [@is_applicable]    [@is_applicable_exe]    @is_bool    @is_defined    @is_exec    @is_fct    @is_float    @is_fct    [@is_fun]    @is_function    @is_int    @is_integer_indexed    @is_list    @is_map    [@is_Napplicable]    @is_nim    [@is_not_initialized]    @is_numeric    [@is_paf]    @is_obj    @is_obj_xxx    @is_prefix    @is_proc    @is_string    [@is_string_or_symbol]    @is_subsequence    @is_suffix    @is_symbol    @is_tab    @is_undef    @is_vector    @member    @occurs

Score Introspection

[@always_next_event_except_sil_pos]   @bach_score   @current_event   @event_label_position   @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   [@next_event_except_sil_pos]   [@next_event_with_sil_pos]   [@next_sil_pos]   @optional_attributes    @performance_data    @score_duration    @score_tempi   @specified_duration   

Handling Midi

@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    @parse    @plot    @read_file    @rplot    @savevalue    @set_osc_handling_double    @set_osc_handling_int64    @set_osc_handling_tab    @string2fun    @string2obj    @string2proc    @to_num    @xml_read    @xml_string   

@active_mac_addresses    @arch_darwin    @arch_linux    @arch_windows    [@beat_in_seconds_from_now]    @callback_all_event    @callback_next_event    @callback_start_fastforward    @callback_start_logical_instant    @callback_stop    @callback_stop_fastforward    @callback_stop_logical_instant    @compilation    @configuration_arch    @configuration_audiosample    [@configuration_compiler_name]    [@configuration_compiler_version]    @configuration_debug    @configuration_faust    @configuration_host    [@configuration_odeint]    @configuration_release    @configuration_target_architecture    @current_load_directory    @directory_read    @exe_child_of    @exe_parent    @history_length    @host_date    @info    @is_fastforward    @is_following_on    @is_paused    @is_playing_on    @is_running    @is_stopped    @local_beat_position    @local_tempo    @logical_date    @max_absolute_path    @max_patch_path    @performance_data    @pwd    @seconds_in_beats_from_now    @send_message    @set_max_message_sent_instantaneously    @system    @Tracing    @time    @typecheck    @UnTracing    @usage_resident_memory_size    @usage_statistics    @usage_virtual_memory_size    @user_directory   

line divider

Alphabetical Listing of Antescofo Predefined Functions

Function names in square brackets are either reserved for internal use or awaiting documentation. This listing is automatically produced by the command antescofo::libraryinfo.


@||    @!=    @%    @&&    @*    @+    @-    @/    @<    @<=    @==    @>    @>=   


@abs    @acos    @active    @active_mac_addresses    @add_pair    @aggregate    @align_breakpoints    [@always_next_event_except_sil_pos]    @applytab    @applytab_lax    @approx    @arch_darwin    @arch_linux    @arch_windows    @asin    @atan    @atan2   


@bach_score    @base2i    @beats_in_seconds_from_now    @between    @binary_search    @bit_and    @bit_or    @bit_shiftl    @bit_shiftr   


@callback_all_event    @callback_next_event    @callback_start_fastforward    @callback_start_logical_instant    @callback_stop    @callback_stop_fastforward    @callback_stop_logical_instant    @car    @cdr    @ceil    @char_is_alnum    @char_is_alpha    @char_is_ascii    @char_is_blank    @char_is_cntrl    @char_is_digit    @char_is_graph    @char_is_lower    @char_is_print    @char_is_punct    @char_is_space    @char_is_upper    @char_is_xdigit    @clear    [@clone]    @compilation    [@compose]    @concat    @concat_nim    @configuration_arch    @configuration_audiosample    [@configuration_compiler_name]    [@configuration_compiler_version]    @configuration_faust    [@configuration_odeint]    @configuration_release    @configuration_target_architecture    @cons    @copy    @cos    @cosh    @count    @current_event    @current_load_directory   


@dim    @directory_read    @domain    @drop    @dumpvar   


@empty    @erf    @erfc    [@error]    @event_label_position    @exe_child_of    @exe_parent    @exp    [@exp2]    @explode   


@filter_max_t    @filter_median_t    @filter_min_t    @find    @flatten    @floor   


@gnuplot    @gshift_map   


[@has_apply]    @host_date    [@hypot]    @hz2midi    @hz2midicent    @hz2symb   


[@i2base]    [@ideal_beat2sec]    [@ideal_sec2beat]    [@ideal_tempo]    @info    @insert    [@integrate0]    [@integrate_symb]    [@inverse_symb]    @iota    [@is_applicable]    [@is_applicable_exe]    @is_bool    @is_defined    @is_exec    @is_fastforward    @is_fct    @is_float    @is_following_on    [@is_fun]    @is_function    [@is_inf]    [@is_initialized]    @is_int    @is_integer_indexed    @is_list    @is_map    [@is_nan]    [@is_Napplicable]    @is_nim    [@is_not_initialized]    @is_numeric    @is_obj    [@is_paf]    @is_paused    @is_playing_on    @is_prefix    @is_proc    @is_running    @is_stopped    @is_string    [@is_string_or_symb]    @is_subsequence    @is_suffix    @is_symbol    @is_tab    @is_undef    @is_vector   


[@j0]    [@j1]    @json_read    @json_string    @json_write   


@knn_combine    @knn_create    @knn_delete    @knn_rcombine    @knn_rebuild    @knn_rnd    @knn_rscan    @knn_rsearch    @knn_scan    @knn_search   


@lace    @last    [@lgamma]    [@linear_approx]    @linearize    @listify    [@lnow]    @loadvalue    @loadvar    @local_beat_position    @local_tempo    @log    @log10    @log2    @logical_date   


@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    @map    @map_compose    @map_concat    @map_reverse    @mapval    @max    @max_absolute_path    @max_key    @max_patch_path    @max_val    @median    @member    @merge    @midi2hz    @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    @midicent2hz    @min    @min_key    @min_val    [@my_ip_addresses]   


[@nan]    [@next_event_except_sil_pos]    [@next_event_with_sil_pos]    [@next_sil_pos]    @nim2vezer    [@nimify]    @normalize    @number_active   


@occurs    [@odei_map_function]    @optional_attributes   


@parse    @performance_data    [@performance_tempo]    @permute    @pow    @print    [@priority]    @projection    @push_back    @push_front    @pwd   


@r_compile    @r_findall    @r_match    @r_search    @rand    @rand_int    @random    @range    @read_file    @reduce    [@remainder]    @remove    @remove_duplicate    @replace    @reshape    @resize    @reverse    @rnd_bernoulli    @rnd_binomial    [@rnd_cauchy]    [@rnd_chi_squared]    @rnd_exponential    @rnd_gamma    @rnd_geometric    [@rnd_lognormal_distribution]    [@rnd_negative_binomial]    @rnd_normal    [@rnd_poisson]    @rnd_uniform_float    @rnd_uniform_int    [@rnd_weibull]    @rotate    @round   


@sample    @savevalue    [@scale_x]    [@scale_y]    @scan    @score_duration    @score_tempi    @scramble    @seconds_in_beats_from_now    @select_map    @send_message    @set_max_message_sent_instantaneously    @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    @solve_ode    @solve_ode_dispose    @solve_ode_init    @solve_ode_system    @sort    @specified_duration    @split    @sputter    @sqrt    @string2fun    @string2obj    @string2proc    @strip_path    @stutter    @succession    @symb2midicent    @system   


@take    @tan    [@tanh]    @tgamma    @time    @to_num    @Tracing    [@type_of]    @typecheck   


@UnTracing    @usage_resident_memory_size    @usage_statistics    @usage_virtual_memory_size    @user_directory   




@xml_read    @xml_string   


@y0    @y1   


[@_sleep]    [@_yield]    [@_terminate]    [@_print]    [@_thread_qos]    [@_gotcha]