should the default be lower bounds or upper bounds? Peter McGoron (11 Apr 2026 13:42 UTC)
Re: should the default be lower bounds or upper bounds? John Cowan (11 Apr 2026 23:06 UTC)
Re: should the default be lower bounds or upper bounds? Peter McGoron (12 Apr 2026 00:40 UTC)
Re: should the default be lower bounds or upper bounds? Per Bothner (12 Apr 2026 03:01 UTC)
Re: should the default be lower bounds or upper bounds? John Cowan (12 Apr 2026 04:38 UTC)
Re: should the default be lower bounds or upper bounds? John Cowan (12 Apr 2026 01:55 UTC)
Re: should the default be lower bounds or upper bounds? Peter McGoron (12 Apr 2026 03:22 UTC)
Re: should the default be lower bounds or upper bounds? Bradley J Lucier (12 Apr 2026 04:08 UTC)
Re: should the default be lower bounds or upper bounds? John Cowan (12 Apr 2026 04:50 UTC)
Re: should the default be lower bounds or upper bounds? Bradley Lucier (12 Apr 2026 16:00 UTC)
Re: should the default be lower bounds or upper bounds? Peter McGoron (12 Apr 2026 16:14 UTC)

Re: should the default be lower bounds or upper bounds? Bradley Lucier 12 Apr 2026 16:00 UTC

On 4/11/26 23:17, Peter McGoron wrote:
>
> Here is a (hopefully correct) array of the 4D Levi-Civita symbol.
>
> (define ε
>    #a i32 ((1 4) (1 4) (1 4) (1 4))
>      ;; ε_1ABC
>     ((((0 0 0 0) (0 0 0 0) (0 0 0 0) (0 0 0 0))  ; ε_11BC
>       ((0 0 0 0) (0 0 0 0) (0 0 0 1) (0 0 -1 0)) ; ε_12BC
>       ((0 0 0 0) (0 0 0 -1) (0 0 0 0) (0 1 0 0)) ; ε_13BC
>       ((0 0 0 0) (0 0 1 0) (0 -1 0 0) (0 0 0 0))) ; ε_14BC
>      ;; ε_2ABC
>      (((0 0 0 0) (0 0 0 0) (0 0 0 -1) (0 0 1 0)) ; ε_21BC
>       ((0 0 0 0) (0 0 0 0) (0 0 0 0) (0 0 0 0))  ; ε_22BC
>       ((0 0 0 1) (0 0 0 0) (0 0 0 0) (-1 0 0 0)) ; ε_23BC
>       ((0 0 1 0) (0 0 0 0) (-1 0 0 0) (0 0 0 0))) ; ε_24BC
>      ;; ε_3ABC
>      (((0 0 0 0) (0 0 0 -1) (0 0 0 0) (0 1 0 0)) ; ε_31BC
>       ((0 0 0 -1) (0 0 0 0) (0 0 0 0) (1 0 0 0)) ; ε_32BC
>       ((0 0 0 0) (0 0 0 0) (0 0 0 0) (0 0 0 0)) ; ε_33BC
>       ((0 1 0 0) (-1 0 0 0) (0 0 0 0) (0 0 0 0))) ; ε_34BC
>      ;; ε_4ABC
>      (((0 0 0 0) (0 0 -1 0) (0 1 0 0) (0 0 0 0)) ; ε_41BC
>       ((0 0 -1 0) (0 0 0 0) (1 0 0 0) (0 0 0 0)) ; ε_42BC
>       ((0 1 0 0) (-1 0 0 0) (0 0 0 0) (0 0 0 0)) ; ε_43BC
>       ((0 0 0 0) (0 0 0 0) (0 0 0 0) (0 0 0 0)))) ; ε44BC
> )
>
> (The Levi-Civita symbol is defined where ε_ABCD = 1 if (A,B,C,D) is an
> even permutation of (1,2,3,4), -1 if it is odd, and zero if it is
> neither. So it is a better candidate for a generalized array instead of
> a specialized array. But it is a real example.)

An interesting programming exercise.  Here's my program and the result,
which differs from yours in some respects.

(import srfi/231)

(define (permutation-parity perm)
   ;; assumes that perm is a permutation
   (let outer ((i 0)
               (parity 1))
     (if (eqv? i (vector-length perm))
         parity
         (let inner ((parity parity))
           (let ((entry (vector-ref perm i)))
             (if (eqv? entry i)
                 (outer (+ i 1) parity)
                 (begin
                   (vector-set! perm i (vector-ref perm entry))
                   (vector-set! perm entry entry)
                   (inner (* parity -1)))))))))

(define levi-civita
   (make-array (make-interval '#(4 4 4 4))
               (lambda args
                 (let ((perm (list->vector args)))
                   (if (permutation? perm)
                       (permutation-parity perm)
                       0)))))

(pretty-print (array->list* levi-civita))

Output:

((((0 0 0 0) (0 0 0 0) (0 0 0 0) (0 0 0 0))
   ((0 0 0 0) (0 0 0 0) (0 0 0 1) (0 0 -1 0))
   ((0 0 0 0) (0 0 0 -1) (0 0 0 0) (0 1 0 0))
   ((0 0 0 0) (0 0 1 0) (0 -1 0 0) (0 0 0 0)))
  (((0 0 0 0) (0 0 0 0) (0 0 0 -1) (0 0 1 0))
   ((0 0 0 0) (0 0 0 0) (0 0 0 0) (0 0 0 0))
   ((0 0 0 1) (0 0 0 0) (0 0 0 0) (-1 0 0 0))
   ((0 0 -1 0) (0 0 0 0) (1 0 0 0) (0 0 0 0)))
  (((0 0 0 0) (0 0 0 1) (0 0 0 0) (0 -1 0 0))
   ((0 0 0 -1) (0 0 0 0) (0 0 0 0) (1 0 0 0))
   ((0 0 0 0) (0 0 0 0) (0 0 0 0) (0 0 0 0))
   ((0 1 0 0) (-1 0 0 0) (0 0 0 0) (0 0 0 0)))
  (((0 0 0 0) (0 0 -1 0) (0 1 0 0) (0 0 0 0))
   ((0 0 1 0) (0 0 0 0) (-1 0 0 0) (0 0 0 0))
   ((0 -1 0 0) (1 0 0 0) (0 0 0 0) (0 0 0 0))
   ((0 0 0 0) (0 0 0 0) (0 0 0 0) (0 0 0 0))))