array became list in silent

For the Compleat Fan

array became list in silent

Postby ssqq » Sat Jul 16, 2016 11:22 am

When I add a array to list, then index it, it would became list in silent.

Code: Select all
newLISP v.10.7.0 32-bit on Windows IPv4/6 libffi, options: newlisp -h

> (array? ((list 1 (array 3 '(1 2 3)) 3) 1))   
nil
> (list? ((list 1 (array 3 '(1 2 3)) 3) 1))     
true


I think array as value, when transfer to expression, it should be in definitely.

When I add a list to array, then index it, it also is list
Code: Select all
> (list? ((array 3 '(1 (2 3) 4)) 1))
true
ssqq
 
Posts: 88
Joined: Sun May 04, 2014 12:49 pm

Re: array became list in silent

Postby ssqq » Sat Jul 23, 2016 3:43 am

concat two element, invoid array became list in silent
Code: Select all
(define (concat) (apply _concat (args)))
(define (_concat @x @y)
  (cond
    ((atom? @x)
     (cond
       ((atom? @y) (cons @x @y))
       ((array? @y) (cons @x @y))
       ((list? @y) (push @y (list @x) -1))
       (true (error "error concat data"))))
    ((array? @x)
     (cond
       ((atom? @y) (cons @x @y))
       ((array? @y) (cons @x @y))
       ((list? @y) (push @x (list @y)))
       (true (error "error concat data"))))
    ((list? @x)
     (cond
       ((atom? @y) (cons @x @y))
       ((array? @y) (cons @x @y))
       ((list? @y) (list @x @y))
       (true (error "error concat data"))))
    (true (error "error concat data"))))
ssqq
 
Posts: 88
Joined: Sun May 04, 2014 12:49 pm


Return to Anything else we might add?

Who is online

Users browsing this forum: No registered users and 3 guests

cron