Fork me on GitHub

@borkdude is there a link for that already?


super eager to play around with those more, seems really handy


By my math it’s in about 2 hours?


2 hours and 17 minutes


I had to duck out near the end but it was good!


and yes the p after coffeep was indeed because i was comparing it to a non-parallel version


thanks for attending


I learned some new things


Here are the slides: Youtube video will probably be up tomorrow

Cora (she/her)22:07:05

I noticed fs didn't have anything equivalent to basename path suffix sooooo


@corasaurus-hex (first (split-ext f))?

Cora (she/her)22:07:32

if you want to remove a specific suffix, you have to do tests there

Cora (she/her)22:07:54

or if you want to remove an extension with multiple dots

Cora (she/her)22:07:59

like .html.template

Cora (she/her)22:07:57

it's a common enough need that it's included on the command-line in posix systems ¯\(ツ)

Cora (she/her)22:07:40

someone in #clojure wanted to remove ".md" from the ends of filenames and I thought "I'll bet fs has basename which would be really good at this" and I was surprised to find it didn't

Cora (she/her)22:07:55

@borkdude the single arity version of that function is indeed exactly what you put, though


is base-name the posix term for this?

Cora (she/her)22:07:28

basename will give you the last segment of a path, what fs calls file-name

Cora (she/her)22:07:37

it will optionally remove a suffix


if I wanted to remove the .md extension, I'd probably write (str/replace s #"\.md$" "") ;)

Cora (she/her)22:07:25

in which case, rejecting the PR is a good idea


we could perhaps name this function remove-ext or so.


I'll think about it some more, it's too late for me now :)

Cora (she/her)22:07:49

but it's not exactly removing the ext, because it also removes the path like basename does

Cora (she/her)22:07:35

which is the big trick


(map #(first (split-ext %)) ...) would probably also work in the majority of cases

Cora (she/her)22:07:09

if you're sure they all have the right extension already, definitely

Cora (she/her)22:07:17

if you'e already globbing or something, you'd know that for sure


it's probably better to open an issue or discussion first to see what are the use cases for such a function


and then record the arguments there first


and see how it composes with the rest

Cora (she/her)22:07:11

is the criteria for addition "this is work many people would have to do when working with files"? or is it "this is significantly difficult enough to do when working with files so we'll include it"?


I'm not against including new functions, but taking on new functions also means maintaining them forever, so I'd like to first see some thinking before coding


and having such an issue open also means other people over time can post feedback on it


and give it some time

Cora (she/her)22:07:50

I'll open an issue and link to the PR

Cora (she/her)22:07:47

thanks for the feedback simple_smile


btw, raynes/fs calls this function basename, which I found confusing since some other libs had this function and stripped the extension.


but I now see that raynes/fs has an option to strip the extension. which we could also do in file-name

Cora (she/her)22:07:39

I was thinking that might be appropriate as well

Cora (she/her)22:07:45

and that mirrors basename


ok, good to record the conversation in an issue

Cora (she/her)22:07:15

I like the idea of having it be able to automatically figure out the extension and remove it

Cora (she/her)22:07:24

and also giving it a suffix to remove

Cora (she/her)22:07:38

because removing a suffix is actually more powerful than just removing an extension


I almost opened a PR for this (it was adding an option to strip a suffix) but realized that fs/file-name and fs/extension basically give you all the building blocks. After reviewing the code and how we use babashka.fs in majority of the cases we wanted to full name (as in: with extension), so I dropped it.

Cora (she/her)23:07:13

do you think you could talk about your experience on the issue? it'd be nice to have things collected there, even if ultimately against

Cora (she/her)23:07:23

or I could quote you if you'd like?


Looks like @borkdude already did :-)


I will follow up there too with some additional comments :thumbsup:

partywombat 2
Cora (she/her)22:07:42

do your worst 😉