Hi Wojtek,

> I've noticed a limitation if one were to use
> multiple grids simultaneously.
> ...
> Since the fields in the grid contain symbols named along the pattern of a
> chessboard that get interned when the grid is created,

Correct. 'grid' is intended for stand-alone usage.


> be shared between grids. One way to remove this limitation would be to use
> 'box' for every cell, thus guaranteeing the symbols' uniqueness, but at the
> price of having human-readable symbols like 'a1.

In fact, this is the case if the grid is wider than 26 columns. Then all cells
are created using 'box' (i.e. anonymous symbols).


> Another thing that came to my mind when porting this approach to Common
> Lisp would be to have something like 'box' but with a user-supplied prefix.
> For instance, in Common Lisp there's the function 'gensym', which called
> without parameters returns a fresh, unique symbol,

In PicoLisp you can create such symbols using 'pack' (i.e. transient symbols):

   : (mapcar
      '((N) (pack "prefix" N))
      (range 3 7) )
   -> ("prefix3" "prefix4" "prefix5" "prefix6" "prefix7")

So you might well just remove the 'intern' in the 'grid' code. But then you lose
the advantage of being able to access the cells by name in the REPL.

Another possibility is to create the grids in separate namespaces and switch
namespaces as needed.

☺/ A!ex

-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe

Reply via email to