Fork me on GitHub
#clojure
<
2017-02-17
>
jmb04:02:37

If I want to learn Clojure with the intent of finding work in it, is web development my best shot at doing so?

weavejester04:02:11

Web development and big data use have both been heavily cited in past surveys.

jmb04:02:02

I see. Do both areas go hand in hand or are they independent of each other?

weavejester04:02:14

Independent, really.

weavejester04:02:53

Though web services have a tendency to pop up in any system.

jmb04:02:42

Oh ok because it makes a lot of sense that both of those fields go together in one developer role. Thanks

joshjones05:02:49

@jmb As someone who does my daily work in clojure, I'd recommend that if you don't know it yet, focus on learning vanilla clojure first. A monster<dot>com search for clojure returns 397 results, and clojurescript returns only 33. People associate "functional programming" with scala, clojure, erlang, etc, and even if the job requires scala, for example, if you know clojure, you're likely to be associated with someone who is a decent fit. Learning clojure lets you focus on thinking in a functional paradigm. IMO introducing the inevitable framework like reagent etc. into cljs will have you focusing more on the framework, than how to program clojure. Then once you know the language pretty comfortably, do a cljs project, and you'll find it enjoyable; I did this and found coding reagent/cljs to be a pleasure, but probably would not have found it so much that way had i learned it first

jmb05:02:02

Thanks for the info!

jmb06:02:10

Btw @joshjones did you use the leiningen template or did you manually add it to your project.clj?

joshjones06:02:35

for projects in general you mean? or a cljs based project? @jmb

jmb06:02:48

Whenever you use reagent

joshjones06:02:31

i use the lein figwheel template -- but have also set up a boot-based project. but particularly for integrating into intellij, a lein project works well

jmb06:02:39

Ok. Because I know a moderately good amount of Clojure, but I was thinking of refining what I know just a bit more and then I was gonna pick up something like Reagent so that I can actually start build practical things

drbigdata06:02:27

Perhaps a stretch Looking for 2 fulltime developers with clojure, clojurescript, cassandra, postgres and bigquery experience

Pablo Fernandez06:02:50

@drbigdata there are two channels in Slack for jobs, one for normal jobs and one for remote ones.

kauko10:02:38

I'm trying to run a shell command from the repl, but I can't get it to work. ag "\(deftest " works from the cli, but how do I write that into clojure code? (sh/sh "ag" "\"\\(deftest \"")

residentsummer10:02:39

@kauko you probably need to escape paren as well (`\(`)

kauko10:02:31

No.. you mean like (sh/sh "ag" "\"\\\(deftest \"")? ( is not an escapable character

kauko10:02:53

I mean, I WANT ag to get a string that looks like "\(..."

kauko10:02:05

Which means I need to escape both the quotes and the \

kauko10:02:11

And at least I think I'm doing that

residentsummer10:02:58

ahh, nailed it. you don’t need double-quotes there!

residentsummer10:02:20

so it should be (sh/sh "ag" "\\(deftest ")

residentsummer10:02:49

you need quotes in cli to prevent (ba)sh from splitting your arg on whitespace. sh/sh won’t do it, because you already pass args one by one

kauko11:02:19

ah cool. I'll try it

kauko11:02:02

(sh/sh "ag" "\\(deftest ")`

kauko11:02:06

Doesn't work either 😕

kauko11:02:04

(sh/sh "ag" "a") Doesn't work either. Hmm, must be something else then

kauko11:02:57

I tried calling ag with the full path too

residentsummer11:02:05

maybe your working dir is incorrect? “doesn’t work” means error or no results?

rauh11:02:06

Just use ag -F?

kauko11:02:30

(sh/sh "ag" "a")
=> {:exit 1, :out "", :err ""}
`

kauko11:02:53

(sh/sh "/usr/local/bin/ag" "-f")
=> {:exit 1, :out "", :err "ERR: What do you want to search for?\n"}
`

kauko11:02:29

(sh/sh "ls" "-la") tells me I'm in the right dir

residentsummer11:02:12

status 1 and no output means “nothing found” on my machine

kauko11:02:12

Yeah, but if run ag a on the command line, it finds all kinds of things, obviously 🙂

kauko11:02:22

Though you're right that "doesn't work" was a pretty bad way of saying it

kauko11:02:27

Oh well, I don't really have the time to debug this anymore. It's not like it's really that important, just would've been nice to understand what I'm doing wrong. 🙂

rauh11:02:25

@kauko I thought you figured it out? It seems like you can't run just ag, you have to use the full path

residentsummer11:02:15

well, it behaves the same on my machine - works in terminal, but not in sh/sh

kauko11:02:52

@rauh no it behaves the same in both cases, with or without the full path

rauh11:02:34

@kauko I see, I got it work with adding a trailing .

kauko11:02:07

(sh/sh "ag" "\\(deftest " ".") works, thanks!

kauko12:02:09

Now I need to figure out how the pipe operator is supposed to work 😄

leena12:02:16

Does anyone know, why delay does not work with hikari cp?

leena12:02:13

like if I wrap the hikaris make-datasource to delay (def datasource (delay (make-datasource datasource-options))) I can run tests (they don't require the db connection), but then when the datasource is actually created when starting the application I get:

leena12:02:15

Caused by: java.lang.ClassCastException: clojure.lang.Delay cannot be cast to com.zaxxer.hikari.HikariDataSource

mpenet12:02:02

seems like you are trying to use the delay instead of what it wraps (missing a "deref" call)

leena12:02:54

so how should it be?

mpenet12:02:44

I can't guess what your code looks like, but you're probaby doing something like (fetch-from-db datasource ...) instead of (fetch-from-db @datasource ...)

leena12:02:52

:thumbsup:

drbigdata13:02:36

are there any latest trends in setting up a development enviornment

pesterhazy14:02:46

the latest trend is install lein or boot and then run lein repl or boot repl !

gfredericks14:02:53

you should probably also install a jvm

residentsummer14:02:39

@drbigdata well, it entirely depends on your preference. but if talking specifically about trendiness, my best bet will be atom+proto-repl + maybe sayid

residentsummer14:02:40

as for me, boot + spacemacs + cider is a great combo

drbigdata14:02:04

what about a clojure webapp ?

drbigdata14:02:13

http-kit + x + x

mpenet14:02:30

just start with vanilla ring

mpenet14:02:57

using http-kit or some other adapter from the start is not necessarly the best idea

mpenet14:02:29

I mean build on jetty/ring, and add whatever routing lib & co you like

residentsummer15:02:54

That’s not devenv setup I guess 🙂 Recently I was picking tech for a new back-end - ended up with mount + aleph + compojure. Compojure is good as always, mount is great IMO. Bumped into some rough edges of aleph, + need to adapt existing ring response (not request) middleware to use async features.

residentsummer15:02:49

agree with @mpenet - go with jetty if you don’t need anything fancy

residentsummer15:02:41

boot is great stuff too. adding deps when repl is already running - priceless

drbigdata15:02:20

thanks guys, I'll look into it

sveri16:02:05

Getting automatic source code download of dependencies and being able to jump to the source from function call is priceless. This is what I do way more often than adding a dependency to my project.

residentsummer16:02:04

sveri: cider does this

sveri16:02:31

cool 🙂

stathissideris18:02:13

come on clojure 1.9, be released already!</random-rant>

owen18:02:30

anyone have any tips on hunting this down? I'm not sure where reader.impl.commons is being included...

clojure/tools/reader/impl/commons.clj:112:31 - call to method endsWith can't be resolved (target class is unknown)

bostonaholic18:02:04

@owen if you’re using leiningen, you could use lein deps :tree to track down which dependency is using it

bronsa18:02:06

@owen that's from an old version of clojure.tools.reader

bronsa18:02:20

if you upgrade that warning will go away

byron-woodfork18:02:31

Where can you go to read about what will be included in future Clojure versions?

owen18:02:31

@bronsa @bostonaholic ah, looks like it's from the current version of ring

joshjones18:02:43

you could perform inception on Rich I guess @byron-woodfork

zylox18:02:45

i suggest tarot

Alex Miller (Clojure team)18:02:00

@byron-woodfork http://dev.clojure.org/display/design/Release.zFuture has things that have been talked about over the course of the last couple years

byron-woodfork18:02:20

Cool, thank you!

Alex Miller (Clojure team)18:02:02

but that page is unlikely to include things that spring unbidden from the mind of Rich

qqq22:02:44

what are the pros vs cons of the following choice:

choice1:
[:vec2 x y]
[:rect x y width height]

choice 2:
{:tag :vec2
:x x :y y}
{:tag :rect2
:x x :y y :width width :height height}

hiredman23:02:24

choice1 is a sparse notation, optimized for writing, choice give each part a name, which is nicer for reading/accessing parts

hiredman23:02:53

you can get the terseness of choice1 with a constructor function

schmee23:02:31

choice 2 is easier to grow, since it is not dependent on the ordering of elements

hiredman23:02:54

defrecords give you map like naming of parts, and a positional constructor function

dpsutton23:02:01

and since it's keyed access, you can keep a map of :tags to their important (or required) keys

schmee23:02:05

but if you don’t expect your data to change (say a [x y z] coordinate) then choice 1 works just fine

dpsutton23:02:22

otherwise you'd have to keep array indices and perhaps their interpretation

dpsutton23:02:31

and if you go vectors, you cannot easily (possibly?) determine what missing values you might have since its by position, whereas with keys its easy to identify missing entries

qqq23:02:44

for precisely the above (easier to extend, keyed access) I like choice 2. However, the one thing that is frustrating with choice 2 is as follows: 1) my terminal is only 40-60 lines tall. For maps, I like each k/v pair to be on it's own line. 2) Choice 1 = it's "a third of a line // I can write the struct, and continue writing on the same line" Choice 2 on the other hand, takes up 4-5 lines every time I specify a data, which means I can read far far less code per screen.

dpsutton23:02:47

well then the choice is out of the objective and into the subjective

joshjones23:02:17

if it's truly :x 5 length k/v pairs, consider for readability adding either commas or spaces (or both), then you can fit it on a line, and it's still readable:

:x 5,   :y 10,   :width 37,   :height 44

qqq23:02:53

@joshjones: good call, I'll try this for a few days and see how it goes

andrea23:02:55

any suggestion on http://websocket.io client libraries for clojure? (not cljs)

joshjones23:02:13

my two favorite client libraries, based on both their interface, and their speed, are http-kit and aleph. for the client, I think only aleph has a websocket option, though i have only used the standard http client usage for both of these

andrea23:02:36

joshjones thanks! I've started playing with aleph but AFAICT it has only support ws, it doesn't implement (web)http://socket.io that as far as I can tell is written on top of ws but has some encoding of its own

joshjones23:02:46

ah sorry, i could not tell from your post that you meant that library, whoops!

hiredman23:02:54

there is an official java http://socket.io library, I have been using it for testing a http://socket.io server, seems to work well with clojure, pairs nice with core.async