× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



From: Scott Klement

I don't understand. Why do you think this would be easier to do in RPG
than it is in CL? What would you do differently in RPG than you'd do
with a CL solution?

The way I read it was that there is an "alpha sequence number", which means
to me a number of characters that could spin, sort of like an odometer, only
through alpha numbers.

The way I would do it would be to have a string of characters that I could
"increment" through, such as 'ABCDEFGHI...XYZ'. Then I'd take the current
value, and starting at the right-most character, I'd find it's position in
the array using the %scan BIF and add one to it. If the resulting position
was longer than the array, I'd set a "carry" flag and then set the position
of the rightmost character to 1. If the carry flag was set, I'd do the same
thing for the next position to the left.

// RIGHTCHAR = index of rightmost character to spin
// CHARS_THAT_SPIN = number of characters that spin
// SPINCHARS = field initialized to characters to spin through
I = RIGHTCHAR;
Dou NOT carry;
X = %scan(%subst(field:I:1):SPINNER);
If X = 0;
// FATAL ERROR
Elseif X = %Len(SPINNER);
Carry = *on;
X = 1;
Else;
X = x + 1;
Endif;
%subst(field:I:1) = %subst(SPINNER:X:1);
I = I - 1;
If (RIGHTCHAR - I) > CHARS_THAT_SPIN;
// OVERFLOW
Endif;
Enddo;


I'm not sure how I'd do that in CL. I mean, it COULD be done, but it would
be pretty ugly, especially replacing the %scan BIF.

Am I missing something obvious, Scott?

Joe



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.