I want to use the following function to replace the eval-line in user.lisp:
(defcommand eval-me (cmd) ((:rest "Eval> "))
(with-output-to-string (*standard-output*)
(handler-case
(format t "~{~a~^~%~}"
(mapcar 'prin1-to-string
(multiple-value-list (eval (read-from-string cmd)))))
(error (c)
(format t "~A" c))
then the functions as below will work normally without using
"with-output-to-string" respectively,
(defun div618 (p1 p2)
(let ((ratio '(0. 0.191 0.236 0.382 0.5 0.618 0.809 1.))
(price #'(lambda (r) (if (<= p1 p2) (+ p1 (* (- p2 p1) r)) (- p1
(* (- p1 p2) r))))))
(if (<= p1 p2)
(dolist (r (reverse ratio)) (format t "-------~3$
~$-------~%" r (funcall price r)))
(dolist (r ratio) (format t "-------~3$ ~$-------~%" r
(funcall price r))))))
Any suggestion is appreciated !
(defcommand eval-me (cmd) ((:rest "Eval> "))
(with-output-to-string (*standard-output*)
(handler-case
(format t "~{~a~^~%~}"
(mapcar 'prin1-to-string
(multiple-value-list (eval (read-from-string cmd)))))
(error (c)
(format t "~A" c)))))
_______________________________________________
Stumpwm-devel mailing list
Stumpwm-devel@nongnu.org
https://lists.nongnu.org/mailman/listinfo/stumpwm-devel