POV-Ray : Newsgroups : povray.beta-test : [doc] concat with one parameter : Re: [doc] concat with one parameter Server Time
29 Jul 2024 16:19:31 EDT (-0400)
  Re: [doc] concat with one parameter  
From: Mark Weyer
Date: 27 May 2002 03:56:55
Message: <3CF1D995.76359CAA@frege.mathematik.uni-freiburg.de>
Felix Wiemann wrote:

> #debug concat("POV")
>
> works fine, but the doc says:
>
> concat(S1,S2,...)
>
> IMO the doc and not the function should be changed because this is a useful
> feature ...

I agree this is a useful feature, although for different reasons.
Consider the following macro:

#macro reverse_string (s)

concat(
  ""
  #local j=strlen(s);
  #while (j>0)
    ,substr(s,j,1)
    #local j=j-1;
  #end
)

#end

It is essential for use with the empty string that concat still works with
only one parameter. This macro is a quick hack and probably not the
best way to reverse a string, so consider it just an example.

  Mark Weyer


Post a reply to this message

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