POV-Ray : Newsgroups : povray.off-topic : Adventures with digital painting : Re: Adventures with digital painting Server Time
11 Oct 2024 07:15:14 EDT (-0400)
  Re: Adventures with digital painting  
From: Darren New
Date: 13 Mar 2008 16:34:43
Message: <47d99df3$1@news.povray.org>
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

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.