Teaching Prolog as first programming language

I’ve introduced several people to Prolog as first language. Seems to be no problem at all. Tell a non-programmer

X is X + 1

can’t be true. They say “yes, of course”. Present the same to a programmer and you have a lot to explain … I just have to think about the nightmares I had trying to make Prolog behave as Algol :slight_smile:

Logic should be closer to human thinking than state manipulation :slight_smile:

3 Likes

Thanks.

I am not opposed to changing my view, but the only evidence I have is the horror stories I hear from others.

Would like to hear much more details about how it went, what pit falls should be avoided, what was their knowledge level when starting with Prolog (high school, university, professional) and how well did they latter pick up other programming paradigms.

On a related note, I once read a comment where someone first learned functional programming with immutable state, and then tried to learn Object Oriented code with mutable state and said it was a nightmare of trying to remember the state of all of those variables at the same time; that made sense to me.

It is too long ago and was too unstructured to give a sensible answer here. I would not be surprised if there is such research from the 80s/early 90s. I expect most here can confirm that switching from imperative to logic programming comes with great difficulties. I have no clue how people experience the transition from logic programming to imperative programming. I do consider my LP knowledge valuable for imperative programming. In particular it often makes me think in data-driven solutions rather than lots of conditions, i.e. represent the knowledge in a table and write a function that solves the problem using this knowledge rather than hiding the knowledge in the function.

I learned JavaScript from “Eloquent JavaScript: A Modern Introduction to Programming”. This books claims to explain JavaScript to non-programmers, starting at the beginning. I considered the first chapter, introducing basic (imperative) programming concepts as “natural things” rather odd. Must be my LP deformation :slight_smile: I doubt many non-programmers are able to follow the remainder of the book, but for me it was just perfect :slight_smile:

1 Like

Any particular keywords or authors to use when searching for such papers? Or sites that might have the papers? My favorite site for such papers is CiteSeerX

For others reading this, I added other sites that host research papers to Useful Prolog references

Googling: teaching prolog as first programming language pdf

Found:
Prolog as the First Programming Language

In the spirit of logic programming, several features of
Prolog are not covered. Most notable would be the Prolog
‘cut’ operation. While this can be explained using the goal
reduction model of Prolog, it does not have a meaningful
description at the logic level, and for our purposes is better
omitted. Also omitted are term inspection predicates (e.g.,
var(X)), DCG grammars, and character-level input-output.
Finally, the emphasis on a higher level of abstraction offers
limited circumstances that raise the issue of efficiency
considerations.

APPROACHES FOR TEACHING PROLOG TO BEGINNERS

I typically use Google Scolar This seems to give some starting points. Next follow citations …

1 Like

“Eloquent JavaScript: A Modern Introduction to Programming” 3rd Edition (WorldCat) by Marijn Haverbeke Copyright 2018

Free (PDF)

Imagine coming to a Prolog site and finding a reference to a good free JavaScript book, it happens. :slightly_smiling_face: