[Tutor] Tungsten teaching method

Alan Gauld alan.gauld at yahoo.co.uk
Fri Jul 14 15:33:25 EDT 2023


On 14/07/2023 19:09, ThreeBlindQuarks via Tutor wrote:

> Do you start with the basics as in ...basic types... IF statements...

That is the traditional approach to 3G procedural languages
that most people use. But...

> So I decided to learn another language called WOLFRAM. 

Yes, it comes on the RaspberryPi microcomputer version of Linux.
It is a 4G type language similar, as you say to Mathematica.

> What got me is that for an ELEMENTARY text, it skips all the elementary parts. 

Thats because you have to approach it differently to 3G languages.
You express your problem and let the language solve it. Much of
it is done using symbolic math equations etc. In that sense it
is similar to Prolog which is also typically taught in a more
"exemplary" style than 3G languages. (Or indeed SQL which
also doesn't explicitly have concepts like variables and
loops etc)

> ..how to create an object. I know it all has to be THERE

Not necessarily. 4G (and higher) languages often don't provide
those explicit concepts because they don;t expect the user to
be deciding how to solve the problem so the internals of the
language implementation create variables(as in temporary storage)
build loops and make major decisions. Usually you can get in
through a back door to do those things if you must (Prolog
for example does allow such things) but they are advanced concepts.
For example, its hard to envision how OOP fits into a declarative
style of programming as used in Prolog. (It can be done and I've
seen an ObjectProlog interpreter somewhere on the net but its not
obvious, especially to a normal Prolog user.)

> ... functions appropriately, often in a nested fashion.

And that nesting is the key. The values stored in variables
are simply passed as inputs to outer functions. (Javascript is often
used in a similar way with code like

function f(value, function(another_value), function()...)

And the parametrized functions can be defined inline which
leads to fairly tricky code to read but relatively few explicit
variables, certainly at the global level.

> The point here is that we often have little idea about 
> the person asking a question and their background. 

Indeed.


> ...determine if a number is prime, rather than suggesting 
> some technique using an algorithm, they would just suggest 
> using PrimeQ[number] and voila! 

And that is typical of 4G and 5G languages.
You give the interpreter the problem to solve and don't
worry too much about how its done.


> ...in effect they would apply a function to a list returning 
> the list of results. If you want just the ones that are prime, 
> you can use a sort of embedded if statement. 

That sounds like functional programming. Even in Python we have
similar tools like generators and map(), reduce(), and others.
Modules like itertools, functools, and some others remove or
reduce the need for explicit loops and branches.

> Python though is actually many paradigms in one.

Indeed it is.

> ... learn how computers work on a basic level and then 
> get into higher abstractions, it is very good. 

And that was (back in the 1990s) what Guido had in mind. A
language that was useful for real world tasks but also
suitable for teaching programming, in all its various guises.
It also had to be easily extendible and easily embedded
in other systems.

> Some of what I describe is in there if you know where

And that's true of most 5G languages. Even SQL(but you have
to look very hard!)

> In this forum, I suspect that unless asked otherwise, 
> we ought to remain in the lower levels. 

Yes. If someone knows enough to ask about other approaches
we will oblige but in 90%+ of cases we are dealing with
"students" who are learning conventional 3G programming.

4G languages are very good at what they do, but they tend
to be focused on specific domains. It's not easy to build
a GUI application in Wolfram or Prolog or to write a web
server, say. But if a student is only interested in that
niche area the 5G approach may be the best(*).

The problems arise when they want to step outside the
niche and discover they need to learn a whole new
programming style. One that may initially seem very
primitive and complex. Its like a Python programmer
suddenly having to learn assembler...

(*)Although 4G languages often have their own steep learning
curve. But it tends to kick in later. Basic usage can be
picked up easily but the huge "vocabulary" of builtin
functions can take a long time to master. Compare that
with "primitive" C which originally only had about
2 dozen keywords. Everything else was functions in
libraries.

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos





More information about the Tutor mailing list