Re: Re: All combinations
- To: mathgroup at smc.vnet.net
- Subject: [mg47457] Re: [mg47445] Re: All combinations
- From: Andrzej Kozlowski <akoz at mimuw.edu.pl>
- Date: Tue, 13 Apr 2004 06:26:09 -0400 (EDT)
- References: <200404061036.GAA09271@smc.vnet.net> <c50agl$mua$1@smc.vnet.net> <200404120744.DAA24259@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
*This message was transferred with a trial version of CommuniGate(tm) Pro* On 12 Apr 2004, at 16:44, Harold Noffke wrote: > Andrzej: > > Where is the form "S_List" documented? What does this notation, with > the underscore embedded between two strings, signify? I don't recall > seeing it before. > > Thanks. > Harold > > > It represents a pattern named S whose head is List. If you define a function f using f[S_List]:= body then f[something] will return the result of substituting evaluated something into body only if evaluated something has head S, otherwise the LHS will be returned unevaluated. This has many uses. One is that you cna define f to use a different rule for different heads, e.g. f[S_List]:= body1 f[S_]:=body2 will use body1 only for lists and body2 for everything else. Another use is to prevent your function form trying to work on input for which it does not make sense. Andrzej
- References:
- All combinations
- From: János <janos.lobb@yale.edu>
- Re: All combinations
- From: Harold.Noffke@wpafb.af.mil (Harold Noffke)
- All combinations