Hi,

The arguments (x,y) to dqAppend are "double ended queue",
implemented as "head-tail linked list",
note that the car and cdr of x/y have shared cons cell,
for example:

(setq l1 '(a b c d e))
(setq x (cons l1 (last l1)))
(setq l2 '(k l m n o))
(setq y (cons l2 (last l2)))

(rplacd (cdr x) (car y)) ;; connects l2 to the end of l1
(rplacd x (cdr y)) ;; replace the end node of l1 by the end node of l2

;; now x is ((A B C D E K L M N O) O)

- Qian

On 9/26/21 23:12, Hill Strong wrote:
> 
> When looking at the function dqAppend found in the btscan2.boot file
> (given below)
> 
> dqAppend(x,y)==
>     if null x
>     then y
>     else if null y
>          then x
>          else
>               RPLACD (CDR x,CAR y)
>               RPLACD (x,    CDR y)
>               x
> what is the purpose of the line
> 
> RPLACD(CDR x,CAR y)
> 
> This appears to be entirely superfluous to the function. Is this
> correct? I have tried  these two lines in the interface on
> https://rextester.com/l/common_lisp_online_compiler with the following code
> 
> (setq l1 (list 'a 'b 'c 'd 'e))
> (print l1)
> (setq l2 (list 'k 'l 'm 'n 'o))
> (print l2)
> (rplacd (cdr l2) (car l1))
> (print l2)
> (rplacd l2 (cdr l1))
> (print l2)
> 
> and I get the results
> 
> (A B C D E)
> (K L M N O)
> (K L . A)
> (K B C D E)
> 
> Is this the expected results or is something else actually expected?
> 
> greetings
> 
> Hill Strong
> 
> -- 
> You received this message because you are subscribed to the Google
> Groups "FriCAS - computer algebra system" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to fricas-devel+unsubscr...@googlegroups.com
> <mailto:fricas-devel+unsubscr...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/fricas-devel/ea73f865-45d0-4ad7-b600-859f9f7db9b7n%40googlegroups.com
> <https://groups.google.com/d/msgid/fricas-devel/ea73f865-45d0-4ad7-b600-859f9f7db9b7n%40googlegroups.com?utm_medium=email&utm_source=footer>.

-- 
You received this message because you are subscribed to the Google Groups 
"FriCAS - computer algebra system" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to fricas-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/fricas-devel/2ac654f9-3111-072c-e599-b86bd4a7e01b%40gmail.com.

Reply via email to