Post Reply 
The Joy of Programming?
09-02-2020, 07:48 PM (This post was last modified: 09-11-2020 07:45 PM by Jonathan Busby.)
Post: #8
RE: The Joy of Programming?
(08-28-2020 12:12 AM)John Keith Wrote:  I ran across this via a search on RosettaCode. It may look familiar to HP-48 and HP-71 folks...


Joy has been around for quite some time Smile

The reason Joy looks and operates a lot like RPL is because both Joy and RPL ( at least System-RPL ) are *concatenative* programming languages, and also dynamically typed and inspired by Forth and stack-based. A concatenative programming language is a functional programming language that, instead of using the semantics from the typed λ-calculus, which most other functional programming languages do ( eg. Lisp, Haskell etc. ), uses *function composition* with *no formal parameters* ( eg. lambdas -- meaning that it's a "point free" language like RPL or Forth ) which is syntactically represented in Joy by juxtaposing ( ie. "concatenating" ) two functions ( and in RPL it's the same in most cases as ":: :: a b c ; :: d e f ; ;" is the same as ":: a b c d e f ;" ** although RPL is not a *pure* functional language and contains many imperative constructs and *side-effects* ). In Joy, everything is a function which takes the stack as an argument and returns the stack as the result. In Joy, the "meaning function" ( ie. EVAL ) represents a homomorphism between the *syntactic monoid* and the *semantic monoid* ( Here, "monoid" means a semigroup with an ( left and right ) identity element ( which is just the identity function ) and a left-associative binary operation which is function composition for the semantic monoid. For the syntactic monoid, the binary operation is function concatenation and the identity element can be eg. "[] concat" or "[a b c] i" ( which is the same as "a b c" ) ). For non-mathematicians, the "homomorphism" can be thought of as a correspondence between the syntax of Joy and its semantics, which preserves all the underlying structure. It's not an *isomorphism* ( ie. exact one-to-one correspondence ) because the syntax allows for expressions that map to the same semantic element(s), such as the identity element which can be something like "dup drop", "dup swap drop" "0 +" etc. There are other concatenative languages that have been inspired by Joy ( Notably Factor, which is well-maintained the last time I checked ), and furthermore, concatenative languages can be constructed in such a way so that *no garbage values in the heap are ever generated*, which obviates the need for a garbage collector.

( N.B. : ** The marked statement is only generally true if the RPL secondaries in question conform to a subset of RPL that is "mostly functional" ie. ERRSET ... ERRTRAP environments, DO ... LOOP environments, local variables, certain RPL words such as COLA etc. break the concatenative property )

I hope this clears things up... Smile



Aeternitas modo est. Longa non est, paene nil.
Find all posts by this user
Quote this message in a reply
Post Reply 

Messages In This Thread
The Joy of Programming? - John Keith - 08-28-2020, 12:12 AM
RE: The Joy of Programming? - rprosperi - 08-28-2020, 05:34 PM
RE: The Joy of Programming? - Sylvain Cote - 08-28-2020, 06:05 PM
RE: The Joy of Programming? - John Keith - 08-29-2020, 12:23 PM
RE: The Joy of Programming? - ijabbott - 08-29-2020, 05:30 PM
RE: The Joy of Programming? - toml_12953 - 08-29-2020, 07:43 PM
RE: The Joy of Programming? - Jonathan Busby - 09-02-2020 07:48 PM

User(s) browsing this thread: 1 Guest(s)