Fork me on GitHub
#beginners
<
2023-08-29
>
Chip02:08:55

As I said in my https://clojurians.slack.com/archives/C0218CKTVEK/p1692842517062129, I’m not a hardcore coder…yet anyway. I’d like to make my project as functional as possible (in as many senses of the word as possible). To that end, I intend to build specs and tests from the beginning — and I hardly know what that means. Though I haven’t found the idiom anywhere, I have created /test and /spec as siblings to /src and intend to build out the structures in parallel. If this doesn’t make sense, I’d appreciate a poke and a link to a doc or something. If once in awhile you could check in on me on my https://clojurians.slack.com/archives/C05P6UP4G2K, I’d sure appreciate your over-the-shoulder glance. I’m in all kinds of trouble and will be for awhile. Your morbid curiosity won’t be unsatisfied. 😉

seancorfield04:08:03

Generally Specs would be part of the source of your project, rather than a sibling.

gratitude-thank-you 2
seancorfield04:08:50

I blogged about our various uses of Spec at work a few years ago, if that helps https://corfield.org/blog/2019/09/13/using-spec/

gratitude-thank-you 2
Young-il Choo06:08:28

@U05ML354JLU Though it's educational to build a project from scratch, when you want to see how to automatically set things up, I suggest investigating this package by Sean (who is too humble to suggest it himself): https://github.com/seancorfield/deps-new

seancorfield18:08:49

There's a #C019ZQSPYG6 channel if you run into any problems with it 🙂

gratitude-thank-you 2
Chip23:08:09

deps-new is very helpful. Thank you again.

2
Daniel Shriki14:08:48

Anyone knows any clojure function to calculate the minimum of sequence of maps? something similar to sort-by

dpsutton14:08:53

i’m not sure i understand your question

dpsutton14:08:02

something like this?

(apply min-key :price [{:price 5 :name "table"} {:price 1 :name "chair"}])
{:price 1, :name "chair"}

Daniel Shriki14:08:02

(sort-by :rank [{:rank 2} {:rank 3} {:rank 1}])
-> ({:rank 1} {:rank 2} {:rank 3})
so if there is something like min-by the result for the same input would have been {:rank 1}

dpsutton14:08:41

core=> (doc min-key)
-------------------------
clojure.core/min-key
([k x] [k x y] [k x y & more])
  Returns the x for which (k x), a number, is least.

  If there are multiple such xs, the last one is returned.
nil
seems like it might fit the bill for you

🙏 2
Daniel Shriki14:08:23

Cool! thanks 😃

Alvydas Vitkauskas15:08:16

I’d very much recommend keeping this page open in your browser while you learn Clojure. It filters interactively while you type in the search field, so finding functions is a breeze. http://jafingerhut.github.io/cheatsheet/clojuredocs/cheatsheet-tiptip-cdocs-summary.html

👍 2
nitin14:08:02

it should show min-key but shows max-key 😅 but still its so much useful knowing different functions for the same task

nitin05:08:48

my bad, we need to give first argument for better results, how'd it know which key to work upon, so after giving :rank as function, which is valid for maps, it gives min-key as expected

Ronny Li18:08:49

Hi everyone, I'm using malli to coerce a CSV into a particular schema. One of the columns is supposed to be a double but some rows contain an empty string "", which lead to schema coercion errors. Can I modify the schema to ignore these empty strings (converting to nil instead)?

pppaul18:08:33

you can use [:or or [:maybe or you can change the coercer decoder to turn empty strings into a 0

🙏 2
saleem khatib23:08:49

Hi, I'm new to the clojure community and to software in general but would like to contribute to repos. Is there a beginner friendly repos that I contribute to?

2
👋 10
👍 2
seancorfield01:08:05

My general advice about this is to build some projects, in domains that interest you, using a variety of libraries and see which libraries interest you the most and if there's a community for those libraries, join it and talk to other users, and look in the repo to see what issues are open and/or ask the maintainer(s) if there's anything specific they're looking for help with. A lot of projects would really benefit from extra documentation, especially aimed at beginners since it is often hard for a maintainer to really get into a beginner's mindset and know how to write for them. Tests too -- that's another area that maintainers often appreciate help with. As a long-time OSS project maintainer myself, I am always extremely grateful when people contribute to any of the documentation or tests on my projects!

4
❤️ 4
saleem khatib10:08:36

thanks @U04V70XH6, I took your advice and trying to work on buddy.auth since It was really beneficial to me and lacks documentations.

pppaul16:08:33

@U041J7H42RH find tools (clojure libs) that you want to use to do your own work, find bugs in them, then push PRs. people in this slack know of a lot of interesting libraries, and they all probably have bugs. even very popular libraries have bugs, or incorrect docs at the least.

seancorfield16:08:55

Always start with a problem statement. In general, most maintainers prefer that an issue (or discussion) get created before pull requests happen. Make sure that what you think needs fixing is actually something that the maintainers agree needs fixing and that they're likely to accept the approach that you have in mind -- you're much more likely to get a PR accepted if there is consensus on the problem being solved and the approach being taken.

❤️ 2