1. How to Do Strings Now

-- stringlib.e

sequence stringlist
stringlist = {}

global function aString( sequence x ) -- "a[ssign] String"
-- do checking to make sure x is 1-Dimensional
    stringlist = append(stringlist, x)
    return length(stringlist)
end function

global procedure pStr( atom strNum ) -- p[rint] Str[ing]
    puts(1, stringlist[strNum] )
end procedure

myStr = aString( "EUPHORIA rocks!" )

pstring( myStr )

Or, maybe better, you could go whole hog and do:

global function aVar( atom varType, object varValue ) -- create a new variable
of given type
   --...
end function

global procedure pVar( atom varNum ) -- print the variable
   if stringlist[varNum][VARTYPE] = VAR_STRING then
        --etc...
   end if
end procedure

-- all locals will be integers now... weird. :)
integer x, y
sequence x2

x = aVar( STRING, "Initial Value, if any" )
y = aVar( INTEGER, 123 )

pVar( x )
pVar( y )

-- maybe even...
sequence x2
x2 = pGet( x )

etc...

Fun fun fun! :)

new topic     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu