Re: function notation and linguistics (was: What's so great about lisp?)
- From: Panu Kalliokoski <atehwa@xxxxxxxx>
- Date: 24 Sep 2005 17:26:48 GMT
First, I'd like to say that your points are very valid and the theory of
S-expressions was probably motivated by syntax trees of natural
languages. Lisp is designed to be its own metalanguage: by exposing its
AST in an easy-to-manipulate form, it effectively encourages (a)
building new languages on that same format and (b) reasoning about
programs written in itself. Prolog is similar in this respect
(homoiconic).
A parenthesised expression in Lisp corresponds to the idea of
"expression" (or "phrase") in linguistics. A symbol in Lisp corresponds
to the idea of "word" (or "idiom") in linguistics. The idea of "clause"
does not have a clear counterpart in Lisp, but in Logo it is modelled as
a list. (An anonymous function serves some of the same purpose as a
subordinate clause.)
Some other points:
In <nuclei-20050924143843@xxxxxxxxxxxxxxxxxxxxxxx> ram@xxxxxxxxxxxxxxxxxx (Stefan Ram) writes:
>while( x < 0 )f( x );
> can be regarded as an application of the nucleaus "while"
> to the satellites "x < 0" and "f( x );". (The semantics are
> that of a function, mapping an expression and a statement
> to another statement.)
This is why some Logos have:
while [:x < 0] [f :x]
> So eventually, every structure in every language is the
> application of a nucleaus to satellites (sometimes, however,
> the details are open to interpretation, for example, which
> constituent in a given text has the role of the nucleus.).
Definitely. For example, in "red hat" we would be tempted to describe
"hat" as the nucleus; but it's clear that "hat" needs no parameters, for
example, in the clause "eat the hat". So, in type-based grammars, we
usually make "red" a (unary) function and "hat" a constant (= nullary
function).
When natural languages have multiple ways of using a word, we tag
expressions with explicit "type declarations":
"John sees a red hat"
-> (S (NP (N john)) (VP (V sees) (NP (A red) (NP (N hat)))))
"I like red"
-> (S (NP (PRON I)) (VP (V like) (NP (N red))))
See how the tags differ for "red" in the trees? In programming
languages, we require every word to behave syntactically similarly in
all contexts.
(Actually, my example parse trees _still_ use NP in a polymorphic way;
it's used for both N expressions and A,NP expressions. Prolog accounts
for this by internally treating NP/1 and NP/2 as different tags.)
Panu
--
personal contact: atehwa@xxxxxx, +35841 5323835, +3589 85619369
work contact: panu.kalliokoski@xxxxxxxxxxx, +35850 3678003
kotisivu (henkkoht): http://www.iki.fi/atehwa/
homepage (technical): http://sange.fi/~atehwa/
.
- Prev by Date: Re: Moedications P har Offr
- Next by Date: Benefits of Dynamic Typing
- Previous by thread: Re: Moedications P har Offr
- Next by thread: Benefits of Dynamic Typing
- Index(es):
Relevant Pages
|