Thinking about functional programming in Algol 68

chris hermansen clhermansen@gmail.com
Mon Jul 7 01:35:40 GMT 2025


Hello all,

Disclaimer - I am not a functional expert in any way, shape or form, these
are just some musings that I hope will spark a productive discussion.

It seems to me that Algol 68 can be used to take a functional approach to
programming, at least to a certain extent.  I love the idea of pushing the
orthogonality principle further than before...

(stepping into Lindsey's shoes here, which are much, much larger than I can
fill:

https://rosettacode.org/wiki/Category:ALGOL_68)

We could define a proc that will yield a sum over all the elements of an
array.

We could define a proc that will apply another proc over all the elements
of an array.

Same story for lists.

Of course the strong typing of Algol 68 with no templates creates the
situation where we need to be clever.

But maybe we could define some of these functions in terms of a type that
could be defined subsequently by the programmer who wishes to use the
functions, taking advantage of "use before definition" that Algol 68
provides.

I'm also wondering about lazy evaluation.  It seems to me that proc
variables could accomplish this for us (within the definitions of the
user-facing procs).

For example, I'm imagining a proc stream = ... that accepts a united mode
and a proc.  Maybe this could be an operator.  Clearly this would not look
like the classic

foo(thing)
   .bar(some expression)
   .collect(another expression)

but maybe something similar / inside out?

Am I Sunday-night-dreaming here?

-- 
Chris Hermansen · clhermansen "at" gmail "dot" com

C'est ma façon de parler.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://gcc.gnu.org/pipermail/algol68/attachments/20250706/b2222b59/attachment.htm>


More information about the Algol68 mailing list