diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml index cd906e3b2..c1eac8bc6 100644 --- a/.github/workflows/nodejs.yml +++ b/.github/workflows/nodejs.yml @@ -29,7 +29,9 @@ jobs: - name: Install dependencies (apt) run: | sudo apt-get update && \ - sudo apt-get install -y --no-install-recommends libxi-dev libgl1-mesa-dev + sudo apt-get install -y --no-install-recommends \ + libxi-dev libgl1-mesa-dev \ + texlive texlive-fonts-extra texlive-lang-cjk latexmk latex-cjk-all - name: Setup Node uses: actions/setup-node@v4 with: @@ -42,6 +44,8 @@ jobs: - run: yarn test-coverage env: CI: true + - name: Check that docs build + run: yarn jsdoc prepare - name: Coveralls uses: coverallsapp/github-action@master with: diff --git a/docs/lib/list.js b/docs/lib/list.js index 0e75873a4..68be4f23c 100644 --- a/docs/lib/list.js +++ b/docs/lib/list.js @@ -2,7 +2,7 @@ /** * **primitive**; makes a pair whose head (first component) is x - * and whose tail (second component) is y; time: Θ(1)Θ(1). + * and whose tail (second component) is y; time: Theta(1)Theta(1). * @param {value} x - given head * @param {value} y - given tail * @returns {pair} pair with x as head and y as tail. @@ -11,21 +11,21 @@ function pair(x, y) {} /** * **primitive**; returns true if x is a - * pair and false otherwise; time: Θ(1)Θ(1). + * pair and false otherwise; time: Theta(1)Theta(1). * @param {value} x - given value * @returns {boolean} whether x is a pair */ function is_pair(x) {} /** - * **primitive**; returns head (first component) of given pair p; time: Θ(1)Θ(1). + * **primitive**; returns head (first component) of given pair p; time: Theta(1)Theta(1). * @param {pair} p - given pair * @returns {value} head of p */ function head(p) {} /** - * **primitive**; returns tail (second component of given pair p; time: Θ(1)Θ(1). + * **primitive**; returns tail (second component of given pair p; time: Theta(1)Theta(1). * @param {pair} p - given pair * @returns {value} tail of p */ @@ -33,7 +33,7 @@ function tail(p) {} /** * **primitive**; returns true if x is the - * empty list null, and false otherwise; time: Θ(1)Θ(1). + * empty list null, and false otherwise; time: Theta(1)Theta(1). * @param {value} x - given value * @returns {boolean} whether x is null */ @@ -43,7 +43,7 @@ function is_null(x) {} * **primitive**; returns true if * xs is a list as defined in the textbook, and * false otherwise. Iterative process; - * time: Θ(n), space: Θ(1), where n + * time: Theta(n), space: Theta(1), where n * is the length of the * chain of tail operations that can be applied to xs. * is_list recurses down the list and checks that it ends with the empty list null @@ -54,7 +54,7 @@ function is_list(xs) {} /** * **primitive**; given n values, returns a list of length n. - * The elements of the list are the given values in the given order; time: Θ(n)Θ(n). + * The elements of the list are the given values in the given order; time: Theta(n)Theta(n). * @param {value} value1,value2,...,value_n - given values * @returns {list} list containing all values */ @@ -63,7 +63,7 @@ function list(value1, value2, ...values ) {} /** * visualizes the arguments in a separate drawing * area in the Source Academy using box-and-pointer diagrams; time, space: - * Θ(n), where n is the total number of data structures such as + * Theta(n), where n is the total number of data structures such as * pairs in the arguments. * @param {value} value1,value2,...,value_n - given values * @returns {value} given x @@ -82,7 +82,7 @@ function list(value1, value2, ...values ) {} * with === (using the definition of === in the * respective Source language in use). * Time, space: - * Θ(n), where n is the total number of data structures such as + * Theta(n), where n is the total number of data structures such as * pairs in x and y. * @param {value} x - given value * @param {value} y - given value @@ -110,8 +110,8 @@ function equal(xs, ys) { /** * Returns the length of the list * xs. - * Iterative process; time: Θ(n), space: - * Θ(1), where n is the length of xs. + * Iterative process; time: Theta(n), space: + * Theta(1), where n is the length of xs. * @param {list} xs - given list * @returns {number} length of xs */ @@ -125,8 +125,8 @@ function $length(xs, acc) { /** * Returns a list that results from list * xs by element-wise application of unary function f. - * Iterative process; time: Θ(n) (apart from f), - * space: Θ(n) (apart from f), where n is the length of xs. + * Iterative process; time: Theta(n) (apart from f), + * space: Theta(n) (apart from f), where n is the length of xs. * f is applied element-by-element: * map(f, list(1, 2)) results in list(f(1), f(2)). * @param {function} f - unary @@ -147,7 +147,7 @@ function $map(f, xs, acc) { * Makes a list with n * elements by applying the unary function f * to the numbers 0 to n - 1, assumed to be a nonnegative integer. - * Iterative process; time: Θ(n) (apart from f), space: Θ(n) (apart from f). + * Iterative process; time: Theta(n) (apart from f), space: Theta(n) (apart from f). * @param {function} f - unary function * @param {number} n - given nonnegative integer * @returns {list} resulting list @@ -162,7 +162,7 @@ function $build_list(i, fun, already_built) { /** * Applies unary function f to every * element of the list xs. - * Iterative process; time: Θ(n) (apart from f), space: Θ(1) (apart from f), + * Iterative process; time: Theta(n) (apart from f), space: Theta(1) (apart from f), * where n is the length of xs. * f is applied element-by-element: * for_each(fun, list(1, 2)) results in the calls @@ -186,7 +186,7 @@ function for_each(fun, xs) { * Returns a string that represents * list xs using the text-based box-and-pointer notation * [...]. - * Iterative process; time: Θ(n) where n is the size of the list, space: Θ(m) where m is the length of the string. + * Iterative process; time: Theta(n) where n is the size of the list, space: Theta(m) where m is the length of the string. * The process is iterative, but consumes space O(m) * because of the result string. * @param {list} xs - given list @@ -209,9 +209,9 @@ function $list_to_string(xs, cont) { /** * Returns list xs in reverse - * order. Iterative process; time: Θ(n), - * space: Θ(n), where n is the length of xs. - * The process is iterative, but consumes space Θ(n) + * order. Iterative process; time: Theta(n), + * space: Theta(n), where n is the length of xs. + * The process is iterative, but consumes space Theta(n) * because of the result list. * @param {list} xs - given list * @returns {list} xs in reverse @@ -228,8 +228,8 @@ function $reverse(original, reversed) { /** * Returns a list that results from * appending the list ys to the list xs. - * Iterative process; time: Θ(n), space: - * Θ(n), where n is the length of xs. + * Iterative process; time: Theta(n), space: + * Theta(n), where n is the length of xs. * In the result, null at the end of the first argument list * is replaced by the second argument, regardless what the second * argument consists of. @@ -251,8 +251,8 @@ function $append(xs, ys, cont) { * whose head is identical to * v (using ===); returns null if the * element does not occur in the list. - * Iterative process; time: Θ(n), - * space: Θ(1), where n is the length of xs. + * Iterative process; time: Theta(n), + * space: Theta(1), where n is the length of xs. * @param {value} v - given value * @param {list} xs - given list * @returns {list} postfix sublist that starts with v @@ -270,7 +270,7 @@ function member(v, xs) { * is identical (===) to v. * Returns the original * list if there is no occurrence. Iterative process; - * time: Θ(n), space: Θ(n), where n + * time: Theta(n), space: Theta(n), where n * is the length of xs. * @param {value} v - given value * @param {list} xs - given list @@ -294,7 +294,7 @@ function $remove(v, xs, acc) { * Returns the original * list if there is no occurrence. * Iterative process; - * time: Θ(n), space: Θ(n), where n + * time: Theta(n), space: Theta(n), where n * is the length of xs. * @param {value} v - given value * @param {list} xs - given list @@ -317,7 +317,7 @@ function $remove_all(v, xs, acc) { * pred * returns true. * Iterative process; - * time: Θ(n) (apart from pred), space: Θ(n) (apart from pred), + * time: Theta(n) (apart from pred), space: Theta(n) (apart from pred), * where n is the length of xs. * @param {function} pred - unary function returning boolean value * @param {list} xs - given list @@ -339,7 +339,7 @@ function $filter(pred, xs, acc) { * numbers starting from start using a step size of 1, until * the number exceeds (>) end. * Iterative process; - * time: Θ(n), space: Θ(n), + * time: Theta(n), space: Theta(n), * where n is end - start. * @param {number} start - starting number * @param {number} end - ending number @@ -359,7 +359,7 @@ function $enum_list(start, end, acc) { * of list xs at position n, * where the first element has index 0. * Iterative process; - * time: Θ(n), space: Θ(1), + * time: Theta(n), space: Theta(1), * where n is the length of xs. * @param {list} xs - given list * @param {number} n - given position @@ -384,7 +384,7 @@ function list_ref(xs, n) { * list. Thus, accumulate(f,zero,list(1,2,3)) results in * f(1, f(2, f(3, zero))). * Iterative process; - * time: Θ(n) (apart from f), space: Θ(n) (apart from f), + * time: Theta(n) (apart from f), space: Theta(n) (apart from f), * where n is the length of xs. * @param {function} f - binary function * @param {value} initial - initial value @@ -405,7 +405,7 @@ function $accumulate(f, initial, xs, cont) { * Optional second argument. * Similar to display, but formats well-formed lists nicely if detected; * time, space: - * Θ(n), where n is the total number of data structures such as + * Theta(n), where n is the total number of data structures such as * pairs in x. * @param {value} xs - list structure to be displayed * @param {string} s to be displayed, preceding xs diff --git a/docs/lib/stream.js b/docs/lib/stream.js index 82ef31629..c627f4318 100644 --- a/docs/lib/stream.js +++ b/docs/lib/stream.js @@ -184,7 +184,7 @@ function stream_for_each(fun, xs) { /** * Returns stream xs in reverse * order. Iterative process. - * The process is iterative, but consumes space Ω(n) + * The process is iterative, but consumes space Omega(n) * because of the result stream. * Lazy? No: stream_reverse * forces the exploration of the entire stream