Fork me on GitHub
#beginners
<
2016-06-02
>
agile_geek06:06:04

I would prefer the constructor form over the Java interop - see @stuartsierra's blog on this https://stuartsierra.com/2015/05/17/clojure-record-constructors

senya2211:06:43

Interesting. Thank you for the pointers

senya2211:06:42

and how would one get to the created field? '(defrecord Foo [a b]) => user.Foo (map->Foo {:b 4 :a 3}) => #user.Foo{:a 3, 😛 4} (:a Foo) => nil`

senya2212:06:19

I think I got it: `(def foo (map->Foo {:b 4 :a 3})) => #'user/foo (:a foo) => 3`

seancorfield16:06:20

@senya22: You can use triple backticks to quote multiple lines of code.

senya2216:06:34

ah, thanks @seancorfield !

victorbjelkholm16:06:40

Quick question! I have the following code:

(def list-of-things (atom '()))

(defn sum-price-for-products
  [things]
  (reduce str things))

(defn -main
  [& args]
  (swap! list-of-things conj args)
  (println (sum-price-for-products @list-of-things)))
and I run it with lein run "apple" "apple” which I get back (apple apple) instead of appleapple which I expect

victorbjelkholm16:06:20

someone knows why?

jswart16:06:59

& args is conjing a collection into list of things

jswart16:06:12

args as a collection goes into list-of-things

jswart16:06:29

you need to change (swap! …) to put each item into the list

victorbjelkholm16:06:21

yeah, or using concat I discovered now

ghadi17:06:45

lots of great options in here @cored

cored17:06:54

ghadi: tahnks

ghadi17:06:05

that's the mega ref

cored17:06:15

ghadi: thanks again

cored17:06:17

will check that out

dimovich20:06:01

hello clojurians

dimovich20:06:13

what is the best way to work with google search from clojurescript?

jjfine20:06:49

pretty sure it's against the Google's TOS to automate searching but you'll probably get away with a bunch of calls to ajax.core/GET before you get rate-limited

dimovich20:06:30

I'm not crawling... just searching for some terms and analyzing the first 20 results

dimovich20:06:46

thx for the tip

dmbennett22:06:35

where would I go to read about what #( something %) is?

dmbennett22:06:59

specifically the #(%) notation