Operators (I to M)
This file is automatically generated from java files. Do Not Edit It.
Definition​
Operators in the GAML language are used to compose complex expressions. An operator performs a function on one, two, or n operands (which are other expressions and thus may be themselves composed of operators) and returns the result of this function.
Most of them use a classical prefixed functional syntax (i.e. operator_name(operand1, operand2, operand3)
, see below), with the exception of arithmetic (e.g. +
, /
), logical (and
, or
), comparison (e.g. >
, <
), access (.
, [..]
) and pair (::
) operators, which require an infixed notation (i.e. operand1 operator_symbol operand1
).
The ternary functional if-else operator, ? :
, uses a special infixed syntax composed with two symbols (e.g. operand1 ? operand2 : operand3
). Two unary operators (-
and !
) use a traditional prefixed syntax that does not require parentheses unless the operand is itself a complex expression (e.g. - 10
, ! (operand1 or operand2)
).
Finally, special constructor operators ({...}
for constructing points, [...]
for constructing lists and maps) will require their operands to be placed between their two symbols (e.g. {1,2,3}
, [operand1, operand2, ..., operandn]
or [key1::value1, key2::value2... keyn::valuen]
).
With the exception of these special cases above, the following rules apply to the syntax of operators:
- if they only have one operand, the functional prefixed syntax is mandatory (e.g.
operator_name(operand1)
) - if they have two arguments, either the functional prefixed syntax (e.g.
operator_name(operand1, operand2)
) or the infixed syntax (e.g.operand1 operator_name operand2
) can be used. - if they have more than two arguments, either the functional prefixed syntax (e.g.
operator_name(operand1, operand2, ..., operand)
) or a special infixed syntax with the first operand on the left-hand side of the operator name (e.g.operand1 operator_name(operand2, ..., operand)
) can be used.
All of these alternative syntaxes are completely equivalent.
Operators in GAML are purely functional, i.e. they are guaranteed to not have any side effects on their operands. For instance, the shuffle
operator, which randomizes the positions of elements in a list, does not modify its list operand but returns a new shuffled list.
Priority between operators​
The priority of operators determines, in the case of complex expressions composed of several operators, which one(s) will be evaluated first.
GAML follows in general the traditional priorities attributed to arithmetic, boolean, comparison operators, with some twists. Namely:
- the constructor operators, like
::
, used to compose pairs of operands, have the lowest priority of all operators (e.g.a > b :: b > c
will return a pair of boolean values, which means that the two comparisons are evaluated before the operator applies. Similarly,[a > 10, b > 5]
will return a list of boolean values. - it is followed by the
?:
operator, the functional if-else (e.g.a > b ? a + 10 : a - 10
will return the result of the if-else). - next are the logical operators,
and
andor
(e.g.a > b or b > c
will return the value of the test) - next are the comparison operators (i.e.
>
,<
,<=
,>=
,=
,!=
) - next the arithmetic operators in their logical order (multiplicative operators have a higher priority than additive operators)
- next the unary operators
-
and!
- next the access operators
.
and[]
(e.g.{1,2,3}.x > 20 + {4,5,6}.y
will return the result of the comparison between the x and y ordinates of the two points) - and finally the functional operators, which have the highest priority of all.
Using actions as operators​
Actions defined in species can be used as operators, provided they are called on the correct agent. The syntax is that of normal functional operators, but the agent that will perform the action must be added as the first operand.
For instance, if the following species is defined:
species spec1 {
int min(int x, int y) {
return x > y ? x : y;
}
}
Any agent instance of spec1 can use min
as an operator (if the action conflicts with an existing operator, a warning will be emitted). For instance, in the same model, the following line is perfectly acceptable:
global {
init {
create spec1;
spec1 my_agent <- spec1[0];
int the_min <- my_agent min(10,20); // or min(my_agent, 10, 20);
}
}
If the action doesn't have any operands, the syntax to use is my_agent the_action()
. Finally, if it does not return a value, it might still be used but is considering as returning a value of type unknown
(e.g. unknown result <- my_agent the_action(op1, op2);
).
Note that due to the fact that actions are written by modelers, the general functional contract is not respected in that case: actions might perfectly have side effects on their operands (including the agent).
Table of Contents​
Operators by categories​
3D​
box, cone3D, cube, cylinder, hexagon, pyramid, set_z, sphere, teapot,
Arithmetic operators​
-, /, ^, *, +, abs, acos, asin, atan, atan2, ceil, cos, cos_rad, div, even, exp, fact, floor, hypot, is_finite, is_number, ln, log, mod, round, signum, sin, sin_rad, sqrt, tan, tan_rad, tanh, with_precision,
BDI​
add_values, and, eval_when, get_about, get_agent, get_agent_cause, get_belief_op, get_belief_with_name_op, get_beliefs_op, get_beliefs_with_name_op, get_current_intention_op, get_decay, get_desire_op, get_desire_with_name_op, get_desires_op, get_desires_with_name_op, get_dominance, get_familiarity, get_ideal_op, get_ideal_with_name_op, get_ideals_op, get_ideals_with_name_op, get_intensity, get_intention_op, get_intention_with_name_op, get_intentions_op, get_intentions_with_name_op, get_lifetime, get_liking, get_modality, get_obligation_op, get_obligation_with_name_op, get_obligations_op, get_obligations_with_name_op, get_plan_name, get_predicate, get_solidarity, get_strength, get_super_intention, get_trust, get_truth, get_uncertainties_op, get_uncertainties_with_name_op, get_uncertainty_op, get_uncertainty_with_name_op, get_values, has_belief_op, has_belief_with_name_op, has_desire_op, has_desire_with_name_op, has_ideal_op, has_ideal_with_name_op, has_intention_op, has_intention_with_name_op, has_obligation_op, has_obligation_with_name_op, has_uncertainty_op, has_uncertainty_with_name_op, new_emotion, new_mental_state, new_predicate, new_social_link, not, or, set_about, set_agent, set_agent_cause, set_decay, set_dominance, set_familiarity, set_intensity, set_lifetime, set_liking, set_modality, set_predicate, set_solidarity, set_strength, set_trust, set_truth, with_values,
Casting operators​
as, as_int, as_matrix, field_with, font, is, is_skill, list_with, matrix_with, species_of, to_gaml, to_geojson, to_list, with_size, with_style,
Color-related operators​
-, /, *, +, blend, brewer_colors, brewer_palettes, gradient, grayscale, hsb, mean, median, palette, rgb, rnd_color, scale, sum, to_hsb,
Comparison operators​
Containers-related operators​
-, ::, +, accumulate, all_match, among, as_json_string, at, cartesian_product, collect, contains, contains_all, contains_any, contains_key, count, empty, every, first, first_with, get, group_by, in, index_by, inter, interleave, internal_integrated_value, last, last_with, length, max, max_of, mean, mean_of, median, min, min_of, mul, none_matches, one_matches, one_of, product_of, range, remove_duplicates, reverse, shuffle, sort_by, split, split_in, split_using, sum, sum_of, union, variance_of, where, with_max_of, with_min_of,
Date-related operators​
-, !=, +, <, <=, =, >, >=, after, before, between, every, milliseconds_between, minus_days, minus_hours, minus_minutes, minus_months, minus_ms, minus_weeks, minus_years, months_between, plus_days, plus_hours, plus_minutes, plus_months, plus_ms, plus_weeks, plus_years, since, to, until, years_between,
Dates​
Displays​
edge​
EDP-related operators​
Files-related operators​
agent_file, copy_file, crs, csv_file, delete_file, dxf_file, evaluate_sub_model, file_exists, folder, folder_exists, gaml_file, geojson_file, get, gif_file, gml_file, graph6_file, graphdimacs_file, graphdot_file, graphgexf_file, graphgml_file, graphml_file, graphtsplib_file, grid_file, image_file, is_agent, is_csv, is_dxf, is_gaml, is_geojson, is_gif, is_gml, is_graph6, is_graphdimacs, is_graphdot, is_graphgexf, is_graphgml, is_graphml, is_graphtsplib, is_grid, is_image, is_json, is_obj, is_osm, is_pgm, is_property, is_shape, is_simulation, is_svg, is_text, is_threeds, is_xml, json_file, new_folder, obj_file, osm_file, pgm_file, property_file, read, rename_file, shape_file, simulation_file, step_sub_model, svg_file, text_file, threeds_file, unzip, writable, xml_file, zip,
GamaMetaType​
GamaSVGFile​
Graphs-related operators​
add_edge, add_node, adjacency, agent_from_geometry, all_pairs_shortest_path, alpha_index, as_distance_graph, as_edge_graph, as_intersection_graph, as_path, as_spatial_graph, beta_index, betweenness_centrality, biggest_cliques_of, connected_components_of, connectivity_index, contains_edge, contains_vertex, degree_of, directed, edge, edge_between, edge_betweenness, edges, gamma_index, generate_barabasi_albert, generate_complete_graph, generate_random_graph, generate_watts_strogatz, girvan_newman_clustering, grid_cells_to_graph, in_degree_of, in_edges_of, k_spanning_tree_clustering, label_propagation_clustering, layout_circle, layout_force, layout_force_FR, layout_force_FR_indexed, layout_grid, load_shortest_paths, main_connected_component, max_flow_between, maximal_cliques_of, nb_cycles, neighbors_of, node, nodes, out_degree_of, out_edges_of, path_between, paths_between, predecessors_of, remove_node_from, rewire_n, source_of, spatial_graph, strahler, successors_of, sum, target_of, undirected, use_cache, weight_of, with_k_shortest_path_algorithm, with_shortest_path_algorithm, with_weights,
Grid-related operators​
as_4_grid, as_grid, as_hexagonal_grid, cell_at, cells_in, cells_overlapping, field, grid_at, neighbors_of, path_between, points_in, values_in,
ImageOperators​
*, antialiased, blend, blurred, brighter, clipped_with, darker, grayscale, horizontal_flip, image, matrix, rotated_by, sharpened, snapshot, tinted_with, vertical_flip, with_height, with_size, with_width,
Iterator operators​
accumulate, all_match, as_map, collect, count, create_map, first_with, frequency_of, group_by, index_by, last_with, max_of, mean_of, min_of, none_matches, one_matches, product_of, sort_by, sum_of, variance_of, where, where, where, with_max_of, with_min_of,
List-related operators​
all_indexes_of, copy_between, index_of, last_index_of,
Logical operators​
:, !, ?, add_3Dmodel, add_geometry, add_icon, and, or, xor,
Map comparaison operators​
fuzzy_kappa, fuzzy_kappa_sim, kappa, kappa_sim, percent_absolute_deviation,
Map-related operators​
as_map, create_map, index_of, last_index_of,
Matrix-related operators​
-, /, ., *, +, append_horizontally, append_vertically, column_at, columns_list, determinant, eigenvalues, flatten, index_of, inverse, last_index_of, row_at, rows_list, shuffle, trace, transpose,
multicriteria operators​
electre_DM, evidence_theory_DM, fuzzy_choquet_DM, promethee_DM, weighted_means_DM,
Path-related operators​
agent_from_geometry, all_pairs_shortest_path, as_path, load_shortest_paths, max_flow_between, path_between, path_to, paths_between, use_cache,
Pedestrian​
Points-related operators​
-, /, *, +, <, <=, >, >=, add_point, angle_between, any_location_in, centroid, closest_points_with, farthest_point_to, grid_at, norm, points_along, points_at, points_on,
Random operators​
binomial, exp_density, exp_rnd, flip, gamma_density, gamma_rnd, gamma_trunc_rnd, gauss, generate_terrain, lognormal_density, lognormal_rnd, lognormal_trunc_rnd, poisson, rnd, rnd_choice, sample, shuffle, skew_gauss, truncated_gauss, weibull_density, weibull_rnd, weibull_trunc_rnd,
ReverseOperators​
Shape​
arc, box, circle, cone, cone3D, cross, cube, curve, cylinder, ellipse, elliptical_arc, envelope, geometry_collection, hexagon, line, link, plan, polygon, polyhedron, pyramid, rectangle, sphere, square, squircle, teapot, triangle,
Spatial operators​
-, *, +, add_point, agent_closest_to, agent_farthest_to, agents_at_distance, agents_covering, agents_crossing, agents_inside, agents_overlapping, agents_partially_overlapping, agents_touching, angle_between, any_location_in, arc, around, as_4_grid, as_driving_graph, as_grid, as_hexagonal_grid, at_distance, at_location, box, centroid, circle, clean, clean_network, closest_points_with, closest_to, cone, cone3D, convex_hull, covering, covers, cross, crosses, crossing, crs, CRS_transform, cube, curve, cylinder, direction_between, disjoint_from, distance_between, distance_to, ellipse, elliptical_arc, envelope, farthest_point_to, farthest_to, geometry_collection, gini, hexagon, hierarchical_clustering, IDW, inside, inter, intersects, inverse_rotation, k_nearest_neighbors, line, link, masked_by, moran, neighbors_at, neighbors_of, normalized_rotation, overlapping, overlaps, partially_overlapping, partially_overlaps, path_between, path_to, plan, points_along, points_at, points_on, polygon, polyhedron, pyramid, rectangle, rotated_by, rotation_composition, round, scaled_to, set_z, simple_clustering_by_distance, simplification, skeletonize, smooth, sphere, split_at, split_geometry, split_lines, square, squircle, teapot, to_GAMA_CRS, to_rectangles, to_segments, to_squares, to_sub_geometries, touches, touching, towards, transformed_by, translated_by, triangle, triangulate, union, using, voronoi, with_precision, without_holes,
Spatial properties operators​
covers, crosses, intersects, partially_overlaps, touches,
Spatial queries operators​
agent_closest_to, agent_farthest_to, agents_at_distance, agents_covering, agents_crossing, agents_inside, agents_overlapping, agents_partially_overlapping, agents_touching, at_distance, closest_to, covering, crossing, farthest_to, inside, neighbors_at, neighbors_of, overlapping, partially_overlapping, touching,
Spatial relations operators​
direction_between, distance_between, distance_to, path_between, path_to, towards,
Spatial statistical operators​
hierarchical_clustering, k_nearest_neighbors, simple_clustering_by_distance,
Spatial transformations operators​
-, *, +, as_4_grid, as_grid, as_hexagonal_grid, at_location, clean, clean_network, convex_hull, CRS_transform, inverse_rotation, normalized_rotation, rotated_by, rotation_composition, scaled_to, simplification, skeletonize, smooth, split_geometry, split_lines, to_GAMA_CRS, to_rectangles, to_segments, to_squares, to_sub_geometries, transformed_by, translated_by, triangulate, voronoi, with_precision, without_holes,
Species-related operators​
index_of, last_index_of, of_generic_species, of_species,
Statistical operators​
auto_correlation, beta, binomial_coeff, binomial_complemented, binomial_sum, build, chi_square, chi_square_complemented, correlation, covariance, dbscan, distribution_of, distribution2d_of, dtw, durbin_watson, frequency_of, gamma, gamma_distribution, gamma_distribution_complemented, geometric_mean, gini, harmonic_mean, hierarchical_clustering, incomplete_beta, incomplete_gamma, incomplete_gamma_complement, k_nearest_neighbors, kmeans, kurtosis, log_gamma, max, mean, mean_deviation, median, min, moment, moran, morrisAnalysis, mul, normal_area, normal_density, normal_inverse, predict, pValue_for_fStat, pValue_for_tStat, quantile, quantile_inverse, rank_interpolated, residuals, rms, rSquare, simple_clustering_by_distance, skewness, sobolAnalysis, split, split_in, split_using, standard_deviation, student_area, student_t_inverse, sum, t_test, variance,
Strings-related operators​
+, <, <=, >, >=, at, capitalize, char, contains, contains_all, contains_any, copy_between, date, empty, first, in, indented_by, index_of, is_number, last, last_index_of, length, lower_case, regex_matches, replace, replace_regex, reverse, sample, shuffle, split_with, string, upper_case,
SubModel​
System​
., choose, command, copy, copy_from_clipboard, copy_to_clipboard, copy_to_clipboard, dead, enter, eval_gaml, every, is_error, is_reachable, is_warning, play_sound, user_confirm, user_input_dialog, wizard, wizard_page,
Time-related operators​
Types-related operators​
action, agent, attributes, BDIPlan, bool, container, conversation, directory, emotion, file, float, gaml_type, geometry, graph, int, kml, list, map, matrix, mental_state, message, Norm, pair, path, point, predicate, regression, rgb, Sanction, skill, social_link, species, topology, unknown,
User control operators​
choose, enter, user_confirm, user_input_dialog, wizard, wizard_page,
Operators​
IDW
​
Possible uses:​
IDW
(container<unknown,geometry>
,map
,int
) --->map<geometry,float>
Result:​
Inverse Distance Weighting (IDW) is a type of deterministic method for multivariate interpolation with a known scattered set of points. The assigned values to each geometry are calculated with a weighted average of the values available at the known points. See: http://en.wikipedia.org/wiki/Inverse_distance_weighting Usage: IDW (list of geometries, map of points (key: point, value: value), power parameter)
Examples:​
map<geometry,float> var0 <- IDW([ag1, ag2, ag3, ag4, ag5],[{10,10}::25.0, {10,80}::10.0, {100,10}::15.0], 2); // var0 equals for example, can return [ag1::12.0, ag2::23.0,ag3::12.0,ag4::14.0,ag5::17.0]
image
​
Possible uses:​
int
image
int
--->image
image
(int
,int
) --->image
image
(file
,int
,int
) --->image
image
(int
,int
,bool
) --->image
image
(int
,int
,rgb
) --->image
Result:​
Builds a new image from the specified file, p assing the width and height in parameter Builds a new blank image with the specified dimensions and indicates if it will support transparency or not Builds a new blank image of the specified dimensions, which does not accept transparency Builds a new image with the specified dimensions and already filled with the given rgb color
image_file
​
Possible uses:​
image_file
(string
) --->file
string
image_file
string
--->file
image_file
(string
,string
) --->file
string
image_file
matrix<int>
--->file
image_file
(string
,matrix<int>
) --->file
string
image_file
java.awt.image.BufferedImage
--->file
image_file
(string
,java.awt.image.BufferedImage
) --->file
Result:​
Constructs a file of type image. Allowed extensions are limited to tiff, jpg, jpeg, png, pict, bmp
Special cases:​
- image_file(string,java.awt.image.BufferedImage):
- image_file(string): This file constructor allows to read an image file (tiff, jpg, jpeg, png, pict, bmp)
file f <-image_file("file.png");
- image_file(string,string): This file constructor allows to read an image file (tiff, jpg, jpeg, png, pict, bmp) and to force the extension of the file (can be useful for images coming from URL)
file f <-image_file("http://my_url", "png");
- image_file(string,matrix<int>): This file constructor allows to store a matrix in a image file (it does not save it - just store it in memory)
file f <-image_file("file.png");
See also: is_image,
in
​
Possible uses:​
unknown
in
container
--->bool
in
(unknown
,container
) --->bool
string
in
string
--->bool
in
(string
,string
) --->bool
Result:​
true if the right operand contains the left operand, false otherwise
Comment:​
the definition of in depends on the container
Special cases:​
- if the right operand is nil or empty, in returns false
- if both operands are strings, returns true if the left-hand operand patterns is included in to the right-hand string;
Examples:​
bool var0 <- 2 in [1,2,3,4,5,6]; // var0 equals true
bool var1 <- 7 in [1,2,3,4,5,6]; // var1 equals false
bool var2 <- 3 in [1::2, 3::4, 5::6]; // var2 equals false
bool var3 <- 6 in [1::2, 3::4, 5::6]; // var3 equals true
bool var4 <- 'bc' in 'abcded'; // var4 equals true
See also: contains,
in_degree_of
​
Possible uses:​
graph
in_degree_of
unknown
--->int
in_degree_of
(graph
,unknown
) --->int
Result:​
returns the in degree of a vertex (right-hand operand) in the graph given as left-hand operand.
Examples:​
int var1 <- graphFromMap in_degree_of (node(3)); // var1 equals 2
See also: out_degree_of, degree_of,
in_edges_of
​
Possible uses:​
graph
in_edges_of
unknown
--->list
in_edges_of
(graph
,unknown
) --->list
Result:​
returns the list of the in-edges of a vertex (right-hand operand) in the graph given as left-hand operand.
Examples:​
list var1 <- graphFromMap in_edges_of node({12,45}); // var1 equals [LineString]
See also: out_edges_of,
incomplete_beta
​
Possible uses:​
incomplete_beta
(float
,float
,float
) --->float
Result:​
Returns the regularized integral of the beta function with arguments a and b, from zero to x.
Examples:​
float var0 <- incomplete_beta(2,3,0.9) with_precision(3); // var0 equals 0.996
incomplete_gamma
​
Possible uses:​
float
incomplete_gamma
float
--->float
incomplete_gamma
(float
,float
) --->float
Result:​
Returns the regularized integral of the Gamma function with argument a to the integration end point x.
Examples:​
float var0 <- incomplete_gamma(1,5.3) with_precision(3); // var0 equals 0.995
incomplete_gamma_complement
​
Possible uses:​
float
incomplete_gamma_complement
float
--->float
incomplete_gamma_complement
(float
,float
) --->float
Result:​
Returns the complemented regularized incomplete Gamma function of the argument a and integration start point x.
Comment:​
Is the complement to 1 of incomplete_gamma.
Examples:​
float var0 <- incomplete_gamma_complement(1,5.3) with_precision(3); // var0 equals 0.005
indented_by
​
Possible uses:​
string
indented_by
int
--->string
indented_by
(string
,int
) --->string
Result:​
Converts a (possibly multiline) string by indenting it by a number -- specified by the second operand -- of tabulations to the right
Examples:​
string var0 <- "my" + indented_by("text", 1); // var0 equals "my text"
index_by
​
Possible uses:​
container
index_by
any expression
--->map
index_by
(container
,any expression
) --->map
Result:​
produces a new map from the evaluation of the right-hand operand for each element of the left-hand operand
Special cases:​
- if the left-hand operand is nil, index_by throws an error. If the operation results in duplicate keys, only the first value corresponding to the key is kept
Examples:​
map var0 <- [1,2,3,4,5,6,7,8] index_by (each - 1); // var0 equals [0::1, 1::2, 2::3, 3::4, 4::5, 5::6, 6::7, 7::8]
index_of
​
Possible uses:​
string
index_of
string
--->int
index_of
(string
,string
) --->int
species
index_of
unknown
--->int
index_of
(species
,unknown
) --->int
matrix
index_of
unknown
--->point
index_of
(matrix
,unknown
) --->point
map<unknown,unknown>
index_of
unknown
--->unknown
index_of
(map<unknown,unknown>
,unknown
) --->unknown
list
index_of
unknown
--->int
index_of
(list
,unknown
) --->int
Result:​
the index of the first occurence of the right operand in the left operand container
Comment:​
The definition of index_of and the type of the index depend on the container
Special cases:​
- if the left operator is a species, returns the index of an agent in a species. If the argument is not an agent of this species, returns -1. Use int(agent) instead
- if the left operand is a map, index_of returns the index of a value or nil if the value is not mapped
- if both operands are strings, returns the index within the left-hand string of the first occurrence of the given right-hand string
int var1 <- "abcabcabc" index_of "ca"; // var1 equals 2
- if the left operand is a matrix, index_of returns the index as a point
point var2 <- matrix([[1,2,3],[4,5,6]]) index_of 4; // var2 equals {1.0,0.0}
- if the left operand is a list, index_of returns the index as an integer
int var3 <- [1,2,3,4,5,6] index_of 4; // var3 equals 3
int var4 <- [4,2,3,4,5,4] index_of 4; // var4 equals 0
Examples:​
unknown var0 <- [1::2, 3::4, 5::6] index_of 4; // var0 equals 3
See also: at, last_index_of,
inside
​
Possible uses:​
container<unknown,geometry>
inside
geometry
--->list<geometry>
inside
(container<unknown,geometry>
,geometry
) --->list<geometry>
Result:​
A list of agents or geometries among the left-operand list, species or meta-population (addition of species), covered by the operand (casted as a geometry).
Examples:​
list<geometry> var0 <- [ag1, ag2, ag3] inside(self); // var0 equals the agents among ag1, ag2 and ag3 that are covered by the shape of the right-hand argument.
list<geometry> var1 <- (species1 + species2) inside (self); // var1 equals the agents among species species1 and species2 that are covered by the shape of the right-hand argument.
See also: neighbors_at, neighbors_of, closest_to, overlapping, agents_overlapping, agents_inside, agent_closest_to,
int
​
Possible uses:​
int
(any
) --->int
Result:​
casts the operand in a int object.
inter
​
Possible uses:​
geometry
inter
geometry
--->geometry
inter
(geometry
,geometry
) --->geometry
container
inter
container
--->list
inter
(container
,container
) --->list
Result:​
A geometry resulting from the intersection between the two geometries the intersection of the two operands
Comment:​
both containers are transformed into sets (so without duplicated element, cf. remove_deplicates operator) before the set intersection is computed.
Special cases:​
- returns nil if one of the operands is nil
- if an operand is a graph, it will be transformed into the set of its nodes
- if an operand is a map, it will be transformed into the set of its values
list var3 <- [1::2, 3::4, 5::6] inter [2,4]; // var3 equals [2,4]
list var4 <- [1::2, 3::4, 5::6] inter [1,3]; // var4 equals []
- if an operand is a matrix, it will be transformed into the set of the lines
list var5 <- matrix([[3,2,1],[4,5,4]]) inter [3,4]; // var5 equals [3,4]
Examples:​
geometry var0 <- square(10) inter circle(5); // var0 equals circle(5)
list var1 <- [1,2,3,4,5,6] inter [2,4]; // var1 equals [2,4]
list var2 <- [1,2,3,4,5,6] inter [0,8]; // var2 equals []
See also: union, +, -, remove_duplicates,
interleave
​
Possible uses:​
interleave
(container
) --->list
Result:​
Returns a new list containing the interleaved elements of the containers contained in the operand
Comment:​
the operand should be a list of lists of elements. The result is a list of elements.
Examples:​
list var0 <- interleave([1,2,4,3,5,7,6,8]); // var0 equals [1,2,4,3,5,7,6,8]
list var1 <- interleave([['e11','e12','e13'],['e21','e22','e23'],['e31','e32','e33']]); // var1 equals ['e11','e21','e31','e12','e22','e32','e13','e23','e33']
internal_integrated_value
​
Possible uses:​
any expression
internal_integrated_value
any expression
--->list
internal_integrated_value
(any expression
,any expression
) --->list
Result:​
For internal use only. Corresponds to the implementation, for agents, of the access to containers with [index]
intersecting
​
Same signification as overlapping
intersection
​
Same signification as inter
intersects
​
Possible uses:​
geometry
intersects
geometry
--->bool
intersects
(geometry
,geometry
) --->bool
Result:​
A boolean, equal to true if the left-geometry (or agent/point) intersects the right-geometry (or agent/point).
Special cases:​
- if one of the operand is null, returns false.
Examples:​
bool var0 <- square(5) intersects {10,10}; // var0 equals false
See also: disjoint_from, crosses, overlaps, partially_overlaps, touches,
inverse
​
Possible uses:​
inverse
(matrix
) --->matrix<float>
Result:​
The inverse matrix of the given matrix. If no inverse exists, returns a matrix that has properties that resemble that of an inverse.
Examples:​
matrix<float> var0 <- inverse(matrix([[4,3],[3,2]])); // var0 equals matrix([[-2.0,3.0],[3.0,-4.0]])
inverse_distance_weighting
​
Same signification as IDW
inverse_rotation
​
Possible uses:​
inverse_rotation
(pair<float,point>
) --->pair<float,point>
Result:​
The inverse rotation. It is a rotation around the same axis with the opposite angle.
Examples:​
pair<float,point> var0 <- inverse_rotation(38.0::{1,1,1}); // var0 equals -38.0::{1,1,1}
See also: [rotation_composition, normalized_rotation](OperatorsSZ#rotation_composition, normalized_rotation),
is
​
Possible uses:​
unknown
is
any expression
--->bool
is
(unknown
,any expression
) --->bool
Result:​
returns true if the left operand is of the right operand type, false otherwise
Examples:​
bool var0 <- 0 is int; // var0 equals true
bool var1 <- an_agent is node; // var1 equals true
bool var2 <- 1 is float; // var2 equals false
is_agent
​
Possible uses:​
is_agent
(any
) --->bool
Result:​
Tests whether the operand is a agent file.
See also: agent_file,
is_csv
​
Possible uses:​
is_csv
(any
) --->bool
Result:​
Tests whether the operand is a csv file.
See also: csv_file,
is_dxf
​
Possible uses:​
is_dxf
(any
) --->bool
Result:​
Tests whether the operand is a dxf file.
See also: dxf_file,
is_error
​
Possible uses:​
is_error
(any expression
) --->bool
Result:​
Returns whether or not the argument raises an error when evaluated
is_finite
​
Possible uses:​
is_finite
(float
) --->bool
Result:​
Returns whether the argument is a finite number or not
Examples:​
bool var0 <- is_finite(4.66); // var0 equals true
bool var1 <- is_finite(#infinity); // var1 equals false
is_gaml
​
Possible uses:​
is_gaml
(any
) --->bool
Result:​
Tests whether the operand is a gaml file.
See also: gaml_file,
is_geojson
​
Possible uses:​
is_geojson
(any
) --->bool
Result:​
Tests whether the operand is a geojson file.
See also: geojson_file,
is_gif
​
Possible uses:​
is_gif
(any
) --->bool
Result:​
Tests whether the operand is a gif file.
See also: gif_file,
is_gml
​
Possible uses:​
is_gml
(any
) --->bool
Result:​
Tests whether the operand is a gml file.
See also: gml_file,
is_graph6
​
Possible uses:​
is_graph6
(any
) --->bool
Result:​
Tests whether the operand is a graph6 file.
See also: graph6_file,
is_graphdimacs
​
Possible uses:​
is_graphdimacs
(any
) --->bool
Result:​
Tests whether the operand is a graphdimacs file.
See also: graphdimacs_file,
is_graphdot
​
Possible uses:​
is_graphdot
(any
) --->bool
Result:​
Tests whether the operand is a graphdot file.
See also: graphdot_file,
is_graphgexf
​
Possible uses:​
is_graphgexf
(any
) --->bool
Result:​
Tests whether the operand is a graphgexf file.
See also: graphgexf_file,
is_graphgml
​
Possible uses:​
is_graphgml
(any
) --->bool
Result:​
Tests whether the operand is a graphgml file.
See also: graphgml_file,
is_graphml
​
Possible uses:​
is_graphml
(any
) --->bool
Result:​
Tests whether the operand is a graphml file.
See also: graphml_file,
is_graphtsplib
​
Possible uses:​
is_graphtsplib
(any
) --->bool
Result:​
Tests whether the operand is a graphtsplib file.
See also: graphtsplib_file,
is_grid
​
Possible uses:​
is_grid
(any
) --->bool
Result:​
Tests whether the operand is a grid file.
See also: grid_file,
is_image
​
Possible uses:​
is_image
(any
) --->bool
Result:​
Tests whether the operand is a image file.
See also: image_file,
is_json
​
Possible uses:​
is_json
(any
) --->bool
Result:​
Tests whether the operand is a json file.
See also: json_file,
is_number
​
Possible uses:​
is_number
(string
) --->bool
is_number
(float
) --->bool
Result:​
tests whether the operand represents a numerical value Returns whether the argument is a real number or not
Comment:​
Note that the symbol . should be used for a float value (a string with , will not be considered as a numeric value). Symbols e and E are also accepted. A hexadecimal value should begin with #.
Examples:​
bool var0 <- is_number("test"); // var0 equals false
bool var1 <- is_number("123.56"); // var1 equals true
bool var2 <- is_number("-1.2e5"); // var2 equals true
bool var3 <- is_number("1,2"); // var3 equals false
bool var4 <- is_number("#12FA"); // var4 equals true
bool var5 <- is_number(4.66); // var5 equals true
bool var6 <- is_number(#infinity); // var6 equals true
bool var7 <- is_number(#nan); // var7 equals false
is_obj
​
Possible uses:​
is_obj
(any
) --->bool
Result:​
Tests whether the operand is a obj file.
See also: obj_file,
is_osm
​
Possible uses:​
is_osm
(any
) --->bool
Result:​
Tests whether the operand is a osm file.
See also: osm_file,
is_pgm
​
Possible uses:​
is_pgm
(any
) --->bool
Result:​
Tests whether the operand is a pgm file.
See also: pgm_file,
is_property
​
Possible uses:​
is_property
(any
) --->bool
Result:​
Tests whether the operand is a property file.
See also: property_file,
is_reachable
​
Possible uses:​
string
is_reachable
int
--->bool
is_reachable
(string
,int
) --->bool
is_reachable
(string
,int
,int
) --->bool
Result:​
Returns whether or not the given web address is reachable or not before a time_out time in milliseconds Returns whether or not the given web address is reachable or not before a time_out time in milliseconds
Examples:​
write sample(is_reachable("www.google.com", 200));
write sample(is_reachable("www.google.com", 200));
is_shape
​
Possible uses:​
is_shape
(any
) --->bool