This repository has been archived on 2023-08-20. You can view files and clone it, but cannot push or open issues or pull requests.
yap-6.3/packages/python/examples/namedtuples.yap

22 lines
378 B
Prolog

:- use_module( library(python) ).
:- := import( collections ).
:- := import( yap ).
:- e := yap.'YAPEngine'().
main :-
system_predicate(N/A),
args(0,A,L),
N := namedtuple( N, L),
fail.
main :-
:= e.call( writeln( 1 ) ).
args(N, N, []) :- !.
args(I0,IF,[AI|Ais]) :-
I is I0+1,
number_string(I, IS),
string_concat("A", IS, AI),
args(I, IF, Ais).