array became list in silent

Started by ssqq, July 16, 2016, 04:22:46 AM

Previous topic - Next topic

ssqq

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



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

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

ssqq

#1
concat two element, invoid array became list in silent

(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"))))