MathGroup Archive 2008

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

Search the Archive

Re: A set of several questions

  • To: mathgroup at smc.vnet.net
  • Subject: [mg90212] Re: A set of several questions
  • From: yatesd at mac.com
  • Date: Wed, 2 Jul 2008 05:31:48 -0400 (EDT)
  • References: <g451va$pq7$1@smc.vnet.net>

Question 5:

I gave one answer in an earlier post, but given that it looks like you
want s to be a vector, perhaps you prefer the following (which will
work in older versions of Mathematica too) :

f[s:{a_,b_,c_,d_,e_,H1_,H2_},x_]:={s,a,b,c,d,e,H1,H2,x}

So in summary, you call you function with 2 arguments: a list and the
x argument. You can now refer to the entire list on the right hand
side by using s, and you can refer to the individual parts of the list
using a,b,c...

Personally, I would limit the use of 'structs' (as suggested in other
posts) to things which have some meaning together and will be used in
multiple functions. For example, I use ymd[year,month,day] to
represent dates, as I don't like the way Mathematica 6 represents them
using lists. I then wrote my own date arithmetic functions referring
to ymd[...] (the Mathematica date arithmetic functions are very slow
if you have a lot of dates)

Regards,

Derek


  • Prev by Date: Printing, WYSIWYG, and Window Magnification?
  • Next by Date: Re: Possible Bug in Mathematica 6
  • Previous by thread: Re: A set of several questions
  • Next by thread: Re: A set of several questions