impliciting indexing doesn't cross list/string boundaries

Q&A's, tips, howto's

impliciting indexing doesn't cross list/string boundaries

Postby TedWalther » Sun Aug 09, 2015 10:16 pm

I have this:

(set 'foo '("#foo" "bar" "baz" "some text"))


I expected this to work:

(foo 0 0) => "#"


Instead it returned "#foo". A bit surprising. I know that (foo 0) works as a list index; is newlisp supposed to ignore bogus indexes afterward? Either newlisp should cross the list/string boundary and let the index apply to the string or array equally with the list, or return an error, no?

Using version 10.6.2
Cavemen in bearskins invaded the ivory towers of Artificial Intelligence. Nine months later, they left with a baby named newLISP. The women of the ivory towers wept and wailed. "Abomination!" they cried.
TedWalther
 
Posts: 605
Joined: Mon Feb 05, 2007 1:04 am
Location: Abbotsford, BC

Re: impliciting indexing doesn't cross list/string boundarie

Postby TedWalther » Sun Aug 09, 2015 10:44 pm

This one did work: (first (foo 0))
Cavemen in bearskins invaded the ivory towers of Artificial Intelligence. Nine months later, they left with a baby named newLISP. The women of the ivory towers wept and wailed. "Abomination!" they cried.
TedWalther
 
Posts: 605
Joined: Mon Feb 05, 2007 1:04 am
Location: Abbotsford, BC


Return to newLISP in the real world

Who is online

Users browsing this forum: No registered users and 1 guest

cron