#!/bin/sh
: ; exec klone $0 "$@"
; The above line allows not to embed the exact path of the klone executable

;;Skeleton of a typical klone script

(setq args (getopts "USAGE: %0 [options] number
gives power-of-2 making this number"
))

(defun powers-of-2 (n &aux (i 0) i2 (m 0) (res (list)))
  (while (/= m n)
    (setq i2 (** 2 i))
    (if (/= 0 (logand i2 n)) (progn
	(lappend res i2)
	(incf m i2)
      )
    )
    (incf i)
  )
  res
)

(defun main (&aux
    (p2 (powers-of-2 (Int (0 args))))
  )
  (PF "%0 =" (Int (0 args)))
  (dolist (n p2) (PF "\n  %0" n))
  (PF "\n")
)

(main)

;;; EMACS MODES
;;; Local Variables: ***
;;; mode:lisp ***
;;; End: ***

