MathGroup Archive 2000

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

Search the Archive

Re: What makes things Listable?

  • To: mathgroup at
  • Subject: [mg26325] Re: [mg26302] What makes things Listable?
  • From: "Carl K. Woll" <carlw at>
  • Date: Tue, 12 Dec 2000 02:54:41 -0500 (EST)
  • References: <>
  • Sender: owner-wri-mathgroup at

Hi Chris,

The old way (before version 4.0) to apply Value to a list the way you want
to do is to map a pure function as in


In version 4.0 they created a shortcut, so simply


will give you the result you're looking for.

One other note. Your subject line asks what makes things listable. Listable
is an attribute, which you can set through the SetAttributes command, as in

SetAttributes[Value, {Listable}]

In your example, though, giving Value the Listable attribute would not help

Carl Woll
Physics Dept
U of Washington

----- Original Message -----
From: "Chris Johnson" <cjohnson at>
To: mathgroup at
Subject: [mg26325] [mg26302] What makes things Listable?

> I'm using the "Finance Essentials" package and want to use the Value
> command over a list of bonds.  For those not familiar with the package,
> there is a structure called Bonds which defines the coupon, maturity,
> etc. for a bond.  The Value command takes three arguements, Bond,
> SettlementDate, YieldToMaturity and returns a price.
> Having vectors of Bonds, Dates, and Yields, I want to create a vector
> of prices.  My first guess was to try the following command:
> Value[Transpose[{bondlist,datelist,yields}]]
> This returned the result
> Value[{{bond[1],valdate[1],yield[1]},...}]
> My next step was to use Map[Value,Transpose[...]] which returned a list
> like {Value[{bond,valdate,ytm}],...} where the parameters for Value are
> surrounded by curly braces.  Value wouldn't evaluate over parameters in
> this form.
> The solution I found for now is to create my own fuction
> cjValueList[{x_,y_,z_}]:=Value[x,y,z]
> and then mapping cjValueList provides the table I seek.  I have run into
> this general problem of wanting to get rid of the outer level of curly
> braces before, and wonder if there is a more general solution then this
> hack redefinition of the function?
> Thanks,
> Chris Johnson

  • Prev by Date: Re: from Visual Basic To Mathematica through JLink: examples and problems
  • Next by Date: Re: inner angle of a triangle in the 4th dimension
  • Previous by thread: What makes things Listable?
  • Next by thread: Re: What makes things Listable?