|
|
Invisible wrote:
> I'm pretty sure I remember several occasions where if a certain
> expression happened to return only 1 item, it tried to interpret the
> item as a list. IOW, when the expression finds multiple matches,
> everything works fine, but when it finds exactly 1 match it malfunctions
> horribly. Took me ages to figure out why...
You would need to either return a list, or return one item. If you want
to return either, you need to return a list of one item. Otherwise, yes,
if you sometimes return a list, and sometimes return one item that looks
like a malformed list, then you're going to confuse yourself.
if {$count > 1} {return $a}
if {$count == 1} {return [list $singleton]}
# Wrong:
# if {$count == 1} {return $singleton}
--
Darren New / San Diego, CA, USA (PST)
"That's pretty. Where's that?"
"It's the Age of Channelwood."
"We should go there on vacation some time."
Post a reply to this message
|
|