UNPKG

js-slang

Version:

Javascript-based implementations of Source, written in Typescript

428 lines (427 loc) 37.5 kB
{ "Infinity": { "title": "Infinity:number", "description": "<div><h4>Infinity:number</h4><div class=\"description\">\n The name <code>Infinity</code> refers to the special number value <code>Infinity</code>.\nSee <a href=\"https://www.ecma-international.org/ecma-262/9.0/index.html#sec-value-properties-of-the-global-object-infinity\">ECMAScript Specification, Section 4.3.23</a>\n</div></div>", "meta": "const" }, "math_E": { "title": "math_E:number", "description": "<div><h4>math_E:number</h4><div class=\"description\">\n The Number value for e, Euler's number,\nwhich is approximately 2.718281828459045.\n</div></div>", "meta": "const" }, "math_LN2": { "title": "math_LN2:number", "description": "<div><h4>math_LN2:number</h4><div class=\"description\">\n The Number value for the natural logarithm of 2,\nwhich is approximately 0.6931471805599453.\n</div></div>", "meta": "const" }, "math_LN10": { "title": "math_LN10:number", "description": "<div><h4>math_LN10:number</h4><div class=\"description\">\n The Number value for the natural logarithm of 10,\nwhich is approximately 2.302585092994046.\n</div></div>", "meta": "const" }, "math_LOG2E": { "title": "math_LOG2E:number", "description": "<div><h4>math_LOG2E:number</h4><div class=\"description\">\n The Number value for the base-2 logarithm of eℝ, the base of the natural logarithms; \nthis value is approximately 1.4426950408889634.\n\n<p>NOTE:\nThe value of math_LOG2E is approximately the reciprocal of the value of math_LN2.\n</p></div></div>", "meta": "const" }, "math_LOG10E": { "title": "math_LOG10E:number", "description": "<div><h4>math_LOG10E:number</h4><div class=\"description\">\n The Number value for the base-10 logarithm of e, \nthe base of the natural logarithms; this value is approximately 0.4342944819032518.\n\n<p>NOTE:\nThe value of math_LOG10E is approximately the reciprocal of the value of math_LN10.\n</p></div></div>", "meta": "const" }, "math_PI": { "title": "math_PI:number", "description": "<div><h4>math_PI:number</h4><div class=\"description\">\n The Number value for π, the ratio of the circumference of a circle to its diameter, \nwhich is approximately 3.1415926535897932.\n</div></div>", "meta": "const" }, "math_SQRT1_2": { "title": "math_SQRT1_2:number", "description": "<div><h4>math_SQRT1_2:number</h4><div class=\"description\">\n The Number value for the square root of 0.5, which is approximately 0.7071067811865476.\n\n<p>NOTE:\nThe value of math_SQRT1_2 is approximately the reciprocal of the value of math_SQRT2.\n</p></div></div>", "meta": "const" }, "math_SQRT2": { "title": "math_SQRT2:number", "description": "<div><h4>math_SQRT2:number</h4><div class=\"description\">\n The Number value for the square root of 2, which is approximately 1.4142135623730951.\n</div></div>", "meta": "const" }, "NaN": { "title": "NaN:number", "description": "<div><h4>NaN:number</h4><div class=\"description\">\n The name <code>NaN</code> refers to the special number value <code>NaN</code> (\"not a number\"). Note that\n<code>NaN</code> is a number, as specified by <code>is_number</code>.\nSee <a href=\"https://www.ecma-international.org/ecma-262/9.0/index.html#sec-value-properties-of-the-global-object-nan\">ECMAScript Specification, Section 4.3.24</a>\n</div></div>", "meta": "const" }, "undefined": { "title": "undefined:undefined", "description": "<div><h4>undefined:undefined</h4><div class=\"description\">\n The name <code>undefined</code> refers to the special value <code>undefined</code>.\nSee also <a href=\"https://sourceacademy.org/sicpjs/4.1.1#h5\">textbook explanation in section 4.1.1</a>.\n</div></div>", "meta": "const" }, "__access_export__": { "title": "__access_export__(exports, lookup_name) → {value}", "description": "<div><h4>__access_export__(exports, lookup_name) → {value}</h4><div class=\"description\">\n Searches for the specified name in the data structure of exported names.\nThe data structure is a pair where the head element is the default export\nand the tail element is a list of pairs where each pair is a mapping from\nthe exported name to the value being exported. If the lookup name is\n\"default\", the default export is returned instead of a named export. If\nthe name does not exist, <code>undefined</code> is returned.\n</div></div>", "meta": "func" }, "__access_named_export__": { "title": "__access_named_export__(named_exports, lookup_name) → {value}", "description": "<div><h4>__access_named_export__(named_exports, lookup_name) → {value}</h4><div class=\"description\">\n Searches for the specified name in the data structure of exported names.\nThe data structure is a list of pairs where each pair is a mapping from\nthe exported name to the value being exported. If the name does not exist,\n<code>undefined</code> is returned.\n</div></div>", "meta": "func" }, "accumulate": { "title": "accumulate(f, initial, xs) → {value}", "description": "<div><h4>accumulate(f, initial, xs) → {value}</h4><div class=\"description\">\n Applies binary\nfunction <code>f</code> to the elements of <code>xs</code> from\nright-to-left order, first applying <code>f</code> to the last element\nand the value <code>initial</code>, resulting in <code>r</code><sub>1</sub>,\nthen to the\nsecond-last element and <code>r</code><sub>1</sub>, resulting in\n<code>r</code><sub>2</sub>,\netc, and finally\nto the first element and <code>r</code><sub>n-1</sub>, where\n<code>n</code> is the length of the\nlist. Thus, <code>accumulate(f,zero,list(1,2,3))</code> results in\n<code>f(1, f(2, f(3, zero)))</code>.\nIterative process;\ntime: <code>Theta(n)</code> (apart from <code>f</code>), space: <code>Theta(n)</code> (apart from <code>f</code>),\nwhere <code>n</code> is the length of <code>xs</code>.\n</div></div>", "meta": "func" }, "append": { "title": "append(xs, ys) → {list}", "description": "<div><h4>append(xs, ys) → {list}</h4><div class=\"description\">\n Returns a list that results from\nappending the list <code>ys</code> to the list <code>xs</code>.\nIterative process; time: <code>Theta(n)</code>, space:\n<code>Theta(n)</code>, where <code>n</code> is the length of <code>xs</code>.\nIn the result, null at the end of the first argument list\nis replaced by the second argument, regardless what the second\nargument consists of.\n</div></div>", "meta": "func" }, "arity": { "title": "arity(f) → {number}", "description": "<div><h4>arity(f) → {number}</h4><div class=\"description\">\n Returns the number of parameters the given function <code>f</code> expects,\nexcluding the rest parameter.\n</div></div>", "meta": "func" }, "build_list": { "title": "build_list(f, n) → {list}", "description": "<div><h4>build_list(f, n) → {list}</h4><div class=\"description\">\n Makes a list with <code>n</code>\nelements by applying the unary function <code>f</code>\nto the numbers 0 to <code>n - 1</code>, assumed to be a nonnegative integer.\nIterative process; time: <code>Theta(n)</code> (apart from <code>f</code>), space: <code>Theta(n)</code> (apart from <code>f</code>).\n</div></div>", "meta": "func" }, "char_at": { "title": "char_at(s, i) → {string}", "description": "<div><h4>char_at(s, i) → {string}</h4><div class=\"description\">\n Takes a string <code>s</code> as first argument and a nonnegative integer\n<code>i</code> as second argument. If <code>i</code> is less than the length\nof <code>s</code>, this function returns a one-character string that contains\nthe character of <code>s</code> at position <code>i</code>, counting from 0.\nIf <code>i</code> is larger than or equal to the length of\n<code>s</code>, this function returns <code>undefined</code>.\n</div></div>", "meta": "func" }, "display": { "title": "display(v, s) → {value}", "description": "<div><h4>display(v, s) → {value}</h4><div class=\"description\">\n Optional second argument. If present,\ndisplays the given string <code>s</code>, followed by a space character, followed by the\nvalue <code>v</code> in the console.\nIf second argument not present,\njust displays the value <code>v</code> in the console.\nThe notation used for the display of values\nis consistent with\n<a href=\"http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-404.pdf\">JSON</a>,\nbut also displays <code>undefined</code>, <code>NaN</code>, <code>Infinity</code>, and function objects.\n</div></div>", "meta": "func" }, "display_list": { "title": "display_list(xs, s) → {value}", "description": "<div><h4>display_list(xs, s) → {value}</h4><div class=\"description\">\n Optional second argument.\nSimilar to <code>display</code>, but formats well-formed lists nicely if detected;\ntime, space:\n<code>Theta(n)</code>, where <code>n</code> is the total number of data structures such as\npairs in <code>x</code>.\n</div></div>", "meta": "func" }, "draw_data": { "title": "draw_data() → {value}", "description": "<div><h4>draw_data() → {value}</h4><div class=\"description\">\n visualizes the arguments in a separate drawing\narea in the Source Academy using box-and-pointer diagrams; time, space:\n<code>Theta(n)</code>, where <code>n</code> is the total number of data structures such as\npairs in the arguments.\n</div></div>", "meta": "func" }, "enum_list": { "title": "enum_list(start, end) → {list}", "description": "<div><h4>enum_list(start, end) → {list}</h4><div class=\"description\">\n Returns a list that enumerates\nnumbers starting from <code>start</code> using a step size of 1, until\nthe number exceeds (<code>&gt;</code>) <code>end</code>.\nIterative process;\ntime: <code>Theta(n)</code>, space: <code>Theta(n)</code>,\nwhere <code>n</code> is <code>end - start</code>.\n</div></div>", "meta": "func" }, "equal": { "title": "equal(x, y) → {boolean}", "description": "<div><h4>equal(x, y) → {boolean}</h4><div class=\"description\">\n Returns <code>true</code> if both\nhave the same structure with respect to <code>pair</code>,\nand identical values at corresponding leave positions (places that are not\nthemselves pairs), and <code>false</code> otherwise. For the \"identical\",\nthe values need to have the same type, otherwise the result is\n<code>false</code>. If corresponding leaves are boolean values, these values\nneed to be the same. If both are <code>undefined</code> or both are\n<code>null</code>, the result is <code>true</code>. Otherwise they are compared\nwith <code>===</code> (using the definition of <code>===</code> in the\nrespective Source language in use).\nTime, space:\n<code>Theta(n)</code>, where <code>n</code> is the total number of data structures such as\npairs in <code>x</code> and <code>y</code>.\n</div></div>", "meta": "func" }, "error": { "title": "error(v, s)", "description": "<div><h4>error(v, s)</h4><div class=\"description\">\n Optional second argument.\nIf present,\ndisplays the given string <code>s</code>, followed by a space character, followed by the\nvalue <code>v</code> in the console with error flag.\nIf second argument not present,\njust displays the value <code>v</code> in the console with error flag.\nThe evaluation\nof any call of <code>error</code> aborts the running program immediately.\nThe notation used for the display of values\nis consistent with\n<a href=\"http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-404.pdf\">JSON</a>,\nbut also displays <code>undefined</code>, <code>NaN</code>, <code>Infinity</code>, and function objects.\n</div></div>", "meta": "func" }, "filter": { "title": "filter(pred, xs) → {list}", "description": "<div><h4>filter(pred, xs) → {list}</h4><div class=\"description\">\n Returns a list that contains\nonly those elements for which the one-argument function\n<code>pred</code>\nreturns <code>true</code>.\nIterative process;\ntime: <code>Theta(n)</code> (apart from <code>pred</code>), space: <code>Theta(n)</code> (apart from <code>pred</code>),\nwhere <code>n</code> is the length of <code>xs</code>.\n</div></div>", "meta": "func" }, "for_each": { "title": "for_each(f, xs) → {boolean}", "description": "<div><h4>for_each(f, xs) → {boolean}</h4><div class=\"description\">\n Applies unary function <code>f</code> to every\nelement of the list <code>xs</code>.\nIterative process; time: <code>Theta(n)</code> (apart from <code>f</code>), space: <code>Theta(1)</code> (apart from <code>f</code>),\nwhere <code>n</code> is the length of <code>xs</code>.\n<code>f</code> is applied element-by-element:\n<code>for_each(fun, list(1, 2))</code> results in the calls\n<code>fun(1)</code> and <code>fun(2)</code>.\n</div></div>", "meta": "func" }, "get_time": { "title": "get_time() → {number}", "description": "<div><h4>get_time() → {number}</h4><div class=\"description\">\n Returns number of milliseconds elapsed since January 1, 1970 00:00:00 UTC.\nSee also <a href=\"https://sourceacademy.org/sicpjs/1.2.6#ex-1.21\">textbook example</a>.\n</div></div>", "meta": "func" }, "head": { "title": "head(p) → {value}", "description": "<div><h4>head(p) → {value}</h4><div class=\"description\">\n **primitive**; returns head (first component) of given pair <code>p</code>; time: <code>Theta(1)Theta(1)</code>.\n</div></div>", "meta": "func" }, "is_boolean": { "title": "is_boolean(v) → {boolean}", "description": "<div><h4>is_boolean(v) → {boolean}</h4><div class=\"description\">\n checks whether a given value is a boolean\n</div></div>", "meta": "func" }, "is_function": { "title": "is_function(v) → {boolean}", "description": "<div><h4>is_function(v) → {boolean}</h4><div class=\"description\">\n checks whether a given value is a function\n</div></div>", "meta": "func" }, "is_list": { "title": "is_list(xs) → {xs}", "description": "<div><h4>is_list(xs) → {xs}</h4><div class=\"description\">\n **primitive**; returns <code>true</code> if\n<code>xs</code> is a list as defined in the textbook, and\n<code>false</code> otherwise. Iterative process;\ntime: <code>Theta(n)</code>, space: <code>Theta(1)</code>, where <code>n</code>\nis the length of the\nchain of <code>tail</code> operations that can be applied to <code>xs</code>.\n<code>is_list</code> recurses down the list and checks that it ends with the empty list null\n</div></div>", "meta": "func" }, "is_null": { "title": "is_null(x) → {boolean}", "description": "<div><h4>is_null(x) → {boolean}</h4><div class=\"description\">\n **primitive**; returns <code>true</code> if <code>x</code> is the\nempty list <code>null</code>, and <code>false</code> otherwise; time: <code>Theta(1)Theta(1)</code>.\n</div></div>", "meta": "func" }, "is_number": { "title": "is_number(v) → {boolean}", "description": "<div><h4>is_number(v) → {boolean}</h4><div class=\"description\">\n checks whether a given value is a number.\nSee also <a href=\"https://sourceacademy.org/sicpjs/2.3.2\">textbook example</a>.\n</div></div>", "meta": "func" }, "is_pair": { "title": "is_pair(x) → {boolean}", "description": "<div><h4>is_pair(x) → {boolean}</h4><div class=\"description\">\n **primitive**; returns <code>true</code> if <code>x</code> is a\npair and false otherwise; time: <code>Theta(1)Theta(1)</code>.\n</div></div>", "meta": "func" }, "is_string": { "title": "is_string(v) → {boolean}", "description": "<div><h4>is_string(v) → {boolean}</h4><div class=\"description\">\n checks whether a given value is a string.\nSee also <a href=\"https://sourceacademy.org/sicpjs/2.3.2\">textbook example</a>.\n</div></div>", "meta": "func" }, "is_undefined": { "title": "is_undefined(v) → {boolean}", "description": "<div><h4>is_undefined(v) → {boolean}</h4><div class=\"description\">\n checks whether a given value is the special value <code>undefined</code>\n</div></div>", "meta": "func" }, "length": { "title": "length(xs) → {number}", "description": "<div><h4>length(xs) → {number}</h4><div class=\"description\">\n Returns the length of the list\n<code>xs</code>.\nIterative process; time: <code>Theta(n)</code>, space:\n<code>Theta(1)</code>, where <code>n</code> is the length of <code>xs</code>.\n</div></div>", "meta": "func" }, "list": { "title": "list() → {list}", "description": "<div><h4>list() → {list}</h4><div class=\"description\">\n **primitive**; given <code>n</code> values, returns a list of length <code>n</code>.\nThe elements of the list are the given values in the given order; time: <code>Theta(n)Theta(n)</code>.\n</div></div>", "meta": "func" }, "list_ref": { "title": "list_ref(xs, n) → {value}", "description": "<div><h4>list_ref(xs, n) → {value}</h4><div class=\"description\">\n Returns the element\nof list <code>xs</code> at position <code>n</code>,\nwhere the first element has index 0.\nIterative process;\ntime: <code>Theta(n)</code>, space: <code>Theta(1)</code>,\nwhere <code>n</code> is the length of <code>xs</code>.\n</div></div>", "meta": "func" }, "list_to_string": { "title": "list_to_string(xs) → {string}", "description": "<div><h4>list_to_string(xs) → {string}</h4><div class=\"description\">\n Returns a string that represents\nlist <code>xs</code> using the text-based box-and-pointer notation\n<code>[...]</code>.\nIterative process; time: <code>Theta(n)</code> where <code>n</code> is the size of the list, space: <code>Theta(m)</code> where <code>m</code> is the length of the string.\nThe process is iterative, but consumes space <code>O(m)</code>\nbecause of the result string.\n</div></div>", "meta": "func" }, "map": { "title": "map(f, xs) → {list}", "description": "<div><h4>map(f, xs) → {list}</h4><div class=\"description\">\n Returns a list that results from list\n<code>xs</code> by element-wise application of unary function <code>f</code>.\nIterative process; time: <code>Theta(n)</code> (apart from <code>f</code>),\nspace: <code>Theta(n)</code> (apart from <code>f</code>), where <code>n</code> is the length of <code>xs</code>.\n<code>f</code> is applied element-by-element:\n<code>map(f, list(1, 2))</code> results in <code>list(f(1), f(2))</code>.\n</div></div>", "meta": "func" }, "math_abs": { "title": "math_abs(x) → {number}", "description": "<div><h4>math_abs(x) → {number}</h4><div class=\"description\">\n computes the absolute value of x; the result has the same magnitude as <code>x</code> but has positive sign.\n</div></div>", "meta": "func" }, "math_acos": { "title": "math_acos(x) → {number}", "description": "<div><h4>math_acos(x) → {number}</h4><div class=\"description\">\n computes the arc cosine of <code>x</code>.\nThe result is expressed in radians and ranges from +0 to +π.\n</div></div>", "meta": "func" }, "math_acosh": { "title": "math_acosh(x) → {number}", "description": "<div><h4>math_acosh(x) → {number}</h4><div class=\"description\">\n computes the inverse hyperbolic cosine of <code>x</code>.\n</div></div>", "meta": "func" }, "math_asin": { "title": "math_asin(x) → {number}", "description": "<div><h4>math_asin(x) → {number}</h4><div class=\"description\">\n computes the arc sine of <code>x</code>. The result is expressed in radians and ranges from -π / 2 to +π / 2.\n</div></div>", "meta": "func" }, "math_asinh": { "title": "math_asinh(x) → {number}", "description": "<div><h4>math_asinh(x) → {number}</h4><div class=\"description\">\n computes the inverse hyperbolic\nsine of <code>x</code>. The result is expressed in radians and ranges from -π / 2 to +π / 2.\n</div></div>", "meta": "func" }, "math_atan": { "title": "math_atan(x) → {number}", "description": "<div><h4>math_atan(x) → {number}</h4><div class=\"description\">\n computes the arc tangent of <code>x</code>. The result is expressed in radians and ranges from -π / 2 to +π / 2.\n</div></div>", "meta": "func" }, "math_atan2": { "title": "math_atan2(y, x) → {number}", "description": "<div><h4>math_atan2(y, x) → {number}</h4><div class=\"description\">\n computes the arc tangent of the quotient <code>y</code> / <code>x</code> of the arguments <code>y</code> and <code>x</code>, where the signs of <code>y</code> and <code>x</code> are used to determine the quadrant of the result. Note that it is intentional and traditional for the two-argument arc tangent function that the argument named <code>y</code> be first and the argument named <code>x</code> be second. The result is expressed in radians and ranges from -π to +π.\n</div></div>", "meta": "func" }, "math_atanh": { "title": "math_atanh(x) → {number}", "description": "<div><h4>math_atanh(x) → {number}</h4><div class=\"description\">\n computes the inverse hyperbolic tangent of <code>x</code>.\n</div></div>", "meta": "func" }, "math_cbrt": { "title": "math_cbrt(x) → {number}", "description": "<div><h4>math_cbrt(x) → {number}</h4><div class=\"description\">\n computes the cube root of <code>x</code>.\n</div></div>", "meta": "func" }, "math_ceil": { "title": "math_ceil(x) → {number}", "description": "<div><h4>math_ceil(x) → {number}</h4><div class=\"description\">\n computes the smallest (closest to -∞) Number value that is not less than <code>x</code> and is an integer. If <code>x</code> is already an integer, the result is <code>x</code>.\nThe value of math_ceil(x) is the same as the value of -math_floor(-x).\n</div></div>", "meta": "func" }, "math_clz32": { "title": "math_clz32(n) → {number}", "description": "<div><h4>math_clz32(n) → {number}</h4><div class=\"description\">\n When math_clz32 is called with one argument <code>x</code>, the following steps are taken:\n\nLet n be ToUint32(x).\nLet p be the number of leading zero bits in the 32-bit binary representation of n.\nReturn p.\n\n<p>NOTE:\n<br>If n is 0, p will be 32. If the most significant bit of the 32-bit binary encoding of n is 1,\np will be 0.\n</p></div></div>", "meta": "func" }, "math_cos": { "title": "math_cos(x) → {number}", "description": "<div><h4>math_cos(x) → {number}</h4><div class=\"description\">\n Computes the cosine of <code>x</code>.\nThe argument is expressed in radians.\n</div></div>", "meta": "func" }, "math_cosh": { "title": "math_cosh(x) → {number}", "description": "<div><h4>math_cosh(x) → {number}</h4><div class=\"description\">\n computes the hyperbolic cosine of <code>x</code>.\n<p>NOTE:\nThe value of cosh(x) is the same as (exp(x) + exp(-x)) / 2.\n</p></div></div>", "meta": "func" }, "math_exp": { "title": "math_exp(x) → {number}", "description": "<div><h4>math_exp(x) → {number}</h4><div class=\"description\">\n computes the exponential function of <code>x</code>\n(e raised to the power of <code>x</code>, where e is the base of the natural logarithms).\n</div></div>", "meta": "func" }, "math_expm1": { "title": "math_expm1(x) → {number}", "description": "<div><h4>math_expm1(x) → {number}</h4><div class=\"description\">\n computes subtracting 1 from the\nexponential function of <code>x</code> (e raised to the power of <code>x</code>, where e is the base of\nthe natural logarithms). The result is computed in a way that is accurate even\nwhen the value of <code>x</code> is close to 0.\n</div></div>", "meta": "func" }, "math_floor": { "title": "math_floor(x) → {number}", "description": "<div><h4>math_floor(x) → {number}</h4><div class=\"description\">\n computes the greatest (closest to +∞) Number value that is not greater than <code>x</code>\nand is an integer.\n<br>If <code>x</code> is already an integer, the result is <code>x</code>.\n\n<p>NOTE:\nThe value of math_floor(x) is the same as the value of -math_ceil(-x).\n</p></div></div>", "meta": "func" }, "math_fround": { "title": "math_fround(x) → {number}", "description": "<div><h4>math_fround(x) → {number}</h4><div class=\"description\">\n When math_fround is called with argument <code>x</code>, the following steps are taken:\n\n<ol><li>If <code>x</code> is NaN, return NaN.</li>\n<li>If <code>x</code> is one of +0, -0, +∞, -∞, return <code>x</code>.</li>\n<li>Let x32 be the result of converting <code>x</code> to a value in IEEE 754-2008 binary32 format using roundTiesToEven mode.</li>\n<li>Let x64 be the result of converting x32 to a value in IEEE 754-2008 binary64 format.</li>\n<li>Return the ECMAScript Number value corresponding to x64.</li></ol>\n</div></div>", "meta": "func" }, "math_hypot": { "title": "math_hypot() → {number}", "description": "<div><h4>math_hypot() → {number}</h4><div class=\"description\">\n computes the square root\nof the sum of squares of its arguments.\n\n<br>If no arguments are passed, the result is +0.\n</div></div>", "meta": "func" }, "math_imul": { "title": "math_imul(x, x) → {number}", "description": "<div><h4>math_imul(x, x) → {number}</h4><div class=\"description\">\n When math_imul is called with arguments <code>x</code> and <code>y</code>,\nthe following steps are taken:\n<ol>\n<li>Let a be ToUint32(x).</li>\n<li>Let b be ToUint32(y).</li>\n<li>Let product be (a × b) modulo 2<sup>32</sup>.</li>\n<li>If product ≥ 2<sup>31</sup>, return product - 2<sup>32</sup>; otherwise return product.</li></ol>\n</div></div>", "meta": "func" }, "math_log": { "title": "math_log(x) → {number}", "description": "<div><h4>math_log(x) → {number}</h4><div class=\"description\">\n Computes the natural logarithm of <code>x</code>.\n</div></div>", "meta": "func" }, "math_log1p": { "title": "math_log1p(x) → {number}", "description": "<div><h4>math_log1p(x) → {number}</h4><div class=\"description\">\n computes the natural logarithm of 1 + <code>x</code>. The result is computed in a way that is accurate even when the value of <code>x</code> is close to zero.\n</div></div>", "meta": "func" }, "math_log2": { "title": "math_log2(x) → {number}", "description": "<div><h4>math_log2(x) → {number}</h4><div class=\"description\">\n computes the base 2 logarithm of <code>x</code>.\n</div></div>", "meta": "func" }, "math_log10": { "title": "math_log10(x) → {number}", "description": "<div><h4>math_log10(x) → {number}</h4><div class=\"description\">\n computes the base 10 logarithm of <code>x</code>.\n</div></div>", "meta": "func" }, "math_max": { "title": "math_max() → {number}", "description": "<div><h4>math_max() → {number}</h4><div class=\"description\">\n Given zero or more numbers, returns the largest of them.\n\n<br>If no arguments are given, the result is -∞.\n<br>If any value is NaN, the result is NaN.\nThe comparison of values to determine the largest value is done using the\nAbstract Relational Comparison algorithm except that +0 is considered to be larger than -0.\n</div></div>", "meta": "func" }, "math_min": { "title": "math_min() → {number}", "description": "<div><h4>math_min() → {number}</h4><div class=\"description\">\n Given zero or more arguments, returns the smallest of them.\n\n<br>If no arguments are given, the result is +∞.\n<br>If any value is NaN, the result is NaN.\nThe comparison of values to determine the smallest value is done using the\nAbstract Relational Comparison algorithm except that +0 is considered to be larger than -0.\n</div></div>", "meta": "func" }, "math_pow": { "title": "math_pow(base, exponent) → {number}", "description": "<div><h4>math_pow(base, exponent) → {number}</h4><div class=\"description\">\n Computes the result of raising base to\nthe power of exponent.\n</div></div>", "meta": "func" }, "math_random": { "title": "math_random() → {number}", "description": "<div><h4>math_random() → {number}</h4><div class=\"description\">\n Returns a number value with positive sign, greater than or equal to 0 but less than 1,\nchosen randomly or pseudo randomly with approximately uniform distribution over that\nrange, using an implementation-dependent algorithm or strategy. This function takes no arguments.\n\nEach math_random function created for distinct realms must produce a distinct sequence\nof values from successive calls.\n</div></div>", "meta": "func" }, "math_round": { "title": "math_round(x) → {number}", "description": "<div><h4>math_round(x) → {number}</h4><div class=\"description\">\n Returns the number value that is closest to <code>x</code> and is an integer.\n<br>If two integers are equally close to <code>x</code>, then the result is the Number value\nthat is closer to +∞. If <code>x</code> is already an integer, the result is <code>x</code>.\n\nNOTE 1:\nmath_round(3.5) returns 4, but math_round(-3.5) returns -3.\n</div></div>", "meta": "func" }, "math_sign": { "title": "math_sign(x) → {number}", "description": "<div><h4>math_sign(x) → {number}</h4><div class=\"description\">\n Computes the sign of <code>x</code>, indicating whether <code>x</code> is positive, negative, or zero.\n</div></div>", "meta": "func" }, "math_sin": { "title": "math_sin(x) → {number}", "description": "<div><h4>math_sin(x) → {number}</h4><div class=\"description\">\n Computes the sine of <code>x</code>.\nThe argument is expressed in radians.\n</div></div>", "meta": "func" }, "math_sinh": { "title": "math_sinh(x) → {number}", "description": "<div><h4>math_sinh(x) → {number}</h4><div class=\"description\">\n Computes the hyperbolic sine of <code>x</code>.\n<p>NOTE:\nThe value of sinh(x) is the same as (exp(x) - exp(-x)) / 2.\n</p></div></div>", "meta": "func" }, "math_sqrt": { "title": "math_sqrt(x) → {number}", "description": "<div><h4>math_sqrt(x) → {number}</h4><div class=\"description\">\n Computes the square root of <code>x</code>.\n</div></div>", "meta": "func" }, "math_tan": { "title": "math_tan(x) → {number}", "description": "<div><h4>math_tan(x) → {number}</h4><div class=\"description\">\n Computes the tangent of <code>x</code>. The argument is expressed in radians.\n</div></div>", "meta": "func" }, "math_tanh": { "title": "math_tanh(x) → {number}", "description": "<div><h4>math_tanh(x) → {number}</h4><div class=\"description\">\n Computes the hyperbolic tangent of <code>x</code>.\n\n<p>NOTE:\nThe value of <code>math_tanh(x)</code> is the same as\n<code>(exp(x) - exp(-x))/(exp(x) + exp(-x))</code>.\n</p></div></div>", "meta": "func" }, "math_trunc": { "title": "math_trunc(x) → {number}", "description": "<div><h4>math_trunc(x) → {number}</h4><div class=\"description\">\n Computes the integral part of the number <code>x</code>,\nremoving any fractional digits.\n</div></div>", "meta": "func" }, "member": { "title": "member(v, xs) → {list}", "description": "<div><h4>member(v, xs) → {list}</h4><div class=\"description\">\n Returns first postfix sublist\nwhose head is identical to\n<code>v</code> (using <code>===</code>); returns <code>null</code> if the\nelement does not occur in the list.\nIterative process; time: <code>Theta(n)</code>,\nspace: <code>Theta(1)</code>, where <code>n</code> is the length of <code>xs</code>.\n</div></div>", "meta": "func" }, "pair": { "title": "pair(x, y) → {pair}", "description": "<div><h4>pair(x, y) → {pair}</h4><div class=\"description\">\n **primitive**; makes a pair whose head (first component) is <code>x</code>\nand whose tail (second component) is <code>y</code>; time: <code>Theta(1)Theta(1)</code>.\n</div></div>", "meta": "func" }, "parse_int": { "title": "parse_int(s, i) → {number}", "description": "<div><h4>parse_int(s, i) → {number}</h4><div class=\"description\">\n Interprets a given string <code>s</code> as an integer,\nusing the positive integer <code>i</code> as radix,\nand returns the respective value.\n<br>Examples: <code>parse_int(\"909\", 10)</code> returns the number\n<code>909</code>, and <code>parse_int(\"-1111\", 2)</code> returns the number\n<code>-15</code>.<br>\nSee <a href=\"https://www.ecma-international.org/ecma-262/9.0/index.html#sec-parseint-string-radix\">ECMAScript Specification, Section 18.2.5</a> for details.\n</div></div>", "meta": "func" }, "prompt": { "title": "prompt(s) → {string}", "description": "<div><h4>prompt(s) → {string}</h4><div class=\"description\">\n Pops up a window that displays the string <code>s</code>, provides\nan input line for the user to enter a text, a <code>Cancel</code> button and an <code>OK</code> button.\nThe call of <code>prompt</code>\nsuspends execution of the program until one of the two buttons is pressed. If\nthe <code>OK</code> button is pressed, <code>prompt</code> returns the entered text as a string.\nIf the <code>Cancel</code> button is pressed, <code>prompt</code> returns a non-string value.\n</div></div>", "meta": "func" }, "remove": { "title": "remove(v, xs) → {list}", "description": "<div><h4>remove(v, xs) → {list}</h4><div class=\"description\">\n Returns a list that results from\n<code>xs</code> by removing the first item from <code>xs</code> that\nis identical (<code>===</code>) to <code>v</code>.\nReturns the original\nlist if there is no occurrence. Iterative process;\ntime: <code>Theta(n)</code>, space: <code>Theta(n)</code>, where <code>n</code>\nis the length of <code>xs</code>.\n</div></div>", "meta": "func" }, "remove_all": { "title": "remove_all(v, xs) → {list}", "description": "<div><h4>remove_all(v, xs) → {list}</h4><div class=\"description\">\n Returns a list that results from\n<code>xs</code> by removing all items from <code>xs</code> that\nare identical (<code>===</code>) to <code>v</code>.\nReturns the original\nlist if there is no occurrence.\nIterative process;\ntime: <code>Theta(n)</code>, space: <code>Theta(n)</code>, where <code>n</code>\nis the length of <code>xs</code>.\n</div></div>", "meta": "func" }, "reverse": { "title": "reverse(xs) → {list}", "description": "<div><h4>reverse(xs) → {list}</h4><div class=\"description\">\n Returns list <code>xs</code> in reverse\norder. Iterative process; time: <code>Theta(n)</code>,\nspace: <code>Theta(n)</code>, where <code>n</code> is the length of <code>xs</code>.\nThe process is iterative, but consumes space <code>Theta(n)</code>\nbecause of the result list.\n</div></div>", "meta": "func" }, "stringify": { "title": "stringify(v) → {string}", "description": "<div><h4>stringify(v) → {string}</h4><div class=\"description\">\n returns a string that represents the value <code>v</code>, using a\nnotation that is is consistent with\n<a href=\"http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-404.pdf\">JSON</a>,\nbut also displays <code>undefined</code>, <code>NaN</code>, <code>Infinity</code>, and function objects.\nSee also <a href=\"https://sourceacademy.org/sicpjs/3.3.5\">textbook example</a>.\n</div></div>", "meta": "func" }, "tail": { "title": "tail(p) → {value}", "description": "<div><h4>tail(p) → {value}</h4><div class=\"description\">\n **primitive**; returns tail (second component of given pair <code>p</code>; time: <code>Theta(1)Theta(1)</code>.\n</div></div>", "meta": "func" } }