Re: printing logical variables as "true" and "false"





Richard E Maine wrote:

Richard E Maine <nospam@xxxxxxxxxxxxx> wrote:


The implementation of my logical_thing might well have your merge
incantation as its sole executable line.


Though on thinking slightly more on it, a more "interesting" version
might be one that returned a "minimum-width" length instead of padding.
Doing that is left as an exercise for the reader, the main part of the
excercise being to make sure to stay within the standard's requirements
for specification expressions. I haven't tried the exercise myself;
shouldn't be too hard, but spec expressions are tricky enough that I
wouldn't be confident of getting it right without pulling out the
standard to check.

I suppose that in f2003 one could just make the function result an
allocatable-length string, but that's too easy.  :-) Sometimes I think
that allocatable-length strings, which were almost an unintended but
welcome side effect of other features, might turn out to be one of the
most popular new things in f2003.

Heck, you don't need anything that fancy. A simple
statement function gives a simple solution (that's probably
what you had in mind as an "exercise for the reader", right ;) ). Otherwise you could use a function like notation
and use the f2003 defined output stuff which avoids tricky
spec expressions and allocatable-length strings but lets you
do all kinds of fancy variable width output.


*** Hendrickson

PS:  It's a pretty slow day here.

.


Quantcast