Post Reply 
The Joy of Programming?
08-28-2020, 12:12 AM
Post: #1
The Joy of Programming?
I ran across this via a search on RosettaCode. It may look familiar to HP-48 and HP-71 folks...

Joy
Find all posts by this user
Quote this message in a reply
08-28-2020, 05:24 PM
Post: #2
RE: The Joy of Programming?
I give up. Why should Joy look familiar to 71 users?
Find all posts by this user
Quote this message in a reply
08-28-2020, 05:34 PM
Post: #3
RE: The Joy of Programming?
(08-28-2020 05:24 PM)Dave Frederickson Wrote:  I give up. Why should Joy look familiar to 71 users?

It's very Forth-like, and the 71 is most associated with Forth among HP models.

--Bob Prosperi
Find all posts by this user
Quote this message in a reply
08-28-2020, 06:05 PM
Post: #4
RE: The Joy of Programming?
(08-28-2020 05:34 PM)rprosperi Wrote:  
(08-28-2020 05:24 PM)Dave Frederickson Wrote:  I give up. Why should Joy look familiar to 71 users?

It's very Forth-like, and the 71 is most associated with Forth among HP models.
Yep!
I just looked at the source code (kernel in C, everything else seems to be in Joy), it is a stack based language with word definition like Forth.
More time would be needed on my part to do a basic and honest comparison between the two languages.
Find all posts by this user
Quote this message in a reply
08-29-2020, 12:23 PM
Post: #5
RE: The Joy of Programming?
The main difference is that Joy is a pure functional language, sort of "Reverse Polish Haskell". Big Grin
Find all posts by this user
Quote this message in a reply
08-29-2020, 05:30 PM
Post: #6
RE: The Joy of Programming?
I have thought Joy would make a good RPL alternative for a few years, but the language itself seems to have fallen by the wayside since its initial development.

— Ian Abbott
Find all posts by this user
Quote this message in a reply
08-29-2020, 07:43 PM
Post: #7
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

I tried to learn it but no joy.

Tom L
Cui bono?
Find all posts by this user
Quote this message in a reply
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

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

Regards,

Jonathan

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




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