Thread View: comp.lang.prolog
1 messages
1 total messages
Started by Olivier Ridoux
Fri, 08 Jan 1993 09:04
Grotesque
Author: Olivier Ridoux
Date: Fri, 08 Jan 1993 09:04
Date: Fri, 08 Jan 1993 09:04
24 lines
1009 bytes
1009 bytes
> 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
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads