Fork me on GitHub
#beginners
<
2021-02-08
>
seancorfield00:02:17

That PR does not remove the .test. part so those paths still have strange names for tooling...

seancorfield00:02:26

Hmm, that wasn't what I was expecting... but, yeah, that's the official forum. OK, posted a new topic about it for tracking purposes.

seancorfield00:02:49

It seems like you'd need to change the Luminus template as well since that PR isn't quite right.

seancorfield00:02:27

(I hadn't actually noticed that glitch when I read that section of the book -- I think my mind just auto-translated it to what I expected!)

yogthos00:02:30

and makes sense

Klavs Klavsen13:02:41

What would be the best way to loop over a list of maps (returned from a function) - and doing something when/if X ?

Klavs Klavsen13:02:23

I thought for could be used.. but it seems to only want to do a let.. and since I NEED to call "remove user" - I would have no need for the let.. which seems a bit wasty/wrong then.

Henri Schmidt13:02:21

What do you mean by "do something"?

Henri Schmidt13:02:40

Do you mean "transform the maps in some way, returning a sequence of transformed maps"

Henri Schmidt13:02:58

Because if so, then I recommend using the map function.

andy.fingerhut14:02:00

If you want side effects in iteration, you can use doseq, which is similar to for but intended for iterative side effects

🙏 1
agile_geek15:02:00

Or run!to apply a function over each entry in a collection for side effects.

agile_geek15:02:40

So doseqis the non-lazy equivalent of for whereas run!is like the non-lazy equivalent of map. Another option is doall but I’d prefer run!

🙏 1
noisesmith16:02:39

@U018FH7446P there are resource intensive constructs in clojure, let is not one of them. for is a lazy sequence generator (not a loop), and requires a body for generating a new output for each combination of inputs, but it sounds like you aren't trying to produce a new data structure, so don't use for

🙏 1
michaelteter17:02:24

Is clojure.spec used much in real projects? (It looks very attractive to me as an outsider, and I'm thinking of making a demo to my company to entice them to try a clojure project). I wouldn't want to promote an approach that may not be "the way" things are done these days.

noisesmith17:02:32

it's used, but not by everyone. IMHO the common mistakes are to treat it as if it were your type system or a coercion system. it's best at being a fail fast layer between parts of a system - like a fuse that goes off if the wrong shape of data passes through.

caumond17:02:51

Malli is quite good also. Personnaly what I started with spec has been into malli. Easier to read and share, compose store ... apiified. Search schema malli spec to have comparaison articles.

👍 1
michaelteter17:02:26

👌 thanks

seancorfield18:02:44

@U9RGZJC4C We use Spec very heavily at World Singles Networks -- and have done so since it first appeared in a Clojure 1.9 prerelease build (which feels like "years" ago now). I wrote up the various ways we use it: https://corfield.org/blog/2019/09/13/using-spec/

seancorfield18:02:40

With the caveat that there is a Spec 2.0 in development which will be quite different in some areas, Spec has proved to be very stable, solid, and useful for us, both in dev/test and in production.

West17:02:19
replied to a thread:

Ok, so I’m thinking of taking a different approach. Instead of trying to use graph theory and springs, I was thinking of doing a brute force approach. Assign higher scores to greater compatibility, (ex. yes-yes would be higher than yes-maybe, yes-no, maybe-no, etc.) then try each combination of group configuration until they converge. I’m not sure how I would approach this at all.