this post was submitted on 30 May 2024
5 points (100.0% liked)

Concatenative Programming

144 readers
4 users here now

Hello!

This space is for sharing news, experiences, announcements, questions, showcases, etc. regarding concatenative programming concepts and tools.

We'll also take any programming described as:


From Wikipedia:

A concatenative programming language is a point-free computer programming language in which all expressions denote functions, and the juxtaposition of expressions denotes function composition. Concatenative programming replaces function application, which is common in other programming styles, with function composition as the default way to build subroutines.

For example, a sequence of operations in an applicative language like the following:

y = foo(x)
z = bar(y)
w = baz(z)

...is written in a concatenative language as a sequence of functions:

x foo bar baz


Active Languages

Let me know if I've got any of these misplaced!

Primarily Concatenative

Concatenative-ish, Chain-y, Pipe-y, Uniform Function Call Syntax, etc.


Cheat Sheets & Tutorials

Discord

IRC

Wikis

Wikipedia Topics

Subreddits

GitHub Topics

Blogs

Practice

founded 1 year ago
MODERATORS
5
0.1 + 0.2 | Roc (rtfeldman.com)
submitted 4 months ago* (last edited 4 months ago) by Andy@programming.dev to c/concatenative@programming.dev
 

Discussion on lobsters: https://lobste.rs/s/oxjvv0/0_1_0_2

It's not that Roc only supports base-10 arithmetic. It also supports the typical base-2 floating-point numbers, because in many situations the performance benefits are absolutely worth the cost of precision loss. What sets Roc apart is its choice of default; when you write decimal literals like 0.1 or 0.2 in Roc, by default they're represented by a 128-bit fixed-point base-10 number that never loses precision, making it reasonable to use for calculations involving money.

In Roc, floats are opt-in rather than opt-out.

you are viewing a single comment's thread
view the rest of the comments
[–] FizzyOrange@programming.dev 1 points 4 months ago

Sounds crazy but apparently it uses type inference to convert them to float anyway.

Even so... the fact that 0.3 doesn't mean 0.300000000 exactly seems a lot easier to deal with than the fact that real numbers can now easily overflow.