On this page:
fref
fset
fupdate

3 Accessing and modifying data🔗ℹ

syntax

(fref ref-form ...)

syntax

(fset [ref-form ...] value)

syntax

(fupdate [ref-form ...] update-proc)

These macros define another way to access the structures defined above. For example
(fref f
      [glyph 'a]
      [layer foreground]
      [contours @ 2]
      [points @ 3]
      pos
      x)
produces the vec-x of point-pos etc. The form (fref f [glyph 'a]) is like calling (get-glyph f 'a).

The form (fref g [layer foreground]) is like calling (get-layer g foreground).

The form (fref l [contours @ 2]) gets the third contour of the layer, the @ can be used when the result is a sequence, to refer to a specific element in the sequence.

Setting a value is similar:

(fset [f
       [glyph 'a]
       [layer foreground]
       [contours @ 2]
       [points @ 3]
       pos
       x]
      200)
The first part between brackets uses the same conventions seen above, the second part is the new value.

The last form fupdate update a value with a procedure.
(fupdate [f
          [glyph 'a]
          [layer foreground]
          [contours @ 2]
          [points @ 3]
          pos
          x]
         (lambda (x) (+ x 100)))

The effect, here, is shifting a point rightward.