News for hackers. Stuff that matters.
Re:CHIP-8 in Common Lisp by veddox on Monday August 07, 2017 @01:59AM (#14945606)
I understand what they do, and I appreciate that it helps performance to inline them. What I don't understand is the (setf vref) syntax. I thought that after a defun statement you had to have a symbol, not an S-expression? Something like so:

    (defun-inline set-vref (new-value chip x y)
       ...)
And how would you actually call the original function to set a pixel? (I'm not very familiar with inlines, maybe that's my problem here.)
Re:CHIP-8 in Common Lisp by juki on Monday August 07, 2017 @03:13AM (#14945843)
Common lisp has this universal setter-macro, SETF, which can be used to set values to all sorts of places.

In this case you would use

    (setf (vref chip x y) new-value)
to call the function (just like with AREF above). Using SETF has the advantage that you can define "modify macros" that read and write a place. For example,

    (incf (vref chip x y) delta)
would increment the place by DELTA. Or

    (rotatef (vref chip x1 y1)
             (vref chip x2 y2))
would swap two pixels.
Re:CHIP-8 in Common Lisp by reikonomusha on Monday August 07, 2017 @02:12AM (#14945651)
This is special syntax in Common Lisp. (SETF F) actually names a function too. It allows you to define a setter (a setf-expansion) with a normal DEFUN.