Keyword_set() (was: Re: Fitting curves) [message #2867] |
Tue, 06 September 1994 06:49 |
ryba
Messages: 33 Registered: October 1992
|
Member |
|
|
In article <34h7oi$aa1@aragorn.unibe.ch>, larkum@iam.unibe.ch (Matthew Larkum) writes:
|> Specifically, his procedure uses the keyword FUNCTION_NAME which is a
|> string that gives the name of the procedure to be used in place of FUNCT.
|> This is a much better idea, but it isn't part of the procedure we got
|> with our version of PV-Wave version 4.2.
|>
|> On the other hand, I liked the modifications made by Amara Graps in his
|> version of CURVEFIT, so I put in the (trivial) code to include the
|> FUNCTION_NAME keyword into CURVEFIT and the resulting MYCURVEFIT is
|> given below.
|>
|> if not keyword_set(function_name) then function_name = 'FUNCT'
Wrong!!! Keyword_set should *only* be used for keyword parameters,
which can take the values of 0,1 or undefined. You should use:
IF n_elements(function_name) EQ 0 THEN function_name = 'FUNCT'
With a string argument, you're probably safe, but this subtlety may bite
you sometime if you're not careful.
--
Dr. Marty Ryba | Generation X:
MIT Lincoln Laboratory | Too young to be cynical,
ryba@ll.mit.edu | too old to be optimistic.
Of course nothing I say here is official policy, and Laboratory affiliation is
for identification purposes only, blah, blah, blah....
|
|
|