I am in the process of translating a program from lisp into C#, most of it has gone smoothly but I have run across two blocks of code that are giving me a bit of trouble. If anyone can help me translate these two pieces of code into C# I'd be very grateful.
The COUNT-HIGHEST function:
(defun COUNT-HIGHEST (lists) "Returns the highest occuring pattern in its arg." (let* ((sorted-numbers (my-sort #'< (mapcar #'second lists))) (numbers-only (remove-duplicates sorted-numbers)) (counts (count-them numbers-only sorted-numbers))) (find-all (nth (position (first (my-sort #'> counts)) counts) numbers-only) lists)))
And the sort function that it calls:
(defun MY-SORT (function lists) "Non-destructive sort function." (loop for item in (sort (loop for array-2 in lists collect (list array-2)) function :key #'car) collect (first item)))
FYI: array-2 is an array of floats.
If anyone is curious, these two pieces of code come from a program called "Network" written by David Cope. The full program along with others can be found here. Unfortunately all of his files are archived in .sit format, so you'll need StuffIt Expander to open them.