Services & Resources / Wolfram Forums
MathGroup Archive
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2005

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

Search the Archive

Pattern matching at bottom depth

  • To: mathgroup at
  • Subject: [mg63336] Pattern matching at bottom depth
  • From: "Barthelet, Luc" <lucb at>
  • Date: Sat, 24 Dec 2005 07:19:02 -0500 (EST)
  • Sender: owner-wri-mathgroup at

I have a function Foo (attribute hold) that will take 3D Points as
arguments either in a list or a list of lists.

So I can call:




Now, I would like to pattern match the triplets, so that I can run a
transformation (transform[u]) on them before releasing the hold on Foo.

Currently I do it with 2 rules and the conditional use of dimensions.

Foo [u_ /; Length[Dimensions[u]] == 2] :> Foo [transform /@ u],
Foo [u_ /; Length[Dimensions[u]] == 3] :> Foo [Map[transform, u,{2}]]

Is there a better way to do this?



  • Prev by Date: substitute for Do loop
  • Next by Date: Questions regarding MatrixExp, and its usage
  • Previous by thread: substitute for Do loop
  • Next by thread: Re: Pattern matching at bottom depth