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

trouble sorting numbers

$
0
0
Im basically doing two calculations (quadratic formula) and I want to sort them. I am very very new to lisp and so much of the documentation just goes way beyond what I understand at this point, regardless, I still have an assignment to do and I pretty much have it done, I just need some help sorting the results.

Im aware of the sort function, but I cant seem to get it to work.

Im trying to follow this guide: http://www.n-a-n-o.com/lisp/cmucl-tutorials/LISP-tutorial-22.html

and this is my attempt
edit: there seems to be a bug in DIC. I dont have />, i have )

(defun roots (a b c)

(sort '(
(/(+ (* -1 B )(sqrt(- (expt b 2) (* 4 a c ) )))(* 2 a))
(/(- (* -1 B )(sqrt(- (expt b 2) (* 4 a c ) )))(* 2 a))
#'<)
)

)






this is the error I get



*** - EVAL: too few arguments given to SORT: (SORT '((/ (+ (* -1 B)/>/>/>/>/>/>/> (SQRT (- (EXPT B 2) (* 4 A C)))) (* 2 A)) (/ (- (* -1 B)/>/>/>/>/>/>/> (SQRT (- (EXPT B 2) (* 4 A C)))) (* 2 A)) #'<))
The following restarts are available:
ABORT :R1 Abort debug loop
ABORT :R2 Abort debug loop
ABORT :R3 Abort debug loop
ABORT :R4 Abort debug loop
ABORT :R5 Abort debug loop
ABORT :R6 Abort debug loop
ABORT :R7 Abort debug loop
ABORT :R8 Abort debug loop
ABORT :R9 Abort debug loop
ABORT :R10 Abort debug loop
ABORT :R11 Abort debug loop
ABORT :R12 Abort debug loop
ABORT :R13 Abort debug loop
ABORT :R14 Abort debug loop
ABORT :R15 Abort debug loop
ABORT :R16 Abort debug loop
ABORT :R17 Abort debug loop
ABORT :R18 Abort debug loop
ABORT :R19 Abort debug loop
ABORT :R20 Abort debug loop
ABORT :R21 Abort debug loop
ABORT :R22 Abort debug loop
ABORT :R23 Abort debug loop
ABORT :R24 Abort main loop

Viewing all articles
Browse latest Browse all 51036

Trending Articles



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