Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

indeed. 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.


Yeah, 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)))


(No need for LET*, just LET would suffice.)


LET* may be needed if the operations are time-dependent (so if the move-to operation must happen before the delay operation), as LET does the binding in parallel (at least, according to the spec).


That is a very acute observation!




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: