Skip to content

Commit

Permalink
12: correct rlwrap
Browse files Browse the repository at this point in the history
  • Loading branch information
razetime committed Jun 6, 2024
1 parent 679d721 commit 9ae81f5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion 12-thinking-in-k.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*You can view the full source code for this chapter at [GitHub](code/matmul.k).*

Since you are now properly acquainted with K, let's do some programming.
Most K programming happens through the REPL, because it is very useful to iterate upon previous code. ngn/k with rlwrap has history with the up/down arrow keys, and that should be more than enough to begin developing bigger programs in K. Functions are tested in the REPL, and then moved to actual code. Note that ngn/k's prettyprinting always returns valid k data, and you can precompute some things beforehand to speed up your program.
Most K programming happens through the REPL, because it is very useful to iterate upon previous code. ngn/k with rlfe has history with the up/down arrow keys, and that should be more than enough to begin developing bigger programs in K. Functions are tested in the REPL, and then moved to actual code. Note that ngn/k's prettyprinting always returns valid k data, and you can precompute some things beforehand to speed up your program.

A K script is always executed like it was typed in the repl, that is: Each line is executed, and its return value is printed *unless* it ends with a semicolon. A script also allows multiline definitions, which are convenient for readability. Oftentimes, you may save your work in a script, and want to use it in a repl. In order to use your stored data and functions, just do `\l file.k` in the repl, and your file will be executed, and its data will be loaded. You can load a file into the REPL more than once, overwriting older data. The repl help accessed with `\` lists more useful commands as well.

Expand Down

0 comments on commit 9ae81f5

Please sign in to comment.