MathGroup Archive 2011

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

Search the Archive

Re: can't find info about & /@ %

  • To: mathgroup at smc.vnet.net
  • Subject: [mg121914] Re: can't find info about & /@ %
  • From: Murray Eisenberg <murray at math.umass.edu>
  • Date: Thu, 6 Oct 2011 04:24:43 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • References: <201110050759.DAA06921@smc.vnet.net>
  • Reply-to: murray at math.umass.edu

Didn't you try searching for any of those symbols in the Documentation 
Center? For example, searching for /@ brings up a single search result, 
for Map, and if you go to the reference page for Map you'll see what it 
does and that /@ is a "special input form" -- a shortcut -- for using Map.

Similarly for the others.

In any case, here's the explanation:

   (1) [Options[#, "ColorSpace"]& is a "pure function" -- a function 
with no name -- as the trailing "&" indicates. It takes a single 
argument, which gets stuck into where the "Slot" symbol # is.

   (2) % is another shortcut, standing for the preceding output. 
Presumably here that preceding output was a list of some kind.

   (3) fn /@ lis, a shortcut for Map[fn, lis] evaluates the function fn 
at each member of the list lis and assembles all the results back into a 
list.  (Map is actually more general than that.)

Hope this helps.

On 10/5/11 3:59 AM, Richard Cohen wrote:
> First[Options[#, "ColorSpace"]&  /@ %]
> could someone please explain the use of these&  /@ %
> i've looked everywhere to no avail.
> rich
>

-- 
Murray Eisenberg                     murray at math.umass.edu
Mathematics & Statistics Dept.
Lederle Graduate Research Tower      phone 413 549-1020 (H)
University of Massachusetts                413 545-2859 (W)
710 North Pleasant Street            fax   413 545-1801
Amherst, MA 01003-9305



  • Prev by Date: Re: simplification
  • Next by Date: Re: can't find info about & /@ %
  • Previous by thread: Re: can't find info about & /@ %
  • Next by thread: Re: can't find info about & /@ %