Operators and Predefined Functions¶
The main operators and predefined functions are outlined in the following chapters together with the main data types involved. Here we sketch some operators and functions that are not linked to a specific type. The predefined functions are listed in annex Library.
Conditional Expression¶
An important operator is the conditional à la C :
(cond ? exp₁ : exp₂)
returns the value of the expression exp₁
if the
expression cond
evaluates to true
and else
exp2
. The parentheses are mandatory.
As usual, the conditional operator is a special function: it does not
evaluate all of its arguments. If cond
is true, only
exp₁
is evaluated, and similarly for false and
exp₂
.
In the body of a function, a conditional can be written using the usual syntax:
if (cond) { exp₁ } else { exp₂ }
see chapter Functions.
Beware not to confuse the conditional action and the conditionnal expression presented here. The body of the former is a sequence of actions; the latter, an expression. The former does not return a value, contrary to the latter.
Functions @empty
and @size
¶
The predicate @empty returns true if its argument is an empty map, tab or string, and false otherwise.
Function @size accepts any kind of argument and returns:
-
for aggregate values, the “size” of the arguments; that is, for a map, the number of entries in the dictionary, for a tab the number of elements, for a nim, the dimension of the nim and for a string the number of characters in the string.
-
for scalar values, @size returns a strictly negative number. This negative number depends only on the type of the argument, not on the value of the argument.
Alphabetical Listing of Antescofo Predefined Functions¶
@<*+!...¶
@|| @!= @% @&& @* @+ @- @/ @< @<= @== @> @>=
@A...¶
@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
@B...¶
@bach_score @base2i @beats_in_seconds_from_now @between @binary_search @bit_and @bit_or @bit_shiftl @bit_shiftr
@C...¶
@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
@D...¶
@dim @directory_read @domain @drop @dumpvar
@E...¶
@empty @erf @erfc [@error] @event_label_position @exe_child_of @exe_parent @exp [@exp2] @explode
@F...¶
@filter_max_t @filter_median_t @filter_min_t @find @flatten @floor
@G...¶
@H...¶
[@has_apply] @host_date [@hypot] @hz2midi @hz2midicent @hz2symb
@I...¶
[@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
@J...¶
[@j0] [@j1] @json_read @json_string @json_write
@K...¶
@knn_combine @knn_create @knn_delete @knn_rcombine @knn_rebuild @knn_rnd @knn_rscan @knn_rsearch @knn_scan @knn_search
@L...¶
@lace @last [@lgamma] [@linear_approx] @linearize @listify [@lnow] @loadvalue @loadvar @local_beat_position @local_tempo @log @log10 @log2 @logical_date
@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_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]
@N...¶
[@nan] [@next_event_except_sil_pos] [@next_event_with_sil_pos] [@next_sil_pos] @nim2vezer [@nimify] @normalize @number_active
@O...¶
@occurs [@odei_map_function] @optional_attributes
@P...¶
@parse @performance_data [@performance_tempo] @permute @pow @print [@priority] @projection @push_back @push_front @pwd
@R...¶
@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
@S...¶
@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
@T...¶
@take @tan [@tanh] @tgamma @time @to_num @Tracing [@type_of] @typecheck
@U...¶
@UnTracing @usage_resident_memory_size @usage_statistics @usage_virtual_memory_size @user_directory
@W...¶
[@window_filter]
@X...¶
@Y...¶
@_...¶
[@_sleep] [@_yield] [@_terminate] [@_print] [@_thread_qos] [@_gotcha]