5 ms·
"In fact, you shouldn’t write any serious application in Forth; as a lan- guage it’s simply not powerful enough. What you should do is write your own language i
by OldGuyInTheClub 3y ago
"In fact, you shouldn’t write any serious application in Forth; as a lan-
guage it’s simply not powerful enough. What you should do is write your own
language in Forth (lexicons) to model your understanding of the problem, in
which you can elegantly describe its solution."
I've enjoyed reading about FORTH and LISP over the years and I think LISP advocates have a similar philosophy. What Leo Brodie states so nicely is very hard for me to actually do. I think that's what separates the people who "get" computing from those (like me) who glue bits of various libraries together to get past the problem of the moment.
As an HP calculator lover (I wore the ENTER > = t-shirt 40 years ago) I understand the stack and RPN but have no idea how I'd write a trig or stat function if it weren't already built in!
- bitwize 3y ago> I've enjoyed reading about FORTH and LISP over the years and I think LISP advocates have a similar philosophy. Want to make a hacker laugh? Say "Forth is the dual of Lisp" to someone familiar with both languages. It seems they reach the same goal of a totally programmable programming language through completely opposite approaches.
- packetlost 3y agoI've thought this same thing before. About the only thing they really agree on is minimal syntax and an implicit stack
- coldtea 3y agoAnd creating a DSL for your problem, and user functions being identical to build in functions, and being able to fully extend the language yourself, to the point of adding custom conditionals or whatever, and several other things.... Aside from the functional vs concatenative paradigms, they share a lot of development philosophy, and give a lot of the same superpowers to the developers.
- OldGuyInTheClub 3y agoWell, I hope I don't shanked by one or both sets of advocates. Years ago I made it partway through this early LISP manual co-authored by a young John McCarthy before his move to Stanford: http://www.softwarepreservation.org/projects/LISP/book/LISP%201.5%20Programmers%20Manual.pdf http://www.softwarepreservation.org/projects/LISP/book/LISP%... I remember thinking: 1) They did not mess around in the 1960s. No "Hello World," no promises, no sales pitch. Just an in-yer-face "Here's how we do things downtown" 2) They defined a language in terms of itself. I still don't get all that implies but, damn, they can do that?
- LAC-Tech 3y agoThe LISP 1.5 Programmers manual! Love this one. Your 2) is what Alan Kay called "Maxwell's Equations of Software". And you're right, there's absolute magic in old computing papers. They were pioneers. I wish we could see more of this pioneering spirit combined with todays silicon and ease of international communication.
- OldGuyInTheClub 3y agoI imagine my 2012 Macbook Pro feels like Marvin the Paranoid Android given the stonking gap between its capabilities and my actual use of it.
- rcbdev 3y ago> They defined a language in terms of itself. Reminds me of the plethora of compilers written in the languages they're meant to compile. (Roslyn, Java compiler, F# compiler, etc.)
- dreamcompiler 3y agoBut of course it's not the same thing. The spec for a language is harder to define than the compiler for it. The spec for Lisp is written in Lisp. And it's about half a page of Lisp code. And it's executable, which is not usually true with specs. This is why reading the Lisp spec feels like reading "the Maxwell's equations of software" (to quote Alan Kay). It's a whole other fundamental model of computation, every bit as fundamental as a Turing machine, but much more practical. Nobody builds serious computing engines out of pure Turing machines, but people do it all the time with McCarthy machines.
- flohofwoe 3y agoIn my mind, Forth is a "reverse Lisp". Not sure why that's funny though :) They're both the same basic idea, just that Forth is a much more radical low-level implementation of that idea (e.g. it was just perfect for minimal 8-bit home computers).
- ctrw 3y agoLisp is syntax which happens to be executed. Forth is execution that happens to have some syntax. If you want a dual of lisp you need to look at Joy or Factor.
- edanm 3y ago> As an HP calculator lover (I wore the ENTER > = t-shirt 40 years ago) I understand the stack and RPN but have no idea how I'd write a trig or stat function if it weren't already built in! From talking to several people who've implemented things like this, I think they would've said the same thing before. Nobody walks around knowing how to implement these kinds of things. If you need it, you just start trying, learning, reading, etc, until eventually you do it.
- abecedarius 3y agoAnecdote about people at different stages of that learning: I worked at FORTH, Inc. one summer in the 80s before starting college. They sold a Forth system which they were converting to a new language standard, which (among other things) had changed the canonical booleans from 1-for-true to -1. One day I noticed the trig functions were giving wrong answers. So I bring up the code with my boss, and it's pretty hard for us to figure out -- compact, no explanation, tables of random-looking numbers. Someone stops by (Dean Sanderson? iirc), we tell him what's up, he looks at the screen, and almost right away he's like "Oh, this is easy! All you need to do is swap the lines in the tables."
- OldGuyInTheClub 3y agoFWIW, I did try. Many languages now have websites where one can experiment with an interpreter or compiler. I've used them for playing with JavaScript, APL, Python, etc. Strangely, there does not seem to be one for FORTH. SwiftForth from forth.com does not work with 64-bit Intel Mac OS-es like Catalina which is what I have [1]. I tried gForth as well but during the installation, it invoked HomeBrew which gave a series of hostile messages that my system is obsolete and to not bother asking for any help or support. See [2] and the output provided by the poster - it is what I saw in my case. [1] https://www.forth.com/download/ https://www.forth.com/download/ [2] https://superuser.com/questions/1767114/is-it-that-bad-to-use-homebrew-on-an-outdated-macos https://superuser.com/questions/1767114/is-it-that-bad-to-us...
- coldtea 3y ago>but have no idea how I'd write a trig or stat function if it weren't already built in! Well, that's not really about programmings skills though. That's math. You could write a decent approximate SIN using the taylor series formula [1]. It's pretty easy, you don't even need to know math, can just look the formula up and translate it to an algorithm. Real world language SIN methods use more efficient and accurate methods, but it's still about knowing the math or looking up common such algorithms. Or you could just invoke the libc (standard C library) SIN from Forth or whatever language you're using. That's what Python and other languages do. The quote is more about the approach of writing an application by writing a DSL for the application, than about starting from zero and re-doing all the low level libraries like trig yourself. [1] https://en.wikipedia.org/wiki/Taylor_series https://en.wikipedia.org/wiki/Taylor_series
- OldGuyInTheClub 3y agoFair enough. I certainly understand Taylor series. 40+ years ago I experimented with series approximations using the programmable HP calculators of the day to see how my functions compared to the builtins. I intended to say that I would struggle to write something worth using. Poor wording to say the least. I had no idea FORTH could invoke libraries from C. I got the impression it would be used on systems where space is at a premium precluding the installation of other higher-level languages.
- coldtea 3y agoYeah, it can, via it's favorite method for everything: adding params to the stack, and getting the return value there! Here's for GForth for example: https://www.complang.tuwien.ac.at/forth/gforth/Docs-html/Calling-C-Functions.html https://www.complang.tuwien.ac.at/forth/gforth/Docs-html/Cal... There are even bindings to C/C++ GUI libraries and so on. Running at constrained systems is just a common deployment scenario, but nothing in Forth necessitates it. You can even run it under Windows.
- PeterStuer 3y agoThe DSL approach to Lisp programming was mainstream in the 80's. It comes natural to any system that has enough frictionless syntactic plasticity and expressiveness.
- zelphirkalt 3y agoThese days it still exists in Racket (and possibly others), see language oriented programming ideas. I would like to add though, that "language" does not have to mean macros and DSL. It can also simply mean what kind of things one considers primitives for the problem to solve. Those primitives can be built in already, they can be user defined functions (or words) or macros or whatever else makes an identifier or thing one can reference later when solving the actual problem.
- crq-yml 3y agoAgreed that the semantic of language-oriented is sometimes hard to disentangle from the aesthetic of "parsing and compiling". In a majority of cases you can go part of the way in that direction by overlaying a FSM, stack machine or a trivial string parser onto whatever feels cluttered and obnoxious to keep track of. If you want to do the parsed exterior DSL thing today, the magic wand that probably does it the best is Raku and its souped-up grammar system. I actually am exploring that now and I think it has a good toolkit for prototyping anything resembling a textual interface.
- DonHopkins 3y agoPostScript is kind of like a cross between Forth and Lisp. But it's actually a lot more like Lisp than Forth: high level, polymorphic, homoiconic, etc. on: What are the enduring innovations of Lisp? (2022): https://news.ycombinator.com/item?id=36159999 https://news.ycombinator.com/item?id=36159999 >PostScript is as truly homoiconic and polymorphic and interactive as Lisp. on: Masterminds of Programming: Chuck Moore (2009): https://news.ycombinator.com/item?id=21964186 https://news.ycombinator.com/item?id=21964186 on: Sun's NeWS was a mistake, as are all toolkit-in-server windowing systems (2013) (utoronto.ca): https://news.ycombinator.com/item?id=22456471 https://news.ycombinator.com/item?id=22456471 FORTH ?KNOW IF HONK! ELSE FORTH LEARN! THEN https://news.ycombinator.com/item?id=29261771 https://news.ycombinator.com/item?id=29261771 on: Forth vs Lisp: https://news.ycombinator.com/item?id=29261810 https://news.ycombinator.com/item?id=29261810 NeWS PostScript stuff: https://news.ycombinator.com/item?id=22456831 https://news.ycombinator.com/item?id=22456831 Lisp in Forth: https://news.ycombinator.com/item?id=26882117 https://news.ycombinator.com/item?id=26882117
- fuzztester 3y agoRe the HONK! snippet: Can't resist reposting this: https://news.ycombinator.com/item?id=39109122 https://news.ycombinator.com/item?id=39109122 3rd comment down the subthread.