I had no idea slurp did this!!!
ys -e 'say: slurp("")'
Makes ys::std/curl useless 🙂
Yeah its pleasently, shockingly simple!
I love it!
Saw it here this morning https://www.youtube.com/watch?v=rQ802kSaip4 while watching videos to boost my repl knowledge
Nice short video
slurp is a wonderful bit of "Java candy" from prehistoric Clojure... just be aware it negotiates and tears down the HTTPS connection every time, so, it is very slow in a loop.
Interesting that its from Java. Makes sense as Clojure feels pretty no nonsense (or do the nonsense on your own)
In that light I'd say YS is pro-nonsense. Function needs a sequence and a string but you forget what order. Don't worry YS got you. If it's too slow, there's 5 other ways to do it, and always the most clojure way...
I literally spend ~25% of my clojure time remembering how to call the functions I used yesterday 😕
I guess I don't want to become a Clojure expert when I grow up...
Like why do I have to (atom nil) instead of (atom) ?
(hit that a minute ago).
Many functions have nice defaults and arities, but then many don't.
Many thread nil to nil, and many don't.
You can reliably nil-pun sequences.
I know but it should go further imho
So yesterday I told you I posted https://yamlscript.org/posts/jun-20-2024/ which got no noticable interest here. Well I have to say I'm using this thing in anger now, and quite happy with (at least some of) the results. I just needed to figure out how to split markdown file string into fenced-code and text in between. I decided to ask https://gist.github.com/ingydotnet/0dbc71cf2c827d24855b239a0d518b69 Not perfect but worked really well for me. Was able to make this for my exact needs:
defn split-on-fenced-code(markdown-str):
code-block-re =: /(?s)(?:MY:\S+\n.*?\n\n)/
texts =:
split markdown-str: code-block-re
fenced =:
re-seq code-block-re: markdown-str
interleave texts: vec(fenced) + ['']
Seems not the most efficient, but certainly efficient with my time (except that I used more time writing about it here 🙂 )