home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.prolog
- Path: sparky!uunet!mcsun!julienas!irisa!ridoux
- From: ridoux@irisa.fr (Olivier Ridoux)
- Subject: Grotesque
- Message-ID: <1993Jan8.090450.8875@irisa.fr>
- Sender: news@irisa.fr
- Organization: IRISA, Rennes (Fr)
- Date: Fri, 8 Jan 93 09:04:50 GMT
- Lines: 25
-
-
- > I realised a while back that you can use DCGs for many programs that
- > don't look like parsing. My favorite (and most grotesque) is flatten:
- >
- > flatten(List, FlattenedList):-
- > phrase(flatten(List), FlattenedList).
- >
- > flatten([]) --> [].
- >
- > flatten([Head|Rest]) -->
- > flatten(Head),
- > flatten(Rest).
- >
- > flatten(List) -->
- > [List].
-
- I cannot see what is so *grotesque* in trying to give a condensed
- expression of the regularities a computation contains.
-
- I suppose you disapprove of using DCG for something which seems the
- opposite of syntactic analysis. However, especially in Prolog, one
- should be used with non-directional thinking.
-
- Olivier Ridoux
-
-