pointers - Explanation of specific part in a diagram -
pointers - Explanation of specific part in a diagram -
i understand besides lastly line. more (:x y) part. why pointing 10? sure... first element in y supposed pointing whole thing (10 , 20) or 20? give thanks you!
in clojure, symbols :
prefix keywords. official docs. keywords when used functions have same behavior get. intention of (:x y)
(get y :x)
.
if assume there's (deftype double [x y])
in programme doesn't appear in image, means in lastly form sec element of tripple type field :x
or .x
of double y
, beingness value (double. 10, 20)
. can test @ repl if want...
user> (defrecord mydouble [x y]) user.mydouble user> (defrecord mytripple [x y z]) user.mytripple user> (def x (mydouble. 10 20)) #'user/x user> (def y (mydouble. x 40)) #'user/y user> (def z (mytripple. x (:x y) y)) #'user/z user> z #user.mytripple{:x #user.mydouble{:x 10, :y 20}, :y #user.mydouble{:x 10, :y 20}, :z #user.mydouble{:x #user.mydouble{:x 10, :y 20}, :y 40}} user> (:x y) #user.mydouble{:x 10, :y 20}
pointers clojure
Comments
Post a Comment