For Programmers: Free Programming Magazines  


Home > Archive > Fortran > August 2005 > Re: Reduce Blanks challenge









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: Reduce Blanks challenge
robin

2005-08-21, 6:57 pm


David Frank wrote in message ...
>we can go on to a 2nd challenge thats been running concurrently over in
>comp.lang.fortran.
>Posted only for PLI'er info, there wont be a PL/I translation.
>
><<<<<<<
>Since its my challenge I am narrowing the acceptable solutions in reduce.f90
>as follows:
>
>1. the output string must contain a blank last char (if input string has 1
>or more trailing blanks)
> by output of a null char after just 1 trailing blank char is output.
>2. the solution must use array syntax, no scalar processing with do loops
>3. Fast/Legible/Brief is a goal.
>
>My current solution that meets these revised specs, uses 3 statements:



This does not meet your specification:
Line 2 uses a user function of 19 statements (fails spec #3).

>pad = char(0) ! allow pack to use null chars to pad its output
>a = Copy(line) ! copy line to char array
>outline = line(1:1) // Copy( PACK(a(2:), a(2:)/=' '.or.a(1:)/=' ',pad) )



Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2009 codecomments.com