Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Get list of fields in struct

Tags:

clojure

How would I find what fields a struct has? For example, if i have the following:

(defstruct bintree :data :left :right)
(def a (struct bintree 0 nil nil))

how would i get a list,set, or vector of (:data :left :right) from a? I've tried

(show a)

but this gives no methods that look correct.

like image 616
Nathaniel Flath Avatar asked Oct 24 '25 02:10

Nathaniel Flath


1 Answers

I found the answer - a simple

(keys a)

will get me this.

like image 140
Nathaniel Flath Avatar answered Oct 26 '25 02:10

Nathaniel Flath



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!