Page 1 of 1

array became list in silent

Posted: Sat Jul 16, 2016 11:22 am
by ssqq
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

Re: array became list in silent

Posted: Sat Jul 23, 2016 3:43 am
by ssqq
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"))))