MathGroup Archive 2006

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Curiosity concerning transformation rules for List

  • To: mathgroup at smc.vnet.net
  • Subject: [mg70899] Re: [mg70860] Curiosity concerning transformation rules for List
  • From: János <janos.lobb at yale.edu>
  • Date: Wed, 1 Nov 2006 03:55:11 -0500 (EST)
  • References: <200610301032.FAA13307@smc.vnet.net>

On Oct 30, 2006, at 5:32 AM, Andrew Moylan wrote:

> Since the List symbol is locked, I am curious about the possibility  
> (or
> otherwise) of giving definitions for which the left-hand-side of the
> transformation rule contains only the List symbol. Here's an  
> arbitrary,
> explicit example:
>
> Is it possible to make a definition such that: any list of two
> identical elements evaluates to the empty list? E.g. {x_, x_} -> {}.
>
> I can't see any way this transformation rule can be added. It's not
> possible to modify the DownValues for List; and there are no
> first-level symbols to which an UpValue can be added. Does anyone have
> any ideas?

Here is a newbie approach:

In[11]:=
lst = {{2, 2}, {1, 5},
    {5, 6}, {8, 3}, {1, 5},
    {5, 5}}
Out[11]=
{{2, 2}, {1, 5}, {5, 6},
   {8, 3}, {1, 5}, {5, 5}}

In[12]:=
lst /. {x_, x_} -> {}
Out[12]=
{{}, {1, 5}, {5, 6}, {8, 3},
   {1, 5}, {}}

Unless I misunderstood...

János


----------------------------------------------
Trying to argue with a politician is like lifting up the head of a  
corpse.
(S. Lem: His Master Voice)


  • Prev by Date: Re: Counting Symbols
  • Next by Date: Re: Expanding logical expressions
  • Previous by thread: Re: Curiosity concerning transformation rules for List
  • Next by thread: Re: Curiosity concerning transformation rules for List