This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
- # admin-announcements (25)
- # beginners (3)
- # boot (308)
- # cider (5)
- # clojure (93)
- # clojure-bangladesh (2)
- # clojure-italy (1)
- # clojurescript (63)
- # core-logic (23)
- # datascript (6)
- # editors (1)
- # emacs (2)
- # hoplon (320)
- # incanter (1)
- # jobs (6)
- # jvm (1)
- # melbourne (1)
- # om (2)
- # re-frame (9)
- # reagent (2)
- # slack-help (5)
- # spacemacs (2)
- # yada (1)
@bhauman thank you :) I guess it's a bit lengthy yes. At this point I think the most important is to find what questions are missing.
First time I edit a wiki page on github, hope I didn't mess up your FAQ @val_waeselynck
Hi all, is anyone happy discussing the merits of using Om vs microdata to push data to a HighCharts graph?
In particular, how to port a current ‘production’ approach in another project into a more clojuresque approach for learning.
let's say you're writing code (client or server) that receives a stream of JSON objects, say, for people in a Contacts list. It's the job of your code to just store this in an in-memory hash map/set for easy retrieval. The JSON payloads are full representations of a Contact, such that even if just the name of a contact is changed (while email, phone, etc, remain the same), the incoming JSON payload includes ALL fields of a Contact including those that haven't changed.
you want to take advantage of data structure reuse such that you're not building entirely new ClojureScript objs from the parsed JSON and swapping out what's in the dictionary
I suppose you could first do a lookup of the ID of the contact that's changing, and then diff what's actually changed and then do selective assoc-in on the existing Contact to generate a new value for that Contact
but is there some generalized concept / approach for this sort of thing in Clojure/Script?
@machty: had to implement something like this for maps: https://github.com/darwin/plastic/blob/84712fb991260e0baf56433491f881313e88a976/cljs/src/common/plastic/util/helpers.cljs#L99-L140
otherwise, assuming the store is a map which keys are Contact ids, and values are the contacts themselves, you can just do something like
(update-in contacts-store [contact-id] merge contact-data)
performance aside is there any reason why it'd be desirable to keep
identical? semantically separate?
@machty: = and indentical? are different, = is (potentially) deep equality check, indentical? is just a pointer check
if your code is being modified often and read once, you want to pay during read, or vice-versa
but as far as the clojure philosophy of state/values goes, it seems that there's no philosophical reason for distinguishing between whether two equal objects (as per
=) have different pointers
indeed, that would be nice, but someone would have to do equality check (even if it was hidden in language runtime)
maybe they return same results for atoms, but internally it does different operation, identical? is just a pointer check, = will do deep equality comparison of atom members, one of those members is probably some kind of reference-number to atom’s val, so they cannot be equal, even if deref-ing both returns equal values
Planck looks great but the examples involving require aren't working for me. Any advice?
$ planck cljs.user=> (require '[planck.core :refer [slurp]]) cljs.user=> (slurp "/tmp/foo") WARNING: Use of undeclared Var cljs.user/slurp at line 1 undefined is not an object (evaluating 'cljs.user.slurp.call')
@val_waeselynck: thanks, so it doesn't really matter which one I use if I'm passing in strings
yeah, I'd personally go with js/getElementById in this case, more transparent IMO.
@shaunlebron: I think we're getting there https://github.com/vvvvalvalval/reagent-phonecat/wiki/Questions-about-ClojureScript