Skip to content
Atlas, your robot learning host

Interim portrait

Atlas · Foundations functions

Hello, little human. I am Atlas. One useful idea is plenty for a beginning. Read the explanation, then explore an example.

Choose your robot No recording yet · text complete
concept for everyone

Functions

A function is a callable unit of behavior: its definition describes the rule, while an invocation supplies arguments and runs that rule to produce the stated outcome.

Tune in, human.

Reviewed videos and Shorts

Captions requested · no autoplay

Finding reviewed videos…

    Keep the useful bits, human.

    Beginner field notes

    Choose explanation level
    • A definition records what a function should do. Calling it asks that behavior to run; just writing the name is not the same action.
    • Arguments are values supplied to a call. For the lesson’s make-label rule, Seeds and 3 are the inputs to one invocation.
    • Use the stated rule to work out the result: make-label with Seeds and 3 returns Seeds: 3. A different function’s name alone does not tell you its rule.
    See a worked example

    Follow a definition and three separate calls

    Sample only. Nothing here runs on your computer.

    Example input · do not paste
    Offline Lantern Archive definition:
    Name: make-label.
    Inputs: kind must be nonempty text; quantity must be a positive whole number.
    Normal result: text made from kind, a colon and space, and quantity.
    First check kind; if it is empty or not text, report Invalid kind and return no normal label. Otherwise check quantity; if it is not valid, report Invalid quantity and return no normal label.
    This rule performs no storage read or write.
    A. The definition is recorded; no call is made.
    B. Invoke make-label with kind Seeds and quantity 3.
    C. Invoke the same make-label with kind Tools and quantity 2.
    D. Invoke the same make-label with kind Seeds and quantity -1.
    Assume these are the complete rules and each stated call finishes; no other work occurs.
    Example output · do not paste
    A. The definition exists. Invocation count: 0; no label has been produced.
    B. Arguments: Seeds and 3. Normal result: Seeds: 3.
    C. Arguments: Tools and 2. Normal result: Tools: 2.
    D. The negative quantity violates the rule. Outcome: Invalid quantity; no normal label result.
    The definition did not change across B, C and D. No saved Archive label was changed.

    First identify whether a call occurred. If it did, apply the definition to that call’s arguments and distinguish the normal result from the specified error outcome. The A/B/C/D notation is an inert trace, not executed code or a declaration that these words work as commands.

    Visual

    A stored make-label definition supplies the rule for an explicit call with two arguments. Valid inputs produce a formatted label; invalid inputs produce the stated error outcome instead.

    The reviewed description and complete diagram source are available here.

    Read the complete diagram source

    This is the source for the reviewed diagram, not a command to run.

    flowchart LR
      D["Definition: make-label rule"] -. "Used when called" .-> C["Explicit invocation with kind and quantity arguments"]
      C --> V{"Inputs meet this rule?"}
      V -->|"Yes"| R["Return formatted label"]
      V -->|"No"| E["Report invalid input; no normal label result"]
    Sources and full explanation

    Notes sources · Beginner

    AI source review · 2026-10-17

    Reviewed explanation

    A function is a unit of behavior that another part of a program can call. A definition describes its rule; a call, or invocation, asks it to run. In our fictional Lantern Archive, the named function make-label knows how to format an item name and quantity. Merely writing its name or describing its rule is not the same as invoking it.

    An argument is a value supplied to a particular call. Our rule accepts two arguments: kind, such as Seeds, and quantity, such as 3. The words kind and quantity label the inputs expected by this rule. You can follow those labels without learning variables, a programming language or terminal commands. Real languages have their own ways to define functions and pass arguments; the paper trace below is not any language’s source-code syntax.

    The definition says exactly what counts as valid input and what normal result to return. For a nonempty kind and a positive whole-number quantity, make-label returns text in the form kind: quantity. Calling it with Seeds and 3 therefore returns Seeds: 3. That answer follows from the stated rule and supplied arguments, not from a special meaning built into the name make-label.

    A call can also fail to produce its normal result. Our definition rejects a negative quantity with the explicit error Invalid quantity, rather than returning a valid label. Other functions may return no useful value, report errors differently, or perform work such as reading or changing stored information. This example deliberately only formats text; it does not establish that every function is pure, always succeeds or has a return value.

    Keep the reusable definition separate from each invocation. The definition remains the same when two calls use different inputs. A function can run inside an ordinary application; it does not become an AWS service just because it is called a function. AWS Lambda adds a particular way to host and invoke code, which is a separate topic. Here we are learning definition, invocation, argument and result, not writing or deploying code.

    AI source comparison recorded 2026-10-17. Human learner validation is pending.

    Quick quiz · one question

    Separate a definition from its calls

    Sample scenario. Synthetic offline Lantern Archive fixture. Same fixed language-neutral make-label rule; kind checked first. Each stated call finishes; no storage effects.

    Recorded fixed definition
    make-label: kind must be nonempty text; spaces are preserved. Then quantity must be a positive whole number. Return kind + colon-space + quantity, otherwise Invalid kind/Invalid quantity. No storage effect. A definition alone is zero calls.
    Call b
    kind="Seeds", quantity=3. These are data, not executable source.
    Call c
    kind="Tools", quantity=2. These are data, not executable source.
    Call d
    kind="Seeds", quantity=-1. These are data, not executable source.

    The make-label definition is recorded. Follow the three listed calls. What normal results or errors follow, and did recording the definition already invoke it?

    Answers stay on this device.

    Sources and exercise scope
    • MDN Glossary: Function

      Supports a callable unit, arguments supplied as input, a definition/name and an optional return value. The source includes JavaScript-specific material; this lesson uses only the narrow conceptual distinction and claims no cross-language syntax, purity or execution model.

    Original synthetic exercise. AI comparison against the reviewed lesson recorded on 2026-10-17; the references above state their scope. Human learner validation has not been run. A result here records this attempt; it does not establish mastery.

    Save or adjust this lesson
    Reference notes · file removal and public access

    Robot reference desk

    Understand what can change

    These reviewed public notes are available to everyone. They do not establish that an operation ran or inspect your files, backups or permissions.

    File removal

    Before deleting files: deleting a file can remove it without putting it in Trash or a recycle bin, and recovery is not guaranteed. Check the intended targets and whether a usable backup or recovery option exists before continuing.

    Sources for this note

    Public access

    Before making a resource public: public read access can let anyone view the exposed content, and public write access can allow changes to data. Check the actual audience, exposed content and allowed operations before continuing. This guidance does not inspect or change your permissions.

    Sources for this note

    A link can carry these public reference topics in its fragment. Page scripts, extensions, browser history and copied links can read them. This page attempts to minimize that fragment when JavaScript runs; reloading afterward can lose the selection. No project details or conversation text belong in a lesson link. Privacy details.