From eea18ca12f847b2a302d1793bef5fcc1eb452277 Mon Sep 17 00:00:00 2001 From: Jed Barber Date: Sat, 15 Mar 2014 22:08:33 +1100 Subject: Made into a module with only prompt/1 and readList/1 exposed --- read.pro | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/read.pro b/read.pro index a554a22..35bfb52 100644 --- a/read.pro +++ b/read.pro @@ -1,4 +1,6 @@ +:- module(read, [prompt/1, readList/1]). + % functions for obtaining a line of input text and parsing % it into a list of words @@ -19,19 +21,19 @@ readList(L) :- readLine(L) :- get0(C), - buildList(C,L). + buildLine(C,L). -buildList(10,[]) :- !. -buildList(C,[C|X]) :- +buildLine(10,[]) :- !. +buildLine(C,[C|X]) :- get0(C2), - buildList(C2,X). + buildLine(C2,X). wordList([X|Y]) --> word(X), whitespace, wordList(Y). wordList([X]) --> whitespace, wordList(X). wordList([X]) --> word(X). -wordList([X]) --> whitespace, word(X). +wordList([X]) --> word(X), whitespace. word(W) --> charList(X), {name(W,X)}. -- cgit