pop on strings

Started by newdep, January 22, 2007, 12:45:11 PM

Previous topic - Next topic

newdep

Im realy lost now !



It seems POP makes up its own mind when to POP an element or just pop away.. ;-)

( syntax: (pop str [int-index] [int-length]))







> (setq t "1234567890")

"1234567890"

> (pop t 1)

"2"

> t

"134567890"

> (pop t 1)

"3"

> t

"14567890"

> (pop t 1)

"4"

> t

"1567890"

> (pop t 4)

"890"

> t

"1567"

>







I realy did expect to see an "8" and not a "890" here...
-- (define? (Cornflakes))

nigelbrown

#1
Looks like it may be trying to pop n items from position n when n+n > stringlength

as (V9.0)

> (setq t "12345")  

"12345"

> (pop t 3)

"45"

> (setq t "12345")

"12345"

> (pop t 2)

"3"

> (setq t "1234567")

"1234567"

> (pop t 4)

"567"

> (setq t "1234567890")

"1234567890"

> (pop t 4)

"5"



Can't see immediately from code in nl-liststr.c why this should be.

Nigel

Lutz

#2
This will be fixed and uploaded shortly in version 9.0.18



Lutz



ps: 9.0.18 has been uploaded, Win32 installer tomorrow morning (EST)