[eclipse-clp-users] Issue with exported structures

From: Philippe de Rochambeau <phiroc_at_...22...>
Date: Tue, 5 Sep 2017 08:21:14 +0200
Hello,

I’m having an issue with an exported structure:

When I run


p2m:top(
	[
		p2m:person{name:philippe,age:50,p2m:ba:bank_account{bal:1000}}
	],PMBL).	


I get the below warnings.

Any help would be much appreciated.

Philippe



—————

WARNING: Unrecognized structure name in module eclipse in
    bank_account{bal : 1000}
WARNING: Unrecognized structure name in module eclipse in
    person{name : philippe, age : 53, p2m : ba : bank_account{bal : 1000}}

PMBL = []
Yes (0.00s cpu)
[eclipse 15]: p2m:top(
	[
		p2m:person{name:philippe,age:53,p2m:ba:bank_account{bal:1000}}
	],PMBL).			
WARNING: Unrecognized structure name in module eclipse in
    bank_account{bal : 1000}
WARNING: Unrecognized structure name in module eclipse in
    person{name : philippe, age : 53, p2m : ba : bank_account{bal : 1000}}

PMBL = []
Yes (0.00s cpu)


-------------

——————————— code ——————————————


/*
	Find people whose balance is above a certain limit.
*/

:- module(p2m).
:- export top/2.
:- export filterBalance/3.
:- export top/2.
:- lib(ic).
:- export struct(bank_account(bal)).
:- export struct(person(name,age,ba:bank_account)).

top(FamilyList, PersonsMatchingBalanceLimit) :-
		BalanceLimit = 0,
		filterBalance(BalanceLimit, FamilyList, Ys), PersonsMatchingBalanceLimit = Ys.
		
filterBalance(BalanceLimit, Family, Ys) :-
	(
		% foreach person in family
		foreach(Person,Family),
		fromto(Ys,Ys2,Ys1,[]),
		param(BalanceLimit)
	do
		(
			person{ba:Bal} = Person,
			arg(1, Bal, Bal2),
			Bal2 #>= BalanceLimit -> Ys2=[Bal2|Ys1] ;
			Ys2=Ys1
		)	
	).
Received on Tue Sep 05 2017 - 06:21:24 CEST

This archive was generated by hypermail 2.3.0 : Thu Feb 22 2024 - 18:13:20 CET