Re: How to use defrecord getBasis to look up record instance field values

2018-12-02 Thread Andy Fingerhut
Maybe you are looking for something like this?

(map #(% p1) (map keyword (Person/getBasis)))

keyword can take a symbol as argument, and return a corresponding keyword.

Andy

On Sun, Dec 2, 2018 at 8:31 PM  wrote:

>
> defrecord Person [name age company])
>
> (def p1 {:name "foo", :age 27, :company :bar})
>
> (map #(% p1) (keys p1))
> ("foo" 27 :bar)
>
> user=> (map #(% p1) (Person/getBasis))
> (nil nil nil nil)
>
> user=> (map #(class %) (Person/getBasis))
> (clojure.lang.Symbol clojure.lang.Symbol clojure.lang.Symbol
> clojure.lang.Symbol)
>
> getBasis seems to return the symbol but my record lookup technique doesnt
> seem to be working..
>
> any idea why
>
> I dont wish to use keys on the record instance since the instance might be
> missing some fields in the record
>
> --
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with
> your first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> ---
> You received this message because you are subscribed to the Google Groups
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


How to use defrecord getBasis to look up record instance field values

2018-12-02 Thread beginner . clojure

defrecord Person [name age company])

(def p1 {:name "foo", :age 27, :company :bar})

(map #(% p1) (keys p1))
("foo" 27 :bar)

user=> (map #(% p1) (Person/getBasis))
(nil nil nil nil)

user=> (map #(class %) (Person/getBasis))
(clojure.lang.Symbol clojure.lang.Symbol clojure.lang.Symbol 
clojure.lang.Symbol)

getBasis seems to return the symbol but my record lookup technique doesnt 
seem to be working..

any idea why

I dont wish to use keys on the record instance since the instance might be 
missing some fields in the record

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [ANN] 'Elements of Clojure' is complete

2018-12-02 Thread Colin Yates
That’s awesome - congratulations!

Sent from my iPhone

> On 2 Dec 2018, at 23:25, Zach Tellman  wrote:
> 
> I'm very happy to announce, only two and a half years after the release of 
> the first chapter, that Elements of Clojure is completely finished.  Further 
> details can be found here: 
> https://groups.google.com/forum/#!topic/elements-of-clojure/UUJjqU1rllU.
> 
> If you've never heard of the book before, please check out its website: 
> http://elementsofclojure.com/
> 
> Zach
> -- 
> You received this message because you are subscribed to the Google
> Groups "Clojure" group.
> To post to this group, send email to clojure@googlegroups.com
> Note that posts from new members are moderated - please be patient with your 
> first post.
> To unsubscribe from this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en
> --- 
> You received this message because you are subscribed to the Google Groups 
> "Clojure" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to clojure+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[ANN] 'Elements of Clojure' is complete

2018-12-02 Thread Zach Tellman
I'm very happy to announce, only two and a half years after the release of 
the first chapter, that Elements of Clojure is completely finished.  
Further details can be found 
here: https://groups.google.com/forum/#!topic/elements-of-clojure/UUJjqU1rllU.

If you've never heard of the book before, please check out its website: 
http://elementsofclojure.com/

Zach

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.