4 ms·
In my programming career 3 languages have changed how I look at programming. The first one was scheme which is still my go to language for most of my personal p
by Johnny_Brahms 10y ago
In my programming career 3 languages have changed how I look at programming. The first one was scheme which is still my go to language for most of my personal projects. The second one was prolog and the third was Forth/factor.
Whenever someone asks where to "widen their view" I generally recommend prolog or factor (15 years ago, I would have said scheme, but lisps seem to have been all the rage so I no longer need to).
- zem 10y agoi think ML has changed the way i look at programming more than anything else. pattern matching over algebraic datatypes is a very powerful way to think about modelling something as code even if your language doesn't support either feature. (to paraphrase ashley yakeley, "every sufficiently well-documented lisp program contains an ML program in its comments")
- beagle3 10y agoI have these three in my list, and one more: APL (or J or K -- especially K) Scheme/Lisp is about how data and code are equivalent in a practical sense. I'm not sure how I would describe Prolog in a single sentence - it's about using a powerful concept (Unification) as a base of computation - it makes a lot of logic programming simple (and unfortunately, it makes some simple iteration complicated). Forth is an exercise in minimalism and blurring (or actually removing) the line between compiling, interpreting, parsing. I wouldn't treat Forth and Factor equivalently - Factor borrows Forth's concatenativeness, but it is very far from Forth's minimalism. K is an exercise in choosing the minimal set of operators and functions that would produce very terse programs that need much less abstraction, without having to compromise on speed. Unlike Lisp and Forth, the base K has some 50-100 mostly orthogonal operators (depending on how you count) that work together to give you a lot without forcing you to abstract.
- bogomipz 10y agoCan you elaborate on what is special about Forth? I see Forth articles show up on HN now and again but I've been able to glean why its special to so many. I know its been around forever.
- tom_mellior 10y ago> Can you elaborate on what is special about Forth? Not the OP here, but I'll give it a partial shot. The power of Forth comes from its extremely simple syntax and the ways you can extend it. A Forth program is just a sequence of "words", which are any sequences of non-whitespace characters separated by whitespace. Users can define new words. These can be "parsing words" which can consume the input that follows them in arbitrary ways. So, for example, given appropriate definitions, this is a valid Forth program: ax bx mov \ mov ebx,eax 3 # ax mov \ mov eax,3 (this is taken directly from GForth's inline assembly docs: https://www.complang.tuwien.ac.at/forth/gforth/Docs-html/386-Assembler.html#g_t386-Assembler https://www.complang.tuwien.ac.at/forth/gforth/Docs-html/386... ; the \ introduces a comment to the end of the line and shows the assembly code as it would be written in a traditional assembler) Or, given appropriate definitions, this is a valid Forth program: select * from customers You see where this is going: Programmers have a lot of possibilities to extend the language or implement embedded DSLs (which is pretty much the same thing in Forth). A popular demo of this power are things along the line of http://c2.com/cgi/wiki?ForthObjects http://c2.com/cgi/wiki?ForthObjects, where an object system for Forth (which is not object oriented at all) is implemented in 20 lines of code. All that said, it's ugly and complex and I always find it difficult to figure out what's going on with all the strangely named concepts and compile-time effects and run-time effects of everything. But still. Interesting stuff.
- bogomipz 10y agoThank you, I certainly see the power in that. Thanks for the time to answer.