home *** CD-ROM | disk | FTP | other *** search
Prolog Source | 1987-08-11 | 669 b | 25 lines |
- /* Listing 2 - Turbo Prolog module to call C to find the mean,
- which is passed back in a functor. */
-
- domains
- ilist=real*
- ifunc=f(real)
-
- global predicates
- cpinit language c /* declare Turbo C initialization */
- /* module, cpinit */
- mean(ilist,ifunc) - (i,o) (o,i) language c
- /* declare Turbo C module, mean. */
- predicates
- process(ilist)
-
- goal
- cpinit,
- process([1.0,5.0,10.0,14.0]).
-
- clauses
- process(List):-
- mean(List,Ans), /* Call Turbo C module to calculate mean */
- write(Ans),nl.
-
-