IP/Host: ---.vic.mweb.co.za
Registered: 18 years ago
Posts: 26
Rating: 0
Hello.
Ass3 Q4 is mostly done, except that I'm not sure how to get setof to return the lists in sorted order. The merge function is fine, but how do tell setof that the sum of the F/H values must be used as a criteria for ordering?
The documentation says
"setof/3 is like bagof/3 above except the list List is sorted according to the standard order and any duplicates are removed."
Umm, what exactly is the 'standard order', and what if you're inclined towards a new (world) order?
IP/Host: ---.vic.mweb.co.za
Registered: 18 years ago
Posts: 26
Rating: 0
Q2 eh? Are you still having trouble finding a good representation of the data?
I didn't use the obvious (r2, r2, 0 , r5, r5) representation, 'cos I couldn't figure out a good way to swap the space with a coin. Instead, I used (Space, r2/Location, r2/Location, r5/Location, r5/Location) as the representation. That way it's much easier to create functions which swap the space 1 or 2 places in either direction.