Skip to content

Instantly share code, notes, and snippets.

@elderica
Created March 5, 2024 12:32
Show Gist options
  • Save elderica/e6ba582d5ecee94006cdcc4835daca1c to your computer and use it in GitHub Desktop.
Save elderica/e6ba582d5ecee94006cdcc4835daca1c to your computer and use it in GitHub Desktop.
(in-package :common-lisp-user)
(defpackage :dezero-naive.steps.step01
(:use :common-lisp))
(in-package :dezero-naive.steps.step01)
(defclass <variable> ()
((data :initarg :data :accessor @data)))
(defun <variable> (data)
(make-instance '<variable> :data data))
(let* ((data #(1.0))
(x (<variable> data)))
(format t "~A~%" (@data x))
(setf (@data x) #(2.0))
(format t "~A~%" (@data x)))
; #(1.0)
; #(2.0)
; => NIL
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment