Hi everyone,
I've been busy these last 3 weeks with the "optimizations" for my
project. It's in quotes because I still don't have accurate metrics on
comparison between old and new system. Still, I've taken a lot of the
advice here in the forum and it will work ... for better or worse.
Hehehehehe. Actually, I will find out because my project is scheduled
for QA starting first week of November.
So now to one of the things that bothers me with my project.
A few years back, I've asked this same forum on how to convert strings
to numbers and back again. There were a lot of suggestions but the
tricky part was going back again from number to the original string.
Right now, my current solution is save the string as a boxed item into a
vector and return the vector position as its numeric equivalent like so:
NB. Initialize global variable
LOOKUP_z_=: '';'0';'1';'2';'3';'4';'5';'6';'7';'8';'9';' '
NB. This method returns the numeric position of the string in the vector
searchLOOKUP=: 3 : 0
NB. Make sure that we work with boxed data
data=. <^:(L. = 0:) y
NB. Make sure that the lookup vector contains unique values
LOOKUP_z_=: ~. LOOKUP_z_ ,~. data
NB. Just return the index position of the matching data
LOOKUP_z_ i. data
)
Playing with this we get:
LOOKUP
++-+-+-+-+-+-+-+-+-+-+-+
||0|1|2|3|4|5|6|7|8|9| |
++-+-+-+-+-+-+-+-+-+-+-+
NB. converting from string to numbers
searchLOOKUP ;: 'The quick brown fox jumped'
12 13 14 15 16
searchLOOKUP 'fox'
15
searchLOOKUP 'Fox'
17
NB. converting from numbers to string
4 14 15 { LOOKUP
+-+-----+---+
|3|brown|fox|
+-+-----+---+
Any ideas how to do this better?
Thanks.
r/Alex
P.S.
I've taken the plunged and formatted my Lenovo T61 with Ubuntu 8.04 and
installed WindowsXP on a virtual machine. The only hair pulling part is
getting Evolution to use MS-Exchange's OWA access. Up to now, I still
can't get my Global Address List. Grrrr.
--
"The right questions are more important than the right answers to the
wrong questions."
-Dr. John Romagna
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm