dootcamp #1
4 changed files with 0 additions and 23 deletions
1
carp_spike/.gitignore
vendored
1
carp_spike/.gitignore
vendored
|
@ -1 +0,0 @@
|
||||||
out/
|
|
|
@ -1,10 +0,0 @@
|
||||||
(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)
|
|
||||||
;; ))
|
|
0
sbcl_spike/.gitignore
vendored
0
sbcl_spike/.gitignore
vendored
|
@ -1,12 +0,0 @@
|
||||||
;; 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))
|
|
Loading…
Add table
Reference in a new issue