Skip to content

Instantly share code, notes, and snippets.



Created Jul 26, 2020
What would you like to do?
#|-*- mode:lisp -*-|#
exec ros -Q -- $0 "$@"
(progn ;;init forms
#+quicklisp(ql:quickload '(:iterate) :silent t)
(defpackage :ros.script.ballfun.3804742596
(:use :cl :iterate))
(in-package :ros.script.ballfun.3804742596)
(defun main (&rest argv)
(declare (ignorable argv))
(let ((*wx* (pop argv))
(*wy* (pop argv)))
(format t "rectangle: (~A,~A)~%" *wx* *wy*)
(for i from 1)
(with wx = *wx*)
(with wy = *wy*)
(with xacc = 1)
(with yacc = 1)
(for x :initially 1 :then (+ x xacc))
(for y :initially 1 :then (+ y yacc))
(format t "~A: (~A,~A)~%" i x y)
(when (or (eq x 1) (eq x wx)) (setf xacc (- xacc)))
(when (or (eq y 1) (eq y wy)) (setf yacc (- yacc)))))
(until (or (and (eq x 1) (eq y 1))
(and (eq x 1) (eq y wy))
(and (eq x wx) (eq y 1))
(and (eq x wx) (eq y wy)))))
(finally (format t "GOAL!~%") (list x y))))
;;; vim: set ft=lisp lisp:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment