I am trying to learn a bit of type theory. This is being taught using a dialect of lisp the author wrote called pie.
Let's say we have defined some function f that takes a single argument of type A and produces an output of type B and I have some a that is of type A.
If I try to type the expression:
(f a)
I can't decide between two possible outcomes:
- It's a list whose first element is some A->B and whose second element is some A
- It's something of type B ... because it's an application
When is a list a list, and when is it an application? What if i wanted lists of functions, how would this work, what's to stop the list being interpreted as an application?