Concatenative Programming

160 readers
3 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 2 years ago
MODERATORS
1
2
3
4
5
6
7
 
 

Copied from the release notes:

We're starting with a new release approach, these files will stay available permanently in contrast to the latest nightly.

We now recommend most users to stick to 0.0.0-alpha releases instead of nightly-latest.

This current release is based on commit a089cf2 from the 6th of January 2025. These files are identical to nightly-latest published on the 7th of January 2025.


EDIT: A whole lot more detail in the new 0.0.0-alpha2-rolling release

8
9
 
 

Discussion on lobsters

10
11
12
13
14
15
14
submitted 2 months ago* (last edited 2 months ago) by Andy@programming.dev to c/concatenative@programming.dev
 
 

Alright, show me I'm not the only one in this community, and show off some solutions!

Here's my Day 1 solution in Factor (minus imports):

spoiler

: get-input ( -- left-list right-list )
  "aoc-2024.01" "input.txt" vocab-file-lines
  [ split-words harvest ] map unzip
  [ [ string>number ] map ] bi@ ;

: part1 ( -- n )
  get-input
  [ sort ] bi@
  [ - abs ] 2map-sum ;

: part2 ( -- n )
  get-input
  histogram
  '[ dup _ at 0 or * ] map-sum ;

Sadly, Factor doesn't get highlighted properly here, so here it is again as an image:

spoiler

syntax-highlighted screenshot of the code above

I probably won't last the week, but what solutions I do have will be up on GitHub.

16
 
 

This example is my justification for posting it here:

"NeoHaskell is cool"
  |> Text.toWordList
  |> List.map Text.length
  |> List.map (\x -> x * x)
  |> List.takeIf Int.isEven
17
18
 
 

I posted this project here before, but it's now reached 1.0.0.

19
20
21
 
 

Hey, it includes Factor!

22
23
 
 
24
25
 
 

Animated preview

This is not my own project!

view more: next ›