
Showing off scheme - Functions - Expressions - Defining your own procedures - Words and sentences - True and false - Variables - Higher-order functions - Lambda - Introduction to recursion - The leap of faith - How recursion works - Common patterns in recursive procedures - Advanced recursion - Example: the functions program - Files - Vectors - Example: a spreadsheet program - Implementing the spreadsheet program - What's next?
- Forth: you can use PFE,Gforth for ANS Forth requeriments. Or EForth if you reached high skills levels where the missing stuff can be just reimplemented.
EForth under Muxleq: https://github.com/howerj/muxleq I can provide a working config where a 90% of it would be valid across SF.
Starting Forth, ANS version: https://www.forth.com/starting-forth/
Thinking Forth, do this after finishing SF: https://thinking-forth.sourceforge.net/
Also, Forth Scientific Library. You can make it working with both GForth and PFE, just read the docs.
Full pack: https://www.taygeta.com/fsl/library/Library.tgz
Helping Forth code for GForth/PFE. If you put it under scilib/fs-util.fs, load it with:
s" scilib/fsu-util.fs" included
https://www.taygeta.com/fsl/library/fsl-util.fs- Lisp. s9fes, it will compile under any nix/Mac/BSD out there, even with MinC.
S9fes: http://www.t3x.org/s9fes/
Pick the bleeding edge version, it will compile just fine.
For Windows users: MinC, install both EXE under Windows. First, minc
exe, then buildtools*exe: https://minc.commandlinerevolution.nl/english/home.htmlThen get 7zip to decompress the s9fes TGZ file, cd to that directory, and run 'make'.
Run ./s9 to get the prompt, or ./s9 file.scm where file.scm it's the source code.
In order to learn Scheme, there's are two newbie recommended books before "SICP".
Pick any, CACS, SS, it doesn't matter, both will guide you before SICP, the 'big' book on Scheme:
Simply Scheme https://people.eecs.berkeley.edu/~bh/pdf/
Simply.scm file, select from ';;; simply.scm version 3.13 (8/11/98)' to '(strings-are-numbers #t)' and save it as simply.scm
https://people.eecs.berkeley.edu/~bh/ssch27/appendix-simply....
Concrete Abstractions
Book:
https://www.d.umn.edu/~tcolburn/cs1581/ConcreteAbstractions....
The SCM files needed to be (load "foo.scm") ed in the code in order to do the exercises:
https://github.com/freezoo/scheme-concabs
If you are en Emacs user, just read the Elisp intro, it will work for a different Lisp family but with similar design.
Spot the differences:
Scheme (like s9):
(define (square x)
(* x x))
We try: >(square 20)
400
Elisp/Common Lisp (as the web site shows): (defun square (x)
(* x x))
Same there: >(square 20)
400
- Ok, ML like languages:https://www.t3x.org/mlite/index.html
If you follow the instructions on compiling s9, mlite it's similar with MinC for Windows. If you are a Unix/Linux/Mac user, you already know how to do that.
You got the whole docs in the TGZ file, and the web.
https://www.t3x.org/amk/index.html
You can just get the code without buying the book, learn with Simply Scheme or any other book and apply the functions from the code, the solvers are really easy to understand.
As for non-fiction I just bring out the classics that taught me Lisp and Lispy things: Simply Scheme, SICP, On Lisp.
I always struggled with fundamental terminology used in this family of languages, particularly lambda. Lambda as a term does carry historical baggage. The term wasn’t picked out of thin air. And casually looking at Lisp and Scheme code, if you don’t know that baggage, lambda is (at least to me) an opaque term.
But I luckily stumbled upon a book “Simply Scheme”. And the first thing they did was redefine a bunch of terms. No more CAR, CDR, CADR. Instead you got things like FIRST, REST. SECOND. Importantly, they redefined LAMBDA to FUNCTION.
Well, Shazam. Ding, ding, ding. This was an “aha” moment for me. Boy did a lot of stuff suddenly fell into place.
So, simplifying the vocabulary can be very helpful for introducing gateway concepts.
My 5 "ahas" were expressions and assignment in BASIC. Arrays, and how they work. Dynamic memory, i.e. the first time I got a linked list to work in Pascal. Networking as a streaming service combined with "how Unix works", which was mind blowing. And, finally, lambda.
The first was my science teacher introducing me to the computer. He did this and that, and left me to flail helplessly for several hours before I gave up and went home. The next day he showed me BASIC expressions, again, "aha", and it stuck.
Next, was arrays. Did not grok arrays at all. And all of the example were something about "balancing a check book" (I'm 14, like I care a wit about balancing check books). But eventually, after typing in enough "101 BASIC GAMES", arrays clicked. I can't recall, which game, but I credit one of those BASIC game books for that aha.
I don't consider my dynamic memory aha to be book based. I'm sure I got it from some data structures book in theory, but pulling it off in Pascal was just a combination of raw effort and figuring it out with friends. It's an aha moment because visualizing the linked list, or tree exploding in your mind from the very few lines of code necessary to pull it off was, well, aha indeed.
Network streaming and Unix came in one hit. I'd been doing Unix application development for some time, but our machines and client machines were all standalone. But I was at another office and I saw a guy do, essentially, `cpio -xyz folder | rsh cat > /dev/tape` (yes, rsh -- does that date it?) And that really blew my mind. The idea of piping across the network to a streamable device. Wow. Very, very aha.
Finally, lambda. Always fascinated and interested in Lisps and what not, but I seem to be genetically coded against groking anything Greek outside of a Gyro sandwich. I've always hated reading texts that use the Greek alphabet for, well, anything. Because whenever I see a Greek letter, I assume that it must be conveying something beyond a simple unknown variable. People choose those letters for a reason, I just don't know what it is. So, θ is used not just to represent a variable, but to represent an angle (always seems in trig, they use θ). So, if you see θ, perhaps it also means that it's an angle of somekind.
Anyway, right or wrong, I assume that's whats happening and I simply don't know the "meta" of why, when, or how a Greek letter is chosen. And this hold true for Lambda.
Lambda was chosen because of its inspiration from lambda calculus (which I also don't know). So, if you know lambda calculus, you "know" what lambda means. I don't, so I'd be bouncing along in some Scheme or Lisp test and they start dropping those on my head and, well, my pooh brain doesn't grok it and I'd abandon it.
Then, I stumbled upon the book "Simply Scheme". What does "Simply Scheme" do? First thing they do, is they rename everything. Like "first" instead of "car". They just started with their own vocabulary and presented Scheme that way. Well, heck, I knew what all those words mean, maybe not the specific semantics in Scheme, but the general definition, and so the first few chapters were very successful in communicating the underlying themes of Scheme. Including things like anonymous functions (for which they used the word, I think, of all things, "function").
Later they conflate "lambda" and "function". Basically, "lambda" mean "anonymous function".
"Oh!" "Aha!", and the clouds parted, the seas calmed, the sun came out and like getting a few select Tetris pieces, the board cleared and a LOT of things made much more sense right away.
Aha indeed.
Simply Scheme, Structure and Interpretation of Computer Programs, How to Design Programs.
They're a hundred times easier to get going with the exercises using racket than the incredible faff it used to be when purchased, especially with SICP.
Maybe if the book is good enough the wider community supports it?
Then there's K&R C, K&Pike, Richard Stevens, of which any edition from the last 20 years is still pretty useful. Although there must be something better than K&R for C by now - the example programming style can be improved upon while still appreciating its considerable strengths. In that general direction Van Der Linden's "Expert C" and "The C Puzzle Book" remain fantastic books to grok C and low level programming.
The Wrox "Professional Assembly Language" is both out of date (32 bit x86) and still about your best bet, update it and play with the x86-64 abi docs, a download of the intel optimisation manual, "Hackers Delight" and http://aggregate.org/MAGIC/