a qustion about string length

Started by mostlywrong, January 09, 2009, 03:15:26 PM

Previous topic - Next topic

mostlywrong

reading through the docs and forums i found that the max string length

is 2048 and needs to be enclosed inside [text] [/text] tags.



I'm thinking that i misunderstood something, because reading about

processing web pages I'm sure there are times that strings are longer

than 2048.



So what did i miss or misunderstand ?p.

newdep

#1
Hi,



the [text] [/text] quote you only need when you are creating texts

(>2048 chars) that should be i.e. printed to IO..



newlisp itself automaticly handles string size. If you processing a webpage

you dont have to bother about the size.



if you use i.e. get-url and would output it to the screen you

will see that newlisp automaticly marks it as [text]..[/text]..as

a referance that its 2048 long(er)...



Regards, Norman.
-- (define? (Cornflakes))

DrDave

#2
Quote from: "mostlywrong"reading through the docs and forums i found that the max string length

is 2048 and needs to be enclosed inside [text] [/text] tags.



I'm thinking that i misunderstood something, because reading about

processing web pages I'm sure there are times that strings are longer

than 2048.



So what did i miss or misunderstand ?p.

As with any new language, it takes a little time to figure out how to effectively search the docs.



From the manual:
QuoteStrings may contain null characters and can have different delimiters. They evaluate to themselves.



"hello"             →"hello"  

"32326532"  →"  A "

"x20x20x41x20"  →"  A "

"trn"            →"trn"

"x09x0dx0a"      →"trn"



;; null characters are legal in strings:

"000102"       → "000102"

{this "is" a string} → "this "is" a string"

 

;; use [text] tags for text longer than 2048 bytes]

[text]this is a string, too[/text]

→ "this is a string, too"


You'll also get used to the parentheses. I often use a lot of extra lines to keep track of them:



(setq result (div                        
                  (mul 100
                       (add
                            (div range 2)
                             val
                       )
                  )
                  range
              )
)

same as

(setq result (div (mul 100 (add (div range 2) val)) range))

I find it much easier to scan through the code and see the arguments that are used with div, mul, add, div when it is not strung together in a single line.
...it is better to first strive for clarity and correctness and to make programs efficient only if really needed.

\"Getting Started with Erlang\"  version 5.6.2

mostlywrong

#3
ok, i just misread the docs. what it said was text constants (more or less) in the code need to be tagged for the processor if larger than 2048 chars. got it.