Quantcast
Channel: Programming Forums
Viewing all articles
Browse latest Browse all 51036

Common Lisp: Sorting Structures that hold two numbers

$
0
0
Hello, I have a simple question, how do I sort a list of the following structure based on the exp field:

(defstruct term coef exp)


heres my attempt at sorting
(sort (list (make-term :coef 3 :exp 4)(make-term :coef 3 :exp 5)) #'<)




I realize the above code wont work but I dont know how else to approach it, I really hope I can avoid writing a custom function for this

Viewing all articles
Browse latest Browse all 51036

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>