4 ms·
It looks OK to me: (define (time-to-move from-pos to-pos) ;; Calculates the total time to move between two positions, ;; assuming rotation and
by neilv 1y ago
It looks OK to me:
(define (time-to-move from-pos to-pos)
;; Calculates the total time to move between two positions,
;; assuming rotation and ascension can occur simultaneously.
(max (time-to-rotate (position-azimuth from-pos)
(position-azimuth to-pos))
(time-to-ascend (position-elevation from-pos)
(position-elevation to-pos))))
- bhk 1y agoYet the author injects needless complexity with macros and claims "I think it’s possible to write clearer Lisp code, I just don’t know how." I don't get it.
- netbioserror 1y agoYeah, I was going to say. The simplicity and readability of Lisp code is inversely proportional to the use of macros.
- Xmd5a 1y agoLet's get rid of macros then
- akho 1y agoThe simplicity and readability of Lisp-- code is now inversely proportional to how useful macros would have been to write it.
- netbioserror 1y agoIn projects? Yes, scaling them back is a good idea. They're a specific tool with a specific use. It's profoundly annoying, especially in Nim world, to pull in a library that then hides all of its functionality in code paths that are only generated at compile time. Things become very difficult to debug.
- vindarel 1y agoindeed. Note that's a function declaration in Common Lisp (yours is Scheme): (defun time-to-move (from-pos to-pos) it's like the author didn't understand accessors? They don't need the with-accessors. They also might not need with-slots, had they had an accessor for last-duration. (with-slots (last-duration) antenna (setf last-duration total-time) => (setf (last-duration antenna) total-time) ;; given last-duration is an accessor: both a getter and a setter.
- tmtvl 1y agoYeah, the total run-scan function could be fairly short: (defun run-scan (antenna scan) "Perform a scan on this antenna. Return a scan log." (let* ((slew-time (move-to antenna (scan-position scan))) (on-source-time (delay antenna (scan-length scan)))) (setf (antenna-last-duration antenna) (+ on-source-time slew-time)) (make-scan-log scan slew-time on-source-time)))
- amszmidt 1y ago(No need for LET*, just LET would suffice.)