Hello,
I was wondering whether there is anyone who can help me to override this
error message.
>(check n1 200)
Error: NIL is not of type (OR RATIONAL FLOAT).
Error signalled by <.
(defun check (qnode num_of_sweeps)
(let ((counter 0))
(do ((i 0 (+ i 1)))
((mapc #' (lambda (n)
(cond
((null (node-clamped (eval n)))
(let ((p (node-clamped (eval n)))
(q (prob (eval n))))
(cond ((< p q) (setf (node-tvalue (eval n)) t))
(t (setf (node-tvalue (eval n)) nil)))))))
*node_list*))
(cond ((equal t (node-tvalue qnode)) (+ counter 1)))
((equal i num_of_sweeps) (/ counter i)))))
And here's are the declarations for:
(set *node_list* '(n1 n2 n3 n4 n5 n6 n7))
;; Data Structure for node
(defstruct node tvalue matrix causes effects clamped)
;; Setting each node up with associated values
(setq n1 (make-node :tvalue t
:matrix '()
:causes '()
:effects '(n3 n4)
:clamped t))
.
.
.
etc
Thank you very much.
I would be much appreciated if you could email to me.
Thank you very much,
Doreen
In article <·················@hotmail.com>,
Cookie Monster <····@cs.man.ac.uk> wrote:
>Hello,
>
>I was wondering whether there is anyone who can help me to override this
>error message.
>
>>(check n1 200)
>
>Error: NIL is not of type (OR RATIONAL FLOAT).
>Error signalled by <.
> (cond
> ((null (node-clamped (eval n)))
only take this condition when (node...) is NIL.
> (let ((p (node-clamped (eval n)))
bind NIL (i.e., (node...) ) to p.
> (cond ((< p q) (setf (node-tvalue (eval n)) t))
(< NIL q ) which fails.
Perhaps you only want to take this condition when (node...) is
not NIL. Or bind P to some number.
>
>(set *node_list* '(n1 n2 n3 n4 n5 n6 n7))
>
I imagined this is
(setq *node_list* '(n1 n2 ..... ))
Note you probably should consider
(setq *node_list* (list n1 n2 n3 .... ) )
And then chuck all of those calls to EVAL; just simply use N.
Unless you need the globals variables n1, n2, etc. elsewhere.
--
Lyman S. Taylor "Computers are too reliable to replace
(·····@cc.gatech.edu) humans effectively."
Commander Nathan Spring, "Starcops"
Cookie Monster <····@cs.man.ac.uk> writes:
> Hello,
>
> I was wondering whether there is anyone who can help me to override this
> error message.
>
> >(check n1 200)
>
> Error: NIL is not of type (OR RATIONAL FLOAT).
> Error signalled by <.
>
>
> (defun check (qnode num_of_sweeps)
> (let ((counter 0))
> (do ((i 0 (+ i 1)))
> ((mapc #' (lambda (n)
> (cond
> ((null (node-clamped (eval n)))
> (let ((p (node-clamped (eval n)))
> (q (prob (eval n))))
> (cond ((< p q) (setf (node-tvalue (eval n)) t))
> (t (setf (node-tvalue (eval n)) nil)))))))
> *node_list*))
> (cond ((equal t (node-tvalue qnode)) (+ counter 1)))
> ((equal i num_of_sweeps) (/ counter i)))))
From the code below, it seems that 'node-clamped' returns either 't'
or 'nil'. That is your main problem. The second problem is the use of
'eval'. First, I'd substitute them with '(symbol-value n)', next I'd
look for a different solution based on a separate repository for nodes.
>
>
> And here's are the declarations for:
>
> (set *node_list* '(n1 n2 n3 n4 n5 n6 n7))
>
> ;; Data Structure for node
> (defstruct node tvalue matrix causes effects clamped)
>
> ;; Setting each node up with associated values
> (setq n1 (make-node :tvalue t
> :matrix '()
> :causes '()
> :effects '(n3 n4)
> :clamped t)) <=== This seems to be a generalized
boolean.
>
Cheers
--
Marco Antoniotti ===========================================
PARADES, Via San Pantaleo 66, I-00186 Rome, ITALY
tel. +39 - (0)6 - 68 10 03 17, fax. +39 - (0)6 - 68 80 79 26
http://www.parades.rm.cnr.it