Programming puzzles: processing lists!
|
08-16-2017, 10:21 PM
Post: #193
|
|||
|
|||
RE: Programming puzzles: processing lists!
(08-16-2017 08:10 PM)pier4r Wrote: And I agree with DavidM. Whatever the implementation (even in Malebolge, no ok not in Malebolge), please share! Okay, you asked for it :-) This is my quick-and-dirty implementation in Common Lisp:- Code:
Code:
Code:
1-2 3-4 5-6 1-2 3-5 4-6 1-2 3-6 4-5 1-3 2-4 5-6 1-3 2-5 4-6 1-3 2-6 4-5 1-4 2-3 5-6 1-4 2-5 3-6 1-4 2-6 3-5 1-5 2-3 4-6 1-5 2-4 3-6 1-5 2-6 3-4 1-6 2-3 4-5 1-6 2-4 3-5 1-6 2-5 3-4 Now I am aware that I am probably the only person here who is familiar with Common Lisp, which makes the above of somewhat limited use :-), but maybe it will pique your (or someone else's) interest enough to consider learning the language. It is very productive for this kind of explorative programming! Don't be scared by the parenthesis! Anyway, the basic principle of operation is that the function recurses down on the input list, shortening it by two elements each time. It returns a list of match-pairings, where a match-pairing is simply a flat list of objects, implicitly pairing together items at index 1 & 2, 3 & 4, etc. Hope this is enough to give the general idea. Paul |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)