Created
December 26, 2019 04:44
-
-
Save barkanido/c3def6d4433cb6a65f617e1ed014c0f4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defprotocol Talker | |
(talk [this msg])) | |
(defrecord Hero | |
[name type position health objects] | |
Talker | |
(talk [this msg] | |
(println (:name this) ":" msg))) | |
(->Hero "Bad Guy" :warrior {:x 11 :y 344} 93 [:sword :dagger]) | |
(map->Hero {:name "Bad Guy" :type :warrior}) | |
(->Hero "Bad Guy" :warrior {:x 11 :y 344} 93 [:sword :dagger]) | |
(map->Hero {:name "Bad Guy" :type :warrior}) | |
{:health nil, :name "Bad Guy", :objects nil, :position nil, :type :warrior} | |
(Hero.) | |
(Hero. "Bad Guy" :warrior {:x 11 :y 344} 93 [:sword :dagger]) | |
(let [max (Hero. "Bad Guy" :warrior {:x 11 :y 344} 93 [:sword :dagger])] | |
(talk max "Don't mess with me.")) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment