Code Select
> (set 'nan (sqrt -1))
> (number? nan)
true ;; should return nil
Also advise with inf. I think all NaN and Inf are "error status" that may not throw error immediatly.
So they isn't value.
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
Show posts Menu
(define (foo x y) (+ x 1))
(define (foo x) (+ x y))
(define (foo x) (set 'y 10) (+ x y))
> (my @array [])
[]
> (@array << :a)
[:a]
> (my %hash {1 : 2, 3 : 4})
{1 ; 2, 3 : 4}
> (%hash 1)
2
> (my @lst :(1 2 3))
(1 2 3)
newlisp -x lint.lsp lint
chmod 755 lint
sudo mv lint /usr/bin/lint
newlisp -x tidy.lsp tidy
chmod 755 tidy
sudo mv tidy /usr/bin/tidy
(define (is-blank-array x) (= x '()))
(define (is-list x) (list? x) (and (= (first x) "list") (list? (last x))))
(define (is-blank-hash x) (= x '(())))
(define (is-hash @x)
(and (list? @x) (for-all is-pair @x)))
(define (is-pair @x)
(and (list? @x) (= 2 (length @x)) (is-key (@x 0))))
(define (is-key @x) (or (string? @x) (number? @x)))
(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"))))
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
> (list? ((array 3 '(1 (2 3) 4)) 1))
true