1 ;;; -*- mode: lisp; syntax: common-lisp; package: existenz-client; coding: utf-8-unix; -*-
3 (in-package #:existenz-common)
5 ;;; shorthand for interactive degree values, also coerces to
6 ;;; CL-TUPLES::FAST-FLOAT
8 (defun to-radian (degree)
9 (* degree #.(coerce (/ pi 180) 'cl-tuples::fast-float)))
11 ;; FIXME: this fails omniusly while reading NIL
13 (defun |#°-reader| (stream sub-char arg)
14 (declare (ignore sub-char arg))
15 (let ((read (read stream T NIL T)))
16 (and read (to-radian read))))
18 ;; (set-dispatch-macro-character #\# #\° #'|#°-reader|)
20 (defun matrix-elements (dimensions &optional (prefix '#:e))
21 (labels ((aux (dimensions)
22 (let ((car (car dimensions))
23 (cdr (cdr dimensions)))
26 (for i from 0 below car)
29 (in outer (collect (list* i x)))))
31 (for i from 0 below car)
32 (collect (list i)))))))
33 (map 'list (lambda (list)
34 (find-symbol (format NIL "~A~{~A~}" prefix list)))
37 (defun matrix2-elements (dimension &optional (prefix '#:e))
38 (matrix-elements (list dimension dimension) prefix))