Fork me on GitHub
#beginners
<
2017-08-16
>
vinai07:08:01

Oh - ignore me. Hadn't referred go-loop, only go.

vinai08:08:06

(if (not next-page-url) merged-issues

vinai08:08:13

don't be - thanks for taking a look

joshkh09:08:27

so i'm totally new to emacs... i don't see cider listed in M-x package-list-packages. how do i fix that? emacs 25.2 osx

jumar09:08:42

@joshkh you can always install it manually via package-install but I'd recommend Spacemacs: http://spacemacs.org/

joshkh09:08:12

thanks! (add-to-list 'package-archives '("melpa" . "") t) in my .emacs file seemed to fix it

joshkh09:08:22

what gives spacemacs an advantage?

daedelus198213:08:19

Hi, I dont understand 'tree-seq' function so well, where is the best place to learn it?

eggsyntax13:08:06

@daedelus1982 There are a few useful examples at https://clojuredocs.org/clojure.core/tree-seq

daedelus198213:08:06

here is my structure, I want to create the shortest possible list of words going from "bank" to "loan"

daedelus198213:08:51

some branches are dead ends. I have been led to believe that 'tree-seq' is the way to go?

daedelus198213:08:36

I have tried this (map :word (tree-seq map? :children my-structure))) but thats not quite what i wanted. am i going about it the right way?

dpsutton14:08:55

this isn't the shortest since its depth first but something like this could get you started

(defn combine [{:keys [word children] :as tree} target]
  (cond
    (= word target) word
    (seq children) (if-let [path (filter some? (map #(combine % target) children))]
                     (apply conj [word] (flatten path)))
    :else nil))

daedelus198214:08:16

@dpsutton Thanks, I see what you are getting at. I was focused on tree-seq too much I think 😮

dpsutton14:08:22

yeah i forget what kind of tree is a "tree" to clojure. i think its more positional with vectors or with maps. tree seq might work if you had a structure more like ["bank" ["bonk" ["book" ["boor" ..] ["look" ...]]]

vinai14:08:17

I'm trying to add an extern for $("some selector").foo(). I've tried a bunch of different variations in the externs file but without any luck. Can someone share some code maybe?

vinai15:08:47

Thanks! I'll try that.

daedelus198215:08:49

@dpsutton thats a much simpler stucture than my map/vector stucture. I shall re-read the tree-seq examples on clojure docs and see if it makes sense now, cheers

dpsutton15:08:29

eh, its succinct but i think i prefer the node and children explicit keywords style

dpsutton15:08:54

but don't feel boxed into one particular style either way. its your data and you decide the best way forward

sb15:08:06

Hello, I would like to know what is the best practice if you would like to store data at user side. Build an Electron app to OSx. I saw few advice from nodejs forums like local json file, sqlite, RxD. What are your opinion about? What is the best with Clojure? (I would like to store the data “on the computer”, not just in the session, without internet connection)

daedelus198215:08:30

I agree with you that the map structure is more explicit, but at the moment, learning how tree-seq works is more important to me than the structure used.

lepistane17:08:58

the answer i was looking for ajax.cljs deserializes automatically to :params so if i did (:params req) on backend i get what i needed thank for the link @schmee

nbardy21:08:56

How could I accomplish something like this with clojure interop

WebDriver driver = new ChromeDriver();
	((JavascriptExecutor) driver).executeScript("alert('hello world');");
My Java knowledge is rusty, but from what I remember its casting the driver variable. Can I cast from clojure?

noisesmith21:08:05

(let [driver (ChromeDriver.)] (.executeScript driver "alert('hello world')'")) - you don’t need the cast because clojure doesn’t check types

noisesmith21:08:26

casts don’t modify their args, they just tell the compiler to treat the arg as something with that API

noisesmith21:08:40

(except some cases with Numbers I guess?)

nbardy21:08:49

So Clojure will take care of the casting at runtime?

noisesmith21:08:55

if you need the hint, it would be (let [^JavascriptExecutor driver (ChromeDriver.) ...] ...)

noisesmith21:08:12

@nbardy the casting isn’t a vm thing, it’s just a thing that makes the compiler happy

nbardy21:08:53

@nosiesmith Ah. I get it. Thanks

noisesmith21:08:55

I guess it prevents clojure from needing to emit code that does reflection though - so it touches the vm in that sense, but usually you can ignore that

nbardy21:08:12

Reminding me why I don’t miss type systems.

noisesmith21:08:55

similarly List<Foo> is just List in clojure

josh.freckleton22:08:56

I'd like to generate static HTML pages using Garden for css and turn those HTML pages into PDFs is there a set of libs that would make this convenient?

mobileink02:08:26

generate html from what? better to go from one doc (xml) to multiple formats. html->pdf is unreliable.

josh.freckleton22:08:49

specifically, I'm making reports that can be viewed online (re-frame SPA) and I'd like to design it within clojure's web ecosystem, but also be able to export as pdfs en-bulk