Antescofo Library
of Predefined Functions

header figure


Antescofo includes more than 290 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 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.

In the rest of this section, we recall some useful features of Antescofo functions 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.

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.

Infix function call

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,    @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

@car,    @cdr,    @clear,    @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 functions.

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,    @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   

Map (aka dictionnary)

@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   

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,    @sputter,    @string2fun,    @strip_path,    @stutter,    @string2proc,    @system,    @take    @to_num,    @Tracing,    @UnTracing   

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

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

the Antescofo Score

@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   

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   

@arch_darwin,    @arch_linux,    @arch_windows,    @compilation,    @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,    @info,    @is_fastforward,    @is_following_on,    @is_paused,    @is_playing_on,    @is_running,    @is_stopped,    @max_absolute_path,    @max_patch_path,    @pwd,    @strip_path,    @system,    @Tracing,    @time,    @typecheck,    @UnTracing    @usage_resident_memory_size,    @usage_statistics,    @usage_virtual_memory_size    @user_directory   


Alphabetical Listing of Antescofo Predefined Functions


@<*+!...

@!=

@%

@&&

@!=

@%

@&&

@*

@+

@-

@<

@<=

@==

@>

@>=

@div

@||

@+

@-

@<

@<=

@==

@>

@>=

@div

@||


@A

@abs

@acos

@active

@add_pair

@aggregate

@align_breakpoints

@approx

@arch_darwin

@arch_linux

@arch_windows

@asin

@atan

@atan2


@B

@bach_score

@between

@bit_and

@bit_or

@bit_shiftl

@bit_shiftr

@bounded_integrate

@bounded_integrate_inv


@C

@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

@compilation

@concat

@configuration_arch

@configuration_audiosample

@configuration_debug

@configuration_faust

@configuration_host

@configuration_release

@configuration_target_architecture

@cons

@copy

@cos

@cosh

@count

@current_load_directory


@D

@dim

@directory_read

@domain

@drop

@dump

@dumpvar


@E

@empty

@exe_child_of

@exe_parent

@exp

@explode


@F

@filter_max_t

@filter_median_t

@filter_min_t

@find

@flatten

@floor


@G

@gnuplot

@gshift_map


@H

@history_length

@host_date

@hz2midi

@hz2midicent

@hz2symb


@I

@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


@J

@json_string

@json_read

@json_write


@K

@knn_create

@knn_rebuild

@knn_delete

@knn_rnd

@knn_search

@knn_rsearch

@knn_scan

@knn_rscan

@knn_combine

@knn_rcombine


@L

@lace

@last

@linearize

@listify

@loadvalue

@loadvar

@log

@log10

@log2


@M

@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_absolute_path

@max_patch_path

@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


@N

@nim2vezer

@normalize

@number_active


@O

@occurs

@ode_solve


@P

@parse

@permute

@plot

@pow

@projection

@push_back

@push_front

@pwd


@R

@r_compile

@r_findall

@r_match

@r_search

@rand

@rand_int

@random

@range

@read_file

@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


@S

@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

@strip_path

@stutter

@succession

@symb2midicent

@system


@T

@tab_history

@tab_history_date

@tab_history_rdate

@take

@tan

@tgamma

@time

@to_num

@Tracing

@typecheck


@U

@UnTracing

@usage_resident_memory_size

@usage_statistics

@usage_virtual_memory_size

@user_directory


@W

@window_filter_t


@X

@xml_read

@xml_string