3 ms·
Which Forth has a "good" standard library?
by i_feel_great 10y ago
Which Forth has a "good" standard library?
- mikekchar 10y agoKeep in mind that it has been decades since I was a FORTH programmer. I'm half fearing and half hoping someone will correct what I'm about to say :-) Essentially, you want FIG FORTH. Virtually anything will give you that. Remember that FORTH doesn't really have libraries. It's more like Smalltalk where you have a running environment of loaded code. Generally you want to have a small kernel and then load only the words that are relevant to what you are doing. For that reason, there isn't really any big standard library (that I'm aware of) like there are with other languages. FORTH words decompile really, really easily too, so mostly FORTH programmer work with source code. You just load what you need from wherever you get it. Having said that, there have historically been attempts to have libraries and create build environment, etc, etc. I'm not aware of any that achieved any universal popularity.
- undecidabot 10y agoNot Forth, but Factor (https://factorcode.org/ https://factorcode.org/) is very much inspired by Forth (also being a stack-based / concatenative programming language), and it does have a good standard library complete with your usual data structures along with extra libraries for regexp, several parsers (csv, json, xml), an http server and client, a web framework (built on top of that server with SQL DB drivers), a ui framework (via OpenGL), and even xkcd (http://docs.factorcode.org/content/article-vocab-index.html http://docs.factorcode.org/content/article-vocab-index.html). Check this blog out for some cool things you could do with Factor: http://re-factor.blogspot.com/ http://re-factor.blogspot.com/
- AstroJetson 10y agoFactor is cool, but it has some differences that may trip an experienced user. But for a first time Forth user, the extra frameworks/libraries may be a help. As pointed out below, FIG Forth has a great deal of support. All my interactions using Forth have been on underpowered systems pounding on the bare metal. So lots of the words created supported that environment. Math words and geometry words came from FIG Forth.
- swah 10y agoThe small community around Slava Pestov was (is) great... The standard library is amazing and they (used to) follow a model that has worked well for them (IRRC): the best libraries from the community become part of the distribution. If they aren't that well written, the core guys would help you express the idea better. And then it could make it into the standard library. Or the core guys would just rewrite it for you (Factor is very compact). On the other hand, if something solving that same problem was already in the standard library, there was no discussion: that problem is already solved. Happy to see that Factor still lives!
- dvdkhlng 10y agoAll of the "big" Forth systems come with some sort of standard library. In the open source world, gForth [1] is pretty well-known which comes with a comprehensive set of words [2] many are not part of the ANS Forth standard [3,4]. You could call that gForth's "standard library". For stuff that is missing, gForth has an interface to native system libraries [5]. For math and scientific computing there is the Forth Scientific Library [6] which is written in standard-conforming forth and can be loaded and used on most of the forth systems currently in use. But then Forth coders somehow live by the philosophy "if you want it to be done right you have to do it yourself", so use of library code is frowned upon and people usually tend to reinvent the wheel and writing code from scratch :) [1] https://www.gnu.org/software/gforth/ https://www.gnu.org/software/gforth/ [2] http://www.complang.tuwien.ac.at/forth/gforth/Docs-html/ http://www.complang.tuwien.ac.at/forth/gforth/Docs-html/ [3] https://www.taygeta.com/forth/dpans.html https://www.taygeta.com/forth/dpans.html [4] http://www.forth200x.org/documents/forth14-5.pdf http://www.forth200x.org/documents/forth14-5.pdf [5] http://www.complang.tuwien.ac.at/forth/gforth/Docs-html/C-Interface.html#C-Interface http://www.complang.tuwien.ac.at/forth/gforth/Docs-html/C-In... [6] https://www.taygeta.com/fsl/scilib.html https://www.taygeta.com/fsl/scilib.html
- richard_todd 10y agoClosest thing I know of is FFL (http://soton.mpeforth.com/flag/ffl/index.html http://soton.mpeforth.com/flag/ffl/index.html) which works on several FORTHs.