Concatenative topics
Concatenative meta
Other languages
Meta
Listack is a symmetric, flat, concatenative, polymorphic, dynamically typed, interpreted programming language. Like most concatenative languages, it is stack based. Listack was inspired by the stack-based languages Factor, False, XY, and Forth. The manual scope system was inspired by Fish. The object type system was inspired by Euphoria. This document refers to words (the traditional concatenative language term) interchangeably with functions and procedures. Listack lies somewhere between functional and imperative languages, leaning more towards the functional side.
Listack is symmetric because it employs a uniform function call syntax, where almost every word (command) can be in a prefix (+: 1 2), infix (1 + 2), or postfix (1 2 .+) form. Prefix (word:) and infix (word) forms are translated at run time into postfix (.word) form. The infix form is always used after the first argument. There is also a more “normal looking” callable form: +(1, 2). This is translated to postfix by the parser when a program is loaded and is thus more efficient than the prefix and infix forms. Immediate words are always executed, well, immediately, and never relocated by the parser or the runtime interpreter. It is important to understand that all words are implemented and executed as either postfix or immediate.
Listack is flat because every function is inlined. There is no call stack of functions to return to. Looping is conducted purely by recursive inlining of functions. The only data flow primitives in the language are variants of if and <=>. All the “higher level” words are written in Listack, and can be examined in the system.ls file.
Listack is concatenative because data flow is through the stack. Functions are concatenated together simply by writing them one after another. They all take their data from and add it to the stack, much like the -nix pipe ‘|’ command. In functional languages, this is known as "composition". Currying and partial application are both trivial and natural in concatenative languages like Listack, Factor, and Joy.
Listack is polymorphic through multiple dispatch because every word (function) definition requires a list of argument types. Each word can be defined multiple times using different arguments. Listack does, however, restrict each word to using the same number of arguments for each variant (each word has a single arity). This can be avoided somewhat by using a collection type (List, Block, or Seq) as one or more arguments. Listack also allows a singular type “Otherwise” to handle error conditions where the expected data types are not found on the stack.
Listack entry on the Esolangs wiki: Listack
Listack Github repository Listack v0.4
This revision created on Tue, 2 Jan 2024 20:46:47 by goren (linked some languages mentioned with [[…]])