hosneyalaa Posted July 24, 2019 Share Posted July 24, 2019 Hello everyone If I have a list the following format (("HDHDHDH" "HDHDHDH" "HDHDHDH" "HDHDHDH") (1.0 "" 3.0 "S") (1.0 2.0 "" "S")) How can I convert it to the following format ("HDHDHDH" "HDHDHDH" "HDHDHDH" "HDHDHDH" 1.0 "" 3.0 "S" 1.0 2.0 "" "S") I mean removing the arc's from the list Thanks in advance Quote Link to comment Share on other sites More sharing options...
Tharwat Posted July 24, 2019 Share Posted July 24, 2019 (apply 'append '(("HDHDHDH" "HDHDHDH" "HDHDHDH" "HDHDHDH") (1.0 "" 3.0 "S") (1.0 2.0 "" "S"))) 1 Quote Link to comment Share on other sites More sharing options...
hosneyalaa Posted July 24, 2019 Author Share Posted July 24, 2019 My friend Tharwat Thank you very much Thanks for help Quote Link to comment Share on other sites More sharing options...
Tharwat Posted July 24, 2019 Share Posted July 24, 2019 You're welcome anytime. 1 1 Quote Link to comment Share on other sites More sharing options...
Grrr Posted July 24, 2019 Share Posted July 24, 2019 FWIW (defun f ( L / x ) (if L (append (if (listp (setq x (car L))) (f x) (list x) ) (f (cdr L)) ) ) ) Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted July 24, 2019 Share Posted July 24, 2019 In general: Flatten List 1 Quote Link to comment Share on other sites More sharing options...
ronjonp Posted July 24, 2019 Share Posted July 24, 2019 5 hours ago, Grrr said: FWIW (defun f ( L / x ) (if L (append (if (listp (setq x (car L))) (f x) (list x) ) (f (cdr L)) ) ) ) You've become quite the recursion master Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.