Re: PIZZA time again :-)

From: dawn <dawnwolthuis_at_gmail.com>
Date: 2 Sep 2005 21:05:59 -0700
Message-ID: <1125720359.696513.205180_at_z14g2000cwz.googlegroups.com>


mAsterdam wrote:
> dawn wrote:
> > mAsterdam wrote:
> >>dawn wrote:
> >>>mAsterdam wrote:
> >>>>>>Assume
> >>>>>>1. there is a meaningful (or at least consequential)
> >>>>>>difference between:
> >>>>>>
> >>>>>> toppings([salami, mozarella, onions]).
> >>>>>> and
> >>>>>> toppings([mozarella, onions, salami]).
>
> [snip]
>
> >>>>Consider
> >>>>
> >>>> merge(ListOfLists, MergedList).
> >>>>
> >>>>Now
> >>>>
> >>>>merge ([[salami, mozarella, onions][mozarella, onions, salami]], M).
> >>>>
> >>>>should fail because salami is before mozarella in the first list,
> >>>>and after it in the second. It can't preserve the order.
> >>>
> >>>I don't know how you define a merge when there isn't
> >>>an ordering defined on the type.
> >>>Is there such a function? Your lists are ordered here,
> >>>but your domain/type is not, unless you choose something
> >>>like alpha order.
> >>
> >>That is another way of asking the same question.
> >>What should 'merge' do when the order is not
> >>in the values (as it would be if we took the
> >>ordering defined on the type) but just in
> >>their position, relative to other values.
> >>It is what I'm trying to find out.
> >
> > Perhaps it should do the same thing as a sort on a set where no
> > ordering has been defined - ?
>
> Which would be - in the context of lists?

it seems like you are asking for
sort ([[salami, mozarella, onions] intersect [mozarella, onions, salami]], M).

sort based on what ordering? You could define the ordering to be whatever the first list has as the ordering unless that information is missing from the first in which case you need to use the second, enzovoort. But I'd say that it would be better to choose a word other than 'sort' for this new operation.

> Could you please (try to) translate what you mean onto
> the realm of lists?

My point is that you cannot merge these two lists with the information provided because the ordering on these two lists does not define a unique ordering of the domain of the intersection (or union) of these lists. On the other hand, maybe someone has expanded the use of the term 'merge' and I'm just being ignorant.

> >>>I can imagine an interleave function that alternates ingredients from
> >>>both lists and yields a pizza with salami on it twice (I think I'll
> >>>pass on it, however). --dawn
> >>
> >>So that is not the desired behaviour.
> >>The resulting pizza will be richer than the
> >>originals, but I would like to see one you
> >>would like to eat.
> >
> > I'd like plenty of mozarella, olives (black or green), tomatoes, and
> > maybe even some pepperoni on either a whole wheat crust or a thin crust
> > -- oh, and pineapple too. The ordering does make a difference, as does
> > the city in which I'm eating the pizza -- in Chicago I'm OK with
> > reversing the order and adding sausage to the pizza. I'm sitting in
> > the biggest pork producing county in the U.S. right now and people
> > order pizza with "swine" on it here.
> >
> > I talked students through a pizza example from the Head Frist Design
> > Patterns book last year -- a fun book for anyone wanting to teach or
> > learn OO design patterns.
> >
> > cheers! --dawn
>
> You already know you are welcome to enjoy the best pizzas
> in Amsterdam whenever you feel like coming here :-)

Careful -- you are bordering on flirtation there, and I'm from stoic Dutch roots. My people have populated some of the most conservative areas in the U.S. having left the Netherlands because of the immorality in cities such as Amsterdam. (Now they can only participate in such activities when making a pilgrimage back to the motherland.) Received on Sat Sep 03 2005 - 06:05:59 CEST

Original text of this message