# Fungrim entry: 43cc72

Symbol: For $\ldots$ General-purpose generator
For(x) declares the given symbol as locally bound variable in the scope of the parent call. For example, f(a, For(x), b) declares $x$ as a locally bound variable that may be used within the expressions $a$ and $b$. The interpretation of the variable is left to the parent operator $f$.
Called with a tuple of symbols, For(Tuple(x, y, z)), each symbol becomes a locally bound variable.
Called with several arguments, for example For(x, a, b, c), the additional parameters $a$ $b$ $c$ specify information about the range of $x$. The interpretation of the parameters is up to the parent operator $f$. Most operators recognize For() with two additional parameters as specifying an iteration range: for example, Sum(Factorial(n), For(n, 2, 10)) gives $\sum_{n=2}^{10} n !$. (When For(n, a, b) is used in this sense, the endpoints $a$ and $b$ must be integers or possibly $a = -\infty$ and/or $b = \infty$ where an infinite sequence makes sense. The iteration sequence is empty if $b < a$.)
There are various exceptions. For example, Integral understands two parameters as representing the endpoints (not necessarily integers) of a directed line segment to integrate over: Integral(Cos(x), For(x, Neg(Pi), Pi)) becomes $\int_{-\pi}^{\pi} \cos(x) \, dx$. Derivative takes one or two parameters denoting the evaluation point and optionally the order of differentiation: Derivative(Sin(x), For(x, y)) becomes $\sin'(y)$ and Derivative(Sin(x), For(x, y, 2)) becomes $\sin''(y)$.
Definitions:
Fungrim symbol Notation Short description
Sum$\sum_{n} f(n)$ Sum
Factorial$n !$ Factorial
Infinity$\infty$ Positive infinity
Integral$\int_{a}^{b} f(x) \, dx$ Integral
Cos$\cos(z)$ Cosine
Pi$\pi$ The constant pi (3.14...)
Derivative$\frac{d}{d z}\, f\!\left(z\right)$ Derivative
Sin$\sin(z)$ Sine
Source code for this entry:
Entry(ID("43cc72"),
SymbolDefinition(For, Ellipsis, "General-purpose generator"),
Description(SourceForm(For(x)), "declares the given symbol as locally bound variable in the
scope of the parent call. For example,", SourceForm(f(a, For(x), b)), "declares", x, "as a locally bound variable that may be used within the expressions ", a, "and", b, ". The interpretation of the variable is left to the
parent operator", f, "."),
Description("Called with a tuple of symbols,", SourceForm(For(Tuple(x, y, z))), ", each symbol
becomes a locally bound variable."),
Description("
Called with several arguments, for example ", SourceForm(For(x, a, b, c)), ", the additional parameters", a, b, c, "specify information about the range of", x, ".", "The interpretation of the parameters is up to the parent operator", f, ". Most operators recognize ", SourceForm(For()), "with two additional parameters as
specifying an iteration range: for example, ", SourceForm(Sum(Factorial(n), For(n, 2, 10))), "gives", Sum(Factorial(n), For(n, 2, 10)), ".", "(When", SourceForm(For(n, a, b)), " is used in this sense, the endpoints", a, "and", b, "must be integers or possibly", Equal(a, Neg(Infinity)), "and/or", Equal(b, Infinity), "where an infinite sequence makes sense. ", "The iteration sequence is empty if", Less(b, a), ".)"),
Description("
There are various exceptions. For example,", SourceForm(Integral), "understands two
parameters as representing the endpoints (not necessarily integers)
of a directed line segment to integrate over: ", SourceForm(Integral(Cos(x), For(x, Neg(Pi), Pi))), "becomes", Integral(Cos(x), For(x, Neg(Pi), Pi)), ". ", SourceForm(Derivative), "takes one or two parameters", "denoting the evaluation point and optionally the order of differentiation:", SourceForm(Derivative(Sin(x), For(x, y))), "becomes", Derivative(Sin(x), For(x, y)), "and", SourceForm(Derivative(Sin(x), For(x, y, 2))), "becomes", Derivative(Sin(x), For(x, y, 2)), "."))

## Topics using this entry

Copyright (C) Fredrik Johansson and contributors. Fungrim is provided under the MIT license. The source code is on GitHub.

2021-03-15 19:12:00.328586 UTC
{"ft_lang_label":"__label__en","ft_lang_prob":0.73082256,"math_prob":0.9989403,"size":3560,"snap":"2021-43-2021-49","text_gpt3_token_len":882,"char_repetition_ratio":0.12570304,"word_repetition_ratio":0.25506073,"special_character_ratio":0.26853934,"punctuation_ratio":0.2417127,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.9997898,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2021-10-25T14:11:44Z\",\"WARC-Record-ID\":\"<urn:uuid:007afc45-e229-4629-9c1b-fa9b1be0c189>\",\"Content-Length\":\"30457\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:a9a33c5b-4d1c-4726-bf25-f210fa6cc77f>\",\"WARC-Concurrent-To\":\"<urn:uuid:8436d369-4156-41a1-bc44-eba4626e3cfe>\",\"WARC-IP-Address\":\"78.159.99.205\",\"WARC-Target-URI\":\"https://fungrim.org/entry/43cc72/\",\"WARC-Payload-Digest\":\"sha1:HHDBEHUE4KC3QL7R7KWOWO3DO62QRNNZ\",\"WARC-Block-Digest\":\"sha1:7N6YAYYGLMAKXZSRF3ZTGTEJNXIXBWQ2\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2021/CC-MAIN-2021-43/CC-MAIN-2021-43_segments_1634323587711.69_warc_CC-MAIN-20211025123123-20211025153123-00397.warc.gz\"}"}