Documentation for Eidos function defineGlobal, which is a method of Eidos. Note that the R function is a stub, it does not do anything in R (except bring up this documentation). It will only do anything useful when used inside a slim_block function further nested in a slim_script function call, where it will be translated into valid SLiM code as part of a full SLiM script.

eidos_defineGlobal(symbol, value)

Arguments

symbol

An object of type string or any. Must be of length 1 (a singleton). See details for description.

value

An object of type string or any. See details for description.

Value

An object of type void.

Details

Documentation for this function can be found in the official SLiM manual: page NA.

Defines a new global variable with the name symbol and the value specified by value. The name cannot previously be defined as a constant. The result is similar to a standard variable assignment with operator =, except that the variable is always defined in the global scope (even if the defineGlobal() call is made inside a user-defined function or other locally-scoped block, such as a SLiM event or callback). This means that the variable will remain defined even after the current scope is exited. Note that global variables can be hidden by local variables with the same name; unlike defined constants, such scoped masking is allowed. Syntactically, value may be any value at all; semantically, however, if value is of object type then value's class must be under an internal memory-management scheme called "retain-release". Objects that are not under retain-release can cease to exist whenever the Context is finished using them, and thus a global variable referencing such an object could become invalid, which must be 80 prevented. Objects that are under retain-release will not cease to exist if they are referenced by a global variable; the reference to them from the global variable "retains" them and keeps them in existence. All object classes built into Eidos are under retain-release; see the SLiM manual (section "SLiM scoping rules") for discussion of which SLiM object classes are under retain-release. Section 4.5 of this manual discusses this topic further. (vNlifso)doCall(string$ functionName, ...) Returns the results from a call to a specified function. The function named by the parameter functionName is called, and the remaining parameters to doCall() are forwarded on to that function verbatim. This can be useful for calling one of a set of similar functions, such as sin(), cos(), etc., to perform a math function determined at runtime, or one of the as...() family of functions to convert to a type determined at runtime. Note that named arguments and default arguments, beyond the functionName argument, are not supported by doCall(); all arguments to the target function must be specified explicitly, without names. (vNlifso)executeLambda(string$ lambdaSource, [ls$ timed = F]) Executes a block of Eidos code defined by lambdaSource. Eidos allows you to execute lambdas: blocks of Eidos code which can be called directly within the same scope as the caller. Eidos lambdas do not take arguments; for this reason, they are not first-class functions. (Since they share the scope of the caller, however, you may effectively pass values in and out of a lambda using variables.) The string argument lambdaSource may contain one or many Eidos statements as a single string value. Lambdas are represented, to the caller, only as the source code string lambdaSource; the executable code is not made available programmatically. If an error occurs during the tokenization, parsing, or execution of the lambda, that error is raised as usual; executing code inside a lambda does not provide any additional protection against exceptions raised. The return value produced by the code in the lambda is returned by executeLambda(). If the optional parameter timed is T, the total (CPU clock) execution time for the lambda will be printed after the lambda has completed (see clock()); if it is F (the default), no timing information will be printed. The timed parameter may also be "cpu" or "mono" to specifically request timing with the CPU clock (which will count the usage across all cores, and may thus run faster than wall clock time if multiple cores are being utilized) or the monotonic clock (which will correspond, more or less, to elapsed wall clock time regardless of multithreading); see the documentation for clock() for further discussion of these timing options. The current implementation of executeLambda() caches a tokenized and parsed version of lambdaSource, so calling executeLambda() repeatedly on a single source string is much more efficient than calling executeLambda() with a newly constructed string each time. If you can use a string literal for lambdaSource, or reuse a constructed source string stored in a variable, that will improve performance considerably.

See also

Other Eidos: Eidos, eidos_abs(), eidos_acos(), eidos_all(), eidos_any(), eidos_apply(), eidos_array(), eidos_asFloat(), eidos_asInteger(), eidos_asLogical(), eidos_asString(), eidos_asin(), eidos_assert(), eidos_atan2(), eidos_atan(), eidos_beep(), eidos_catn(), eidos_cat(), eidos_cbind(), eidos_ceil(), eidos_citation(), eidos_clock(), eidos_cmColors(), eidos_color2rgb(), eidos_colors(), eidos_cor(), eidos_cos(), eidos_cov(), eidos_createDirectory(), eidos_cumProduct(), eidos_cumSum(), eidos_c(), eidos_date(), eidos_dbeta(), eidos_debugIndent(), eidos_defineConstant(), eidos_deleteFile(), eidos_dexp(), eidos_dgamma(), eidos_diag(), eidos_dim(), eidos_dmvnorm(), eidos_dnorm(), eidos_drop(), eidos_elementType(), eidos_exists(), eidos_exp(), eidos_fileExists(), eidos_filesAtPath(), eidos_findInterval(), eidos_float(), eidos_floor(), eidos_flushFile(), eidos_format(), eidos_functionSignature(), eidos_functionSource(), eidos_getSeed(), eidos_getwd(), eidos_heatColors(), eidos_hsv2rgb(), eidos_identical(), eidos_ifelse(), eidos_integerDiv(), eidos_integerMod(), eidos_integer(), eidos_isFinite(), eidos_isFloat(), eidos_isInfinite(), eidos_isInteger(), eidos_isLogical(), eidos_isNAN(), eidos_isNULL(), eidos_isObject(), eidos_isString(), eidos_length(), eidos_license(), eidos_log10(), eidos_log2(), eidos_logical(), eidos_log(), eidos_lowerTri(), eidos_ls(), eidos_match(), eidos_matrixMult(), eidos_matrix(), eidos_max(), eidos_mean(), eidos_min(), eidos_nchar(), eidos_ncol(), eidos_nrow(), eidos_object(), eidos_order(), eidos_paste0(), eidos_paste(), eidos_pmax(), eidos_pmin(), eidos_pnorm(), eidos_print(), eidos_product(), eidos_qnorm(), eidos_quantile(), eidos_rainbow(), eidos_range(), eidos_rank(), eidos_rbeta(), eidos_rbind(), eidos_rbinom(), eidos_rcauchy(), eidos_rdunif(), eidos_readCSV(), eidos_readFile(), eidos_repEach(), eidos_rep(), eidos_rev(), eidos_rexp(), eidos_rf(), eidos_rgamma(), eidos_rgb2color(), eidos_rgb2hsv(), eidos_rgeom(), eidos_rlnorm(), eidos_rmvnorm(), eidos_rm(), eidos_rnbinom(), eidos_rnorm(), eidos_round(), eidos_rpois(), eidos_runif(), eidos_rweibull(), eidos_sample(), eidos_sapply(), eidos_sd(), eidos_seqAlong(), eidos_seqLen(), eidos_seq(), eidos_setDifference(), eidos_setIntersection(), eidos_setSeed(), eidos_setSymmetricDifference(), eidos_setUnion(), eidos_setwd(), eidos_sin(), eidos_size(), eidos_sortBy(), eidos_sort(), eidos_source(), eidos_sqrt(), eidos_stop(), eidos_strcontains(), eidos_strfind(), eidos_string(), eidos_strprefix(), eidos_strsplit(), eidos_strsuffix(), eidos_str(), eidos_substr(), eidos_sumExact(), eidos_sum(), eidos_suppressWarnings(), eidos_sysinfo(), eidos_system(), eidos_tabulate(), eidos_tan(), eidos_tempdir(), eidos_terrainColors(), eidos_time(), eidos_trunc(), eidos_ttest(), eidos_type(), eidos_t(), eidos_unique(), eidos_upperTri(), eidos_usage(), eidos_var(), eidos_version(), eidos_whichMax(), eidos_whichMin(), eidos_which(), eidos_writeFile(), eidos_writeTempFile()

Author

Benjamin C Haller (bhaller@benhaller.com) and Philipp W Messer (messer@cornell.edu)