MathGroup Archive 2000

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

Search the Archive

What makes things Listable?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg26302] What makes things Listable?
  • From: Chris Johnson <cjohnson at shell.faradic.net>
  • Date: Sun, 10 Dec 2000 00:20:11 -0500 (EST)
  • Sender: owner-wri-mathgroup at wolfram.com

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: Getting coordinates of array member
  • Next by Date: Re: Mathlink probs under Unix
  • Previous by thread: Re: "?" to find symbols
  • Next by thread: Re: What makes things Listable?