How can i get the count of each number in a file ?
z_axis <[email protected]>
| Newsgroups | gmane.comp.ai.prolog.swi |
|---|---|
| Organization | zsoft |
| Message-ID | <[email protected]> |
hi, friend
Suppose there is a data file whose format is as below:
13001 2 3 7 6 11 22 9
13002 50 51 53 52 59 60 8
...
The 1st column is ID and the 2nd 6 fields(between 1 and 60) is what i
want. The last field can be ignored.
now i can use the following predicates to get a list of number i.e. [2, 3,
7, 6, 11, 22, 50, 51, 53, 52, 59, 60, ...]
ints(L) --> blanks, (integer(I), ints(Is), {L = [I|Is]} ; {L = []}).
phase/2
read_line_to_codes/2
then how can i get [(2,1),(3,1), ...] ?
Sincerely!