TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: xiaobizhang on July 25, 2015, 02:01:21 PM

Title: Result sort
Post by: xiaobizhang on July 25, 2015, 02:01:21 PM
Code - Auto/Visual Lisp: [Select]
  1. ;;;known
  2. (setq l1'('(3 10) '(2 15) '(1 22))
  3.      l2 '('('(3) '(1))
  4.           '('(2 2))
  5.           '('(2) '(1 1))
  6.           '('(1 1 1 1))
  7.           '('(1 1 1)))
  8.       )
  9. ;;;Result
  10. (setq l3 '('('(3) '(1))  10)    ;According L2 ['('(3) '(1))]=>     '((3 10) (1 20)) [Because (gcd 10 20)=10] => '( '((3) (1))  10) and Surplus '(1 12)
  11.          '('('(2 2))  7)        ;According L2 ['('(2 2))]=>        '('(2 15)) => '( '('(2 2)) 7) and Surplus '(2 1)
  12.          '('('(2) '(1 1))  1)   ;According L2 ['('(2) '(1 1))]=>    Surplus '(2 1) + Surplus '(1 12) [Because (gcd 1 12)=1] => '('('(2) '(1 1))  1)  and Surplus '(1 10)
  13.          '('('(1 1 1 1)) 2)     ;According L2 ['('(1 1 1 1))]=>    '(1 10) => '('('(1 1 1 1)) 2) and Surplus '(1 2)
  14.          '('(1 1) 2)           ;According L2 ['('(1 1 1))]=>      '(1 2) => '('(1 1) 2)
  15.       )
  16.  

 
Sorry! I am anxious to go out, I made a mistake.
Title: Re: Result sort-x-y
Post by: Lee Mac on July 25, 2015, 02:38:23 PM
Is there a question in there somewhere?  :?
Title: Re: Result sort-x-y
Post by: MP on July 25, 2015, 02:40:44 PM
Only yours.  :D