Created
July 26, 2020 09:24
-
-
Save windymelt/2a48d646b657b3b6583b71c4ba85ddeb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
#|-*- mode:lisp -*-|# | |
#| | |
exec ros -Q -- $0 "$@" | |
|# | |
(progn ;;init forms | |
(ros:ensure-asdf) | |
#+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*) | |
(iter | |
(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) | |
(if-first-time | |
nil | |
(progn | |
(when (or (eq x 1) (eq x wx)) (setf xacc (- xacc))) | |
(when (or (eq y 1) (eq y wy)) (setf yacc (- yacc))))) | |
(if-first-time | |
nil | |
(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