diff --git a/.gitignore b/.gitignore index e3c49a2..3014a3b 100644 --- a/.gitignore +++ b/.gitignore @@ -11,4 +11,6 @@ Cargo.lock settings.json -.DS_Store \ No newline at end of file +.DS_Store + +.vscode/alive \ No newline at end of file diff --git a/carp_spike/.gitignore b/carp_spike/.gitignore new file mode 100644 index 0000000..466e248 --- /dev/null +++ b/carp_spike/.gitignore @@ -0,0 +1 @@ +out/ \ No newline at end of file diff --git a/carp_spike/main.carp b/carp_spike/main.carp new file mode 100644 index 0000000..344241e --- /dev/null +++ b/carp_spike/main.carp @@ -0,0 +1,10 @@ +(use Random) +(Project.config "title" "gemla") + +(deftype SimulationNode [population-size Int, population-cutoff Int]) + +;; (let [test (SimulationNode.init 10 3)] +;; (do +;; (SimulationNode.set-population-size test 20) +;; (SimulationNode.population-size &test) +;; )) \ No newline at end of file diff --git a/sbcl_spike/.gitignore b/sbcl_spike/.gitignore new file mode 100644 index 0000000..e69de29 diff --git a/sbcl_spike/main.lisp b/sbcl_spike/main.lisp new file mode 100644 index 0000000..cf6e008 --- /dev/null +++ b/sbcl_spike/main.lisp @@ -0,0 +1,12 @@ +;; Define a type that contains a population size and a population cutoff +(defclass simulation-node () ((population-size :initarg :population-size :accessor population-size) + (population-cutoff :initarg :population-cutoff :accessor population-cutoff) + (population :initform () :accessor population))) + +;; Define a method that initializes population-size number of children in a population each with a random value +(defmethod initialize-instance :after ((node simulation-node) &key) + (setf (population node) (make-list (population-size node) :initial-element (random 100)))) + +(let ((node (make-instance 'simulation-node :population-size 100 :population-cutoff 10))) + (print (population-size node)) + (population node)) \ No newline at end of file