Re: Confused Students

From: Sergio Antoy <antoy_at_redstar.cs.pdx.edu>
Date: Thu, 21 Jun 2007 10:09:18 -0700 (PDT)

Sebastian,

I agree with you.

> Here, "program rules" should mean "rules on top-level" because as you
> can see from the examples introduced by Sergio, local declarations
> behave differently. For example the following two Curry programs have
> different semantics:
>
> program 1:
>
> pair = (x,x)
> x = True ? False
>
> program 2:
>
> pair = (x,x)
> where
> x = True ? False
>
> I consider this counter intuitive.

Very. The problem, though, stems only from the notation and the
terminology.

In program 1, we have 2 rewrite rules. We could write:

pair -> (x,x)
x -> True ? false

In program 2, we have 1 rewrite rule
whose right-hand side is not a term, but a graph.
To encode the graph structure we must give a name to
a subterm, the name is "x". We could write:

pair -> (x,x)
  where x := True ? False

in which ":=" stands for "is the name of".

The confusion stems from various sources. We use of the same equal
sign for two rather different concepts (rewriting and naming).
And we use the same word "variable" for two rather different
concepts (a place holder for any term in a rewrite rule, and the
name of a subterm in a term).

If we change the notation and terminology, there is no confusion.
If we overload notation and terminology, and explain it to the
students, there is no confusion as well. One could only argue
whether this overloading is appropriate and convenient.

Sergio
_______________________________________________
curry mailing list
curry_at_lists.RWTH-Aachen.DE
http://MailMan.RWTH-Aachen.DE/mailman/listinfo/curry
Received on Do Jun 21 2007 - 19:12:06 CEST

This archive was generated by hypermail 2.3.0 : Do Jun 20 2024 - 07:15:09 CEST