Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
1999
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 1999

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

Search the Archive

Re: Defining a function P[A_ | B_]:=f[A,B] overriding Alternatives

  • To: mathgroup at smc.vnet.net
  • Subject: [mg19287] Re: Defining a function P[A_ | B_]:=f[A,B] overriding Alternatives
  • From: Eckhard Hennig <hennig at itwm.uni-kl.de>
  • Date: Sat, 14 Aug 1999 01:45:13 -0400
  • Organization: ITWM
  • References: <7oojvg$i35@smc.vnet.net> <7or3jp$o6@smc.vnet.net> <7ouvht$osf$1@dragonfly.wolfram.com>
  • Sender: owner-wri-mathgroup at wolfram.com

Allan Hayes schrieb in Nachricht <7ouvht$osf$1 at dragonfly.wolfram.com>...
>Eckhard:
>Following your idea  n the posting below:
>
>p[HoldPattern[Alternatives][A_ , B_]] := {A, B}
>
>DownValues[p]
>
>{HoldPattern[p[HoldPattern[Alternatives][A_, B_]]] :> {A, B}}
>
>p[a | b]
>
>{a, b}
>
>Allan


Of course, that's the straightforward way to do this. However, the
originator of this thread (Peltio) wrote the following:

>And yet I wanted to be able to define my function without showing the
>Alternatives /: part.

Therefore, I suppose that Peltio's intention was to be able to define p[A_ |
B_] without any explicit manipulation of the behavior of Alternatives. This
can only be achieved by rewriting the DownValues of p.

-- Eckhard

-----------------------------------------------------------
Dipl.-Ing. Eckhard Hennig      mailto:hennig at itwm.uni-kl.de
Institut fuer Techno- und Wirtschaftsmathematik e.V. (ITWM)
Erwin-Schroedinger-Strasse,  67663 Kaiserslautern,  Germany
  Voice: +49-(0)631-205-3126    Fax: +49-(0)631-205-4139
    http://www.itwm.uni-kl.de/as/employees/hennig.html

     ITWM - Makers of Analog Insydes for Mathematica
        http://www.itwm.uni-kl.de/as/products/ai
-----------------------------------------------------------






  • Prev by Date: Re: Win32 MathLink .exe from Matheamtica 3 on a Mac
  • Next by Date: Re: Subscripts, Doh!!!
  • Previous by thread: Re: Defining a function P[A_ | B_]:=f[A,B] overriding Alternatives
  • Next by thread: Gaussian PDF Overlay