Numeric field
Richard Gaskin
ambassador at fourthworld.com
Mon Sep 1 11:07:00 EDT 2003
Charles Szasz wrote:
> Thanks to everybody who responded to my plea for help! Being new to
> Revolution, I really appreciate everyone being so helpful! I am a
> former REALbasic user who struggle with its complex programing
> language. Revolution is certainly easier but there is a lot to learn!
> I also have another question. In my RB project, I used a "container" to
> serve as a lookup table for correlations between intelligence and
> achievement tests. Is there similar procedure for Revolution that you
> can used for a lookup table?
Many options: you could use arrays, fields, custom properties, or
variables, each having advantages depending on the specifics of what you
want to do.
I think you'll find chunk expressions one of the most liberating things
about Rev, allowing you to use very simple syntax for rapid parsing of text
that would be cumbersome in any non-xTalk language -- here's an example of a
simple lookup that has a table stored in a tab-delimited list:
function GetStuff pSearchTerm, pLookupTable
set the itemdel to tab
set the wholematches to true
get lineoffset(pSearchTerm, pLookupTable)
return item 2 of line it of pLookupTable
end GetStuff
That last line is key: getting "lines" (return-delimited by default but
also user-settable) and "items" (comma-delimited by default but also
user-settable as shown above) along with "words" (space-delimited) and
"characters" is a snap in Transcript. In lower-level languages you need to
walk through the block of text, keeping track of delimiters as you go. But
in Transcript (and all other xTalks) this parsing is done dynamically using
highly-optimized C in the engine, giving you great ease of use without
sacrificing speed. In fact, for many common text operations Transcript
benchmarks faster than some lower-level languages, and usually in a fraction
of the number of lines of code needed to do the job.
Ah, but there are so many ways to do lookups. Can you tell us more about
how yours works?
--
Richard Gaskin
Fourth World Media Corporation
Developer of WebMerge: Publish any database on any Web site
___________________________________________________________
Ambassador at FourthWorld.com http://www.FourthWorld.com
Tel: 323-225-3717 AIM: FourthWorldInc
More information about the use-livecode
mailing list