Not much progress, here's some info on sailing
This commit is contained in:
@@ -8,10 +8,13 @@
|
||||
(def hardcoded-wind [0.1 3.0]) ;; A strong easternly wind!
|
||||
(defonce ships (atom []))
|
||||
|
||||
(defn list-ships
|
||||
(defn ship-names
|
||||
"Gets the names from a list of ships"
|
||||
[ships]
|
||||
(map #(:name @%) ships))
|
||||
|
||||
(defn find-ship
|
||||
"Finds a ship with the given name"
|
||||
[ships name]
|
||||
(some #(when (= name (:name @%)) %) ships))
|
||||
|
||||
@@ -97,8 +100,8 @@
|
||||
|
||||
(defn ship-chooser
|
||||
[]
|
||||
(let [name (combobox :model (list-ships @ships))]
|
||||
(b/bind ships (b/transform list-ships) (b/property name :model))
|
||||
(let [name (combobox :model (ship-names @ships))]
|
||||
(b/bind ships (b/transform ship-names) (b/property name :model))
|
||||
(b/bind (b/selection name) (b/transform #(find-ship @ships %)) tracked-ship)
|
||||
(flow-panel :items ["Ship Name" name])))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user