POV-Ray : Newsgroups : povray.beta-test : [doc] concat with one parameter : Re: [doc] concat with one parameter Server Time
29 Jul 2024 16:24:06 EDT (-0400)
  Re: [doc] concat with one parameter  
From: Mark Weyer
Date: 27 May 2002 05:22:30
Message: <3CF1EDA4.6B5091DE@frege.mathematik.uni-freiburg.de>
I suppose, I did not make myself clear enough.
Of course there would be workarounds if concat(s) was
prohibited. The point is, that these are not as clearly readable
or writable any more. To provide a better example:

#macro foo_string(s)
  concat(
    ""
    #local i=0;
    #while (i<strlen(s))
      #local i=i+1;
      ,... //(do something longish with the i-th caharacter of s)
    #end
  )
#end

With your case distinction one would have to write the longish stuff
"..."
twice or declare a macro/function that does it.
The former is errorprone (consider changes later apllied to "...")
and not as readable (the human has to parse "..." twice).
The latter would introduce a macro/function to the namespace that will
probably never again be used and also inhibits fluent parsing by the
human.

But still, the point is not to argue over specific examples.
Concatenation is a binary operation that fulfills the axioms of monoids.

Hence it is canonically extendable to an operation taking lists of
strings as input.
As the povary team has decided to provide this generalization, it is
natural
to allow ALL lists of strings, especially one-element lists and the
empty list.
OK, I know the empty list, ie. concat(), is not permitted,
but that is a different story...

  Mark Weyer


Post a reply to this message

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