Welcome! Log In Create A New Profile


setof sorting

Posted by maccaroo 
Announcements Last Post
Announcement SoC Curricula 09/30/2017 01:08PM
Announcement Demarcation or scoping of examinations and assessment 02/13/2017 07:59AM
Announcement School of Computing Short Learning Programmes 11/24/2014 08:37AM
Announcement Unisa contact information 07/28/2011 01:28PM
setof sorting
August 19, 2006 05:42PM

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?
Re: setof sorting
August 23, 2006 09:32PM
I'll assume that the stunned silence means that noone else has a clue how to get setof to order the list according to the F+H criteria we need.

Please could one of the lecturers (or anybody smarter than me) shed some light on this one.

Much appreciated, Mac
Anonymous User
Re: setof sorting
August 24, 2006 09:42AM
No comment cause I am still on q2 sad smiley
Re: setof sorting
August 24, 2006 09:39PM
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.

Hope that helps.
Sorry, only registered users may post in this forum.

Click here to login