Fork me on GitHub
#off-topic
<
2020-04-28
>
nthd3gr3306:04:13

Is this style guide (https://github.com/bbatsov/clojure-style-guide) the authoritative style guide for Clojure right now? Are there any competitors? I am trying to create contributor guidelines for an open source project and I want to make sure I am giving contributors the right guidance.

🙂 4
andy.fingerhut07:04:54

It is certainly the best known one. Plenty of Clojure developers will have points of disagreement on at least some of them, so there isn't any kind of unanimity of opinion on them.

andy.fingerhut07:04:25

I am not aware of any other Clojure style guides.

nthd3gr3308:04:55

Thanks so much!

joelsanchez09:04:41

didn't know about this one, agree with all of it, wish everything followed it tbh

joelsanchez09:04:24

they should add "use set instead of into #{} " as that one annoys me a bit too haha

seancorfield17:04:16

@U5LPUJ7AP A good reason for preferring into #{} over set is that the former supports transducers: (into #{} xf coll)

joelsanchez17:04:58

yes, that usecase is valid to me, for sure. but if you're not using a transducer... 😕

seancorfield17:04:39

Consistency would suggest using into #{} for all cases where you produce sets from collections, so it covers both the transducer and the non-transducer case.

seancorfield17:04:20

(That said, I use set for the non-transducer case sometimes)

seancorfield17:04:24

Under the hood set and into #{} are almost identical: both reduce with conj into a new set (unless the input coll is already a set, which is an optimization in set).

joelsanchez17:04:40

makes sense. on a related note, good style would dictate that you don't use ->> with just two arguments (for what?), yet when I use map I tend to prefer to use ->> anyway, just because that's how map is used most of the time and it's more consistent I guess? bit easier to read

seancorfield17:04:10

Yeah, I sometimes use -> or ->> with just two expressions because I find the pipeline ordering easier to read than the nested function calls, but it depends very much on what those two expressions are.

seancorfield17:04:44

If the wrapping function is simple -- taking a single argument and having a relatively short name itself -- then (wrapper (map ,,,)) is fairly readable. Otherwise (->> (map ,,,) (wrapper-with-a-long-name :and :additional :arguments)) is more readable when split across two lines.

jsn10:04:49

I'm designing a clojure application that has to, among other things, manage linux ipsets / iptables. Only root can do that, apparently. What are the best practices for things like that? I could run the whole app as root, but that feels wrong (because you should minimize the amount and complexity of code running as root). I could call e.g. "sudo ipset" from my app, but that would either spam the system logs endlessly or I'd have to kill logging in sudo altogether. I could write a small wrapper to do setuid + exec ipset, but then I'll have to leave clojure land for that. Is there some standard solution / pattern for situations like that?

orestis10:04:45

@jason358 The approach that Apple takes on macOS is to have dedicated processes with elevated permissions, and use some kind of inter-process RPC for doing the work. Perhaps might be applicable to your problem.

jsn11:04:32

yeah, it's a variant of the wrapper thing (in my case exec with args + slurp stdout is a good enough RPC, I suppose)

orestis11:04:29

I guess if you want to make it more “official” you could wrap it in its own persistent process.

agigao15:04:33

Hi there, My nephew, 19 yrs old CS student moved in during pandemic and I'd like to teach him some important stuff that will help him in his career. Any suggestions regarding an online course he might take? I was thinking about The Hardware/Software Interface as a low-level dive, also was considering SICP, How to Design Programs, etc etc. Would like to hear other opinions about - what would you have taught to this kid next few months?

kenj16:04:39

What are his interests and motivation for doing CS in the first place?

💯 12
hindol16:04:22

SICP is amazing but not from a career point of view. Maybe get him started on some cool open source projects?

jaide17:04:30

I feel like it's a missed opportunity to just assign him some books. What's your nephew interested in? What's their current experience level? How do they learn best? Would they prefer to learn from writing practical projects or learning academic concepts?

Phil Shapiro17:04:48

I took the SICP course when I was 19, and it had a lasting, positive effect on my (25+ year) career as a software engineer. I agree that it’s not a book that will train you to write commercial software, though. Maybe both the book and the open source, for the applied side of things.

jaide17:04:10

Unfortunately due to the situation the board where I work decided to let go our recent FE intern. I decided I didn't want them to leave empty handed so I started working on https://github.com/eccentric-j/learn-ramda which creates unit tests to teach RamdaJS and functional programming concepts.

phronmophobic18:04:57

I definitely recommend something that is project based. when I used to interview lots of new grads, applicants with “here’s this thing I built” definitely stood out. it’s also a great way to quickly gain a lot of practical experience. any project that they’re passionate about can work, but if they don’t have something in mind, I would recommend building a 2d game without using a game engine like unity/unreal. it’s fun and you learn a ton. I had friend ask a similar question and compiled this list of self-learning resources from around the internet: https://gist.github.com/phronmophobic/3235725ad11087fe0d48ab7f145714c4

✔️ 4
agigao09:05:16

Thank you guys for your replies. @UBHTL6AF3 I’m not sure he knows the answer to the question, hopefully he’ll figure it out sooner. @UJRDALZA5 And it’s a long one as well. @UQL85PT29 Yeah, SICP has provided me with clarity I had never dreamed of before. Invaluable resource. @U8WFYMFRU @U7RJTCH6J Gifted to him learning C++ programming through building games (In the first semester, the uni decided to introduce kids to programming with c++), but I don’t see much enthusiasm from his side. Anyway, I decided to settle down and try http://fast.ai course, to give him an idea what can be done using current “bleeding-edge” tech, and realization that he also is capable of doing it.

jaide18:04:10

https://www.youtube.com/watch?v=L6w4y6_ENdU got me thinking if there are any FP languages great for game dev?

lispyclouds19:04:35

I wanna say https://elm-lang.org/ ? With the caveat that its browser based things only. IMHO, its Functional Reactive approach and emitting the whole of HTML, CSS and JS from one lang helps in thinking about UI and Graphics as a single entity. Purely my thoughts though! 😄

👍 4
lispyclouds19:04:52

And it has great perf

lispyclouds19:04:02

Also maybe https://amethyst.rs/ with Rust, if we wanna look at Rust more from an FP lens than imperative. :thinking_face:

Vincent Cantin00:04:53

I would say that Clojure is a good candidate as a language, but the runtime and some “core functions” may need some modification to use less memory allocation/de-allocation. The Arcadia project is pointing to this direction.

emccue02:04:59

I don't think Elm or Clojure are particularly well suited to game dev, but i am welcome to being proved wrong