Hacker News new | past | comments | ask | show | jobs | submit login

Hm, yeah. Concatenative languages haven't had much attention, undeservingly. I'm going to keep an eye on Factor I think. I'm already plunging into functional programming these days though, there are so many languages to learn!



When I wrote this post about "Finding Joy in Combinators" it got a fair bit of link and upmod love:

http://github.com/raganwald/homoiconic/blob/master/2008-11-1...

I'd say there's some passion and curiosity about concatenative languages. (Summary for those too busy to read it: concatenative languages are direct implementations of combinatorial logic).


I LOVE concatenative languages. They intrigue me. That doesn't make it easier when you're not used to it, however..

Same here, keeping a close eye on it. Its a VERY powerful language - like a concatenative postfix modern Lisp.


I played around with Forth a while back, and while I thought it was a great experience and an interesting way of 'seeing the world', I think that keeping track of what's on the stack seemed like a route to madness. Even stuff like C doesn't make you do that.

How do things like Factor improve on Forth?


The Factor community likes to use the following phrase to answer that question and I think its quite correct: "Idiomatic Factor does not use the stack".

That is, well written idiomatic Factor makes use of higher level abstractions which hide the stack from you. The stack should not be used as a data structure, but rather as a scratchpad to allow pointfree programming. Factor provides a load of abstractions which can often handle all of that low level stack handling stuff for you, making the code easier to read, follow and understand (once you know the abstractions). Factor also provides local variables, for use when it makes sense to name your data. Its not shunned to use them over the stack - when it makes sense to. Finally, Factors macros allow you to modify how the code is parsed (Factor calls them "parsing words"), so you can actually change the syntax. Core Factor provides an "infix" parsing word which allows you to write infix expressions and it is advised to do so when it makes sense (eg, for mathematical formulas). Another example of parsing words put to great use is Jeremy Hughes' inline C/C++ library, which basically allows you to write C/C++ code inline in Factor source files. During compilation, Factor will compile this code with GCC and simplifies writing of FFI stubs for wrapping C/C++ libraries.

Basically, Factor is very different from Forth. Slava likes to say that "Factor has more in common with Lisp than it does with Forth" and its often said that Factor only has a syntactical resemblance to Forth, but is otherwise very different.


My quick take, from playing around with it a bit a few months ago: you can put much, much cooler stuff on the stack. Closures, for instance. (Or at least the Factor equivalent of closures.)




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: