read_input
read_input([prompt])
Input: prompt · Output: no output
What it is
Reads one line of interactive input, returned as a string with its trailing newline stripped. prompt (string, optional), if given, is printed first with no added newline. In a real terminal (qu run/qu repl) this reads real stdin directly; a host that isn't a terminal (e.g. a Jupyter kernel) can wire its own prompt/reply round-trip instead — see that host's own documentation for what "interactive" means there. Not called input (already the machine-learning pipeline's input-layer builtin) or read_line (already "read one line from an open file/URL-stream/serial handle") — both are unrelated existing meanings, not available for this.
Overloads
One call shape — this function is not overloaded.
| Code | Input | Output | Description |
read_input([prompt]) | prompt string, optionalnot documented yet | not documented yet | Reads one line of interactive input, returned as a string with its trailing newline stripped. In a real terminal (qu run/qu repl) this reads real stdin directly; a host that isn't a terminal (e.g. Not called input (already the machine-learning pipeline's input-layer builtin) or read_line (already "read one line from an open file/URL-stream/serial handle") — both are unrelated existing meanings, not available for this. |
Examples
No documentation example calls this form yet. The File I/O chapter is where one belongs.
How it works
read_input([prompt]) — reads one line of interactive input. Neither input (already the ML pipeline's input-layer builtin, input(dim), see its own arm above) nor read_line (already "read one line from an open file/URL-stream/serial handle", dispatched on arg0's type a few hundred lines below) were available — both are real collisions with an unrelated existing meaning, not just similar names, so this needed a name of its own rather than shadowing either. on_input is a host hook (mirrors on_print): a Jupyter kernel round-trips the prompt through its own stdin channel; with no host wired up (a plain qu run/qu repl in a real terminal), the default below reads real stdin directly, so this works out of the box with zero wiring for the common case.
From the note above this builtin in the interpreter, where the reasoning was written down as it was built.