Append

From mojo_puzzler
Revision as of 15:50, 17 November 2023 by Gneale (talk | contribs) (Created page with "===== Return to: Chialisp ===== ===== Return to: Recursive Functions ===== <big>Appending lists in a solution:</big> (mod (list1 list2) (defun append (list1 list2) (if (l list1) (c (f list1) (append (r list1) list2)) list2) ) (append list1 list2) ) ==Example Usage:== brun '(a (q 2 2 (c 2 (c 5 (c 11 ())))) (c (q 2 (i (l 5) (q 4 9 (a 2 (c 2 (c 13 (c 11 ()))))) (q . 11)) 1) 1))' '((99 33)(1 2 3))' Outputs: <pre>(99 33 1 2 3)</pre>")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
Return to: Chialisp
Return to: Recursive Functions

Appending lists in a solution:

(mod (list1 list2)
(defun append (list1 list2)
  (if (l list1)
     (c (f list1) (append (r list1) list2))
     list2) 
  )
(append list1 list2)
)

Example Usage:

brun '(a (q 2 2 (c 2 (c 5 (c 11 ())))) (c (q 2 (i (l 5) (q 4 9 (a 2 (c 2 (c 13 (c 11 ()))))) (q . 11)) 1) 1))' '((99 33)(1 2 3))'

Outputs:

(99 33 1 2 3)