0 Members and 1 Guest are viewing this topic.
(defun foo ( lst / bar ) (defun bar ( a b / c e ) (if a (bar (cdr a) (if (eq 'str (type (setq e (car a)))) (cons (list e) b) (if (member e (setq c (car b))) b (cons (cons e c) (cdr b))) ) ) (apply 'append (reverse (mapcar 'reverse b))) ) ) (bar lst nil))
(defun foo ( lst / bar ) (defun bar ( a b c / e f ) (if a (bar (cdr a) (if (setq f (eq 'str (type (setq e (car a))))) (list e) (if (member e b) b (cons e b)) ) (if f (cons b c) c) ) (apply 'append (reverse (mapcar 'reverse (cons b c)))) ) ) (bar lst nil nil) )
(defun doit (thelist) (reverse (remove (reverse thelist))))(defun remove (alist) (if alist (if (and (/= (type (car alist)) 'STR) (> (length (member (car alist) (cdr alist))) (length (vl-member-if '(lambda (item) (= (type item) 'STR)) alist) ) ) ) (remove (cdr alist)) (cons (car alist) (remove (cdr alist))) ) ))
I think my head just exploded with thatin the cool sorta way.
(defun foo ( lst / bar ) (defun bar ( a b / c e ) (if (setq c (car b) e (car a)) (bar (cdr a) (if (eq 'str (type e)) (cons (list e) b) (if (member e c) b (cons (cons e c) (cdr b))) ) ) (apply 'append (reverse (mapcar 'reverse b))) ) ) (bar lst nil))
(defun GroupSet (lst / r subset) (foreach e lst (if (eq (type e) 'str) (setq r (cons e r) subset nil ) (if (not (member e subset)) (setq r (cons e r) subset (cons e subset) ) ) ) ) (reverse r))
(defun foo (lst / sub) (defun sub (lst tmp / a) (if lst (if (numberp (setq a (car lst))) (if (vl-position a tmp) (sub (cdr lst) tmp) (sub (cdr lst) (cons a tmp)) ) (append (reverse tmp) (sub (cdr lst) (list a))) ) ) ) (sub (cdr lst) (list (car lst))))