pop on strings

Q&A's, tips, howto's
Locked
newdep
Posts: 2038
Joined: Mon Feb 23, 2004 7:40 pm
Location: Netherlands

pop on strings

Post by 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
Posts: 429
Joined: Tue Nov 11, 2003 2:11 am
Location: Brisbane, Australia

Post by nigelbrown »

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
Posts: 5289
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California
Contact:

Post by Lutz »

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)

Locked