Fork me on GitHub
#beginners
<
2018-06-21
>
funyako.funyao15600:06:12

Anybody knows what is the reasoning of using a def instead of atom for com.stuartsierra.component ? Am I missing something?

michael.gaare00:06:47

In what context @funyako.funyao156?

funyako.funyao15600:06:30

@mg Development context, most of the example I see use something like set-init! which just calls alter-var-root

seancorfield00:06:53

Because atom is for synchronized mutation and then you need a deref (or @) whereas this workflow does not need synchronization because the only change to the value is at startup of your app (and shutdown) -- and you don't need deref with a simple Var.

seancorfield00:06:50

You certainly could store it in an atom and use swap! to start / stop the component, if you don't mind the additional deref to access the component.

seancorfield00:06:25

But the intent implied by atom vs Var is different.

seancorfield00:06:32

Does that help @funyako.funyao156?

funyako.funyao15601:06:29

@seancorfield Thank you for the explanation!

lockdown-04:06:04

What's the biggest strength of transducers?

seancorfield04:06:01

@lockdown- Probably that it combines all the functions steps together without creating intermediate sequence results from each step.

michael.gaare04:06:56

into with the transducing arity will impress your friends

lockdown-04:06:06

@seancorfield so it's mostly about performance?

seancorfield04:06:39

@lockdown- I'm not sure I'd it's "mostly" that, but that is certainly a big plus.

seancorfield04:06:22

The decoupling of the transformations from the input and output types is also important.

seancorfield04:06:16

For example, I can write a transducer and it can be applied to a collection, to a core.async channel, to a reducible-query... and the result can be fed into all sorts of different things.

lockdown-04:06:11

Ok, gonna read up on them, was going to postpone them but they look like a nice abstraction

val_waeselynck05:06:30

Also, they're simpler, in the hickeyian sense :)

funyako.funyao15609:06:00

@lockdown- To add, I think they have a nice way to do stateful computation

riteeks5609:06:36

I have just started clojure does anyone uses VScode for clojure. If yes what plugin do you guys suggest me? Main feature i want to have is jumping to the functions definitions, please help. I have used Clojure plugin by Andrey Lisin, func jump is only working for the inbuild funcs like println, reduce the jump is not working for my defined functions, please help

lepistane10:06:45

does anyone have experience with lighttable?

lepistane10:06:49

i am just trying it out

lepistane10:06:53

cant run lein project

lepistane10:06:58

which i am working on in emacs

lepistane10:06:30

do i just enter project.clj namespace and ctrl++enter - that should start it?

pez13:06:52

@lepistane I thought Lighttable was abandonware

bronsa13:06:25

it kindof is

joelsanchez13:06:43

lighttable was abandoned in favor of eve which hasn't been released and totally won't be abandoned

sbauer13:06:24

I feel like work on eve already stopped too

sbauer13:06:26

Yeah that's the link I was looking for

bennyk13:06:36

Hi! I want to create a csv file without saving it on the disk (in order to return it to the client) i have noticed that write-csv can work with a writer instead of a file but i tried it with no success. Tried something like that:

(csv/write-csv (java.io.OutputStreamWriter. ) csv-data)
any suggestions will be appreciated !!

gon14:06:48

you can use a StringWriter

bennyk10:06:10

Helped me so much!

gon14:06:56

(let [b (java.io.StringWriter.)] (csv/write-csv b ["a" "b" "c"]) (.toString b))

jeremy64216:06:42

This is random but does anyone know what is used to make these graphics? http://www.clara-rules.org/img/diagram/RULE.png

hiredman16:06:54

it looks similar to what http://bottlecaps.de/rr/ui generates

jeremy64217:06:05

@hiredman Thanks. That helps.

matt.raykowski20:06:33

In Luminus is there any equivalent to like bower or npm deps for third party assets?

eggsyntax21:06:19

Just to be clear (since this is #beginners ) -- there are also plenty of clojurescript libs to pull in by adding them to project.clj, some of which wrap well-known JS libs. There are also externs/wrappers for a ton of JS libs at https://cljsjs.github.io/ . In my experience, it's not terribly common for people to need to pull in JS stuff directly by adding the JS file to the project. Probably not what you were looking for, but just in case...

michael.gaare20:06:13

@matt.raykowski there’s webjars for a lot of that

matt.raykowski20:06:21

It works when you have the file in resources/public/... right?

michael.gaare20:06:51

yeah, you can do that too

matt.raykowski20:06:16

But you're saying it'll work for ones I have not explicitly downloaded.

matt.raykowski20:06:30

So I just need to go RTFM a bit about WebJars.

michael.gaare20:06:35

@matt.raykowski webjars is mechanism where people have packaged certain third party web things as maven artifacts, so you can put them in your project file like everything else. Then you need to add the middleware to serve them

matt.raykowski20:06:18

Okay cool. That's working for CSS.

matt.raykowski20:06:40

What if I want to require a JS file in cljs? Is there a good example of that?

noisesmith20:06:09

in my experience it worked to treat it just as I would css. The starting index page contains a tag that pulls the resource in, and the resource is in the jar via the resources directory so that the server can send it to the client

bfast20:06:46

@noisesmith That approach will not work with CLJS advanced compilation

bfast20:06:56

It will work with simple though, I believe

noisesmith20:06:19

advanced compilation had nothing to do with requiring the resource, in my experience

noisesmith20:06:33

we made externs files by hand

noisesmith20:06:50

perhaps there's a newer easier way to do things, I would be ignorant of it though

noisesmith20:06:28

from what I've seen, there are packages that give you js plus externs, and attempts to auto-generate externs. I can't vouch for any of them

kkruit23:06:24

I want to be able to call (do-in-seq (println "1") (println "2"))

andy.fingerhut23:06:09

You want a macro that works just like Clojure's built-in "do", as an exercise to understand how to do it? Or if you want something that behaves differently than built-in "do", how do you want its behavior to differ?

kkruit23:06:39

I want it to for sure execute sequentially for stateful change that have to happen in order.

hiredman23:06:08

have you ever seen how you would implement do using the lambda calculus?

andy.fingerhut23:06:10

Clojure's built-in "do" is sequential

kkruit23:06:44

eg execute sql to empty a table then fill it up