Maged Zamzam wrote: > I have a struct called journal{type, priority, columns, lines, posX, > posY} and I would like to labeling the variables posX and posY only in > the struct. > The problem is that if i try to label Items (List which contains the > journal types) ECLiPSe gives me a type error indomain. The search/6 predicate allows you to specify an argument position, so you could invoke e.g. search(Journals, 5, first_fail, indomain, complete, []) to label the 5th field of the structures in the Journals list. If you have declared your structure with a struct() declaration, you could equivalently write search(Journals, posX of journal, first_fail, indomain, complete, []) This does however not enable you to label both posX and posY fields in one go. To do that, you would have to extract these variables first into an auxiliary list, and then label that list, e.g. ( foreach(journal{posX:X,posY:Y},Journals}, fromto(XYs, [X|Xs], Xs, Ys), fromto(Ys, [Y|Ys], Ys, []) do true ), labeling(XYs). -- JoachimReceived on Thu Mar 18 2010 - 00:39:23 CET
This archive was generated by hypermail 2.2.0 : Thu Feb 02 2012 - 02:31:58 CET