I see. Thanks for clarifying and for the example.

Speaking of readability, we could have a naming scheme not limited by the
26 columns if we used lexicographic strings (e.g. a b ... x y z aa ab ..
etc). I've written a function generating relevant strings based on column
and row numbers. Feel free to incorporate it in the definition of 'grid':

(de num->alnum (Col Row)
   (let N Nil
      (until (=0 Col)
         (push 'N (if (=0 (/ Col 27)) (% Col 27) (inc (% Col 27))))
         (setq Col (/ Col 27)))
      (pack (mapcar '((C) (char (+ 96 C))) N) Row)))

Cheers,
Wojtek

pon., 1 lip 2019 o 15:34 Alexander Burger <a...@software-lab.de> napisał(a):

> Hi Wojtek,
>
> > True, I would lose that advantage, but I think the main advantage of the
> > grid approach are the local relationships between neighbors, not access
> by
> > name.
>
> Yes. But if I elaborate my proposal of separate namespaces, you could have
> both
> advantages:
>
>    (load "@lib/simul.l")
>
>    # Global grid symbols, created in 'pico' namespace
>    (off *Grid1 *Grid2 *Grid3)
>
>    # Create each grid in its own namespace
>    (symbols 'pico~grid1 'pico)
>    (setq *Grid1 (grid 8 8))
>
>    (symbols 'pico~grid2 'pico)
>    (setq *Grid2 (grid 8 8))
>
>    (symbols 'pico~grid3 'pico)
>    (setq *Grid3 (grid 8 8))
>
>    # Restore search-order
>    (symbols '(pico))
>
> Then:
>
>    : (symbols '(grid2 pico)
>       (mapc println *Grid2) )
>    (a1 a2 a3 a4 a5 a6 a7 a8)
>    (b1 b2 b3 b4 b5 b6 b7 b8)
>    (c1 c2 c3 c4 c5 c6 c7 c8)
>    (d1 d2 d3 d4 d5 d6 d7 d8)
>    (e1 e2 e3 e4 e5 e6 e7 e8)
>    (f1 f2 f3 f4 f5 f6 f7 f8)
>    (g1 g2 g3 g4 g5 g6 g7 g8)
>    (h1 h2 h3 h4 h5 h6 h7 h8)
>    -> ("h1" "h2" "h3" "h4" "h5" "h6" "h7" "h8")
>
> but
>
>    : (symbols '(grid2 pico)
>       (mapc println *Grid1) )
>    ("a1" "a2" "a3" "a4" "a5" "a6" "a7" "a8")
>    ("b1" "b2" "b3" "b4" "b5" "b6" "b7" "b8")
>    ("c1" "c2" "c3" "c4" "c5" "c6" "c7" "c8")
>    ("d1" "d2" "d3" "d4" "d5" "d6" "d7" "d8")
>    ("e1" "e2" "e3" "e4" "e5" "e6" "e7" "e8")
>    ("f1" "f2" "f3" "f4" "f5" "f6" "f7" "f8")
>    ("g1" "g2" "g3" "g4" "g5" "g6" "g7" "g8")
>    ("h1" "h2" "h3" "h4" "h5" "h6" "h7" "h8")
>    -> ("h1" "h2" "h3" "h4" "h5" "h6" "h7" "h8")
>
> All these symbols are separated now, but still
> readable and printable by name if the correct
> namespace is selected.
>
> ☺/ A!ex
>
> --
> UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
>

Reply via email to