Fork me on GitHub

(:require [ :refer [endpoints]]) cool, but how do I refer to endpoints as property-endpoints ( :refer :as doesn't seem to work simple_smile as I hoped )


This looks to be what I was looking for [ :refer [endpoints] :rename {endpoints property-endpoints}]

Alex Miller (Clojure team)02:09:54

yes that's closer to what you want although fyi it's unusual to use :rename - more common to alias the ns and use the aliased form

Alex Miller (Clojure team)02:09:20

(:require [ :as property]) and then use property/endpoints in the code


@alexmiller: Ok thanks, I'll do that.

Alex Miller (Clojure team)02:09:42

at the point of use in the code, you then have breadcrumbs that lead you back to the ns alias in the require and to the (same) named function in the external ns

Petrus Theron10:09:32

How do I export a cljs function so that normal JS can call it from the global namespace? E.g. Google Maps JavaScript API has a callback argument that is a global function name. I tried (defn ^:export initMap [] ...) and (aset js/window "initMap" initMap), but the fn does not seem to show up in window.initMap.

Petrus Theron10:09:10

Apologies - it does work. Needed a hard refresh simple_smile.

Petrus Theron11:09:29

I want to pretty print a cljs #js data structure, but (prn (js->clj some-form)) outputs an "unreadable form", which cannot be read by read-string. Is this expected? It seems to be object representations like these "viewport" #<((-33.9284489802915, 18.41180101970849), (-33.9257510197085, 18.414498980291455))>}. How can I format this to get any edn pretty printer to parse it?

Petrus Theron11:09:41

Or at least, I want to strip out these forms and look at the readable forms in the data structure.


@petrus round tripping JS objects for printing just isn’t generally possible


for exporting symbols see goog.exportSymbol


refer to the Google Closure Library docs

Petrus Theron11:09:20

Thanks. I got the export working.

Petrus Theron11:09:35

I don't need a round-trip, just to get rid of the unreadable forms.


there’s no baked in way to do that, you will need to handle this yourself

Petrus Theron11:09:22

Is there a fn that can test if a value is a #js object so that I can filter it out?


but note js->clj and cljs->js is backed by a protocol


there is no such test


you just have to know what’s in the thing that you want to print and handle it

Petrus Theron11:09:59

Any way to define a fallback print-dup fn for any type without it?


hrm dunno, haven’t thought about that


but the takeaway - there’s no “easy” way to accomplish this

Petrus Theron11:09:23

OK. In my case, it's just a really large nested map of returned Google Places and I could easily find the path I'm looking for if I could just pretty print it.

Petrus Theron11:09:40

I'll try a regex simple_smile


I work at a Python shop but I am am learning Clojure on the side and would like to pursue Clojure opportunities. What are the best ways to pursue Clojure job opportunities without having Clojure work experience?


@kyle_schmidt: working on open source projects is one way of getting experience working on real world projects, but that's unlikely to be paid.