options to functions
- To: mathgroup at smc.vnet.net
- Subject: [mg24042] options to functions
- From: Roger Mason <rmason at sparky2.esd.mun.ca>
- Date: Wed, 21 Jun 2000 02:20:03 -0400 (EDT)
- Organization: Memorial University of Newfoundland
- Sender: owner-wri-mathgroup at wolfram.com
Hi, I am writing a function inside a package and wish to pass options to it. For testing purposes I have this (inside the Private context of the package): Options[XRDCoordList] = {AtomName -> False} ... (some functions defined here ... This is the troublesome function... XRDCoordList[name_String, atom_List, transl_List, opts___?OptionQ] := Module[ { n = Length[atom], ans = {}, atomname }, atomname = AtomName /. { opts } /. Options[XRDCoordList]; Do[ AppendTo[ans, Map[atom[[i]] + # &, transl] ] , {i, 1, n}]; ans = Flatten[ ans ]; Do[If[ans[[i]] >= 1, ans[[i]] = ans[[i]] - 1](*If[ans[[i]] < 0, ans[[i]] = ans[[i]] + 1]*) , {i, 1, Length[ans]} ]; (*If[atomname, ans = Insert[ans, name, Table[n, {n, 1, Length[ans] - 3, 3} ] ]; Partition[ans, 4 ], Partition[ ans, 3 ]] *) atomname ] When I invoke it using ca = XRDCoordList["ca", {{0, 0, 0}, {0, 0, 1/2}}, cenTransl, AtomName -> True] // N it always returns False. I can't see what I've done wrong. Thanks, Roger Mason