This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-12-14
Channels
- # adventofcode (29)
- # aws (3)
- # babashka (25)
- # beginners (13)
- # calva (4)
- # cherry (7)
- # cider (26)
- # clj-kondo (9)
- # clojure (88)
- # clojure-europe (21)
- # clojure-losangeles (3)
- # clojure-nl (1)
- # clojure-norway (6)
- # clojure-uk (11)
- # clojuredesign-podcast (2)
- # clojurescript (4)
- # cursive (10)
- # datalevin (1)
- # emacs (50)
- # gratitude (1)
- # honeysql (12)
- # hyperfiddle (19)
- # jobs-discuss (28)
- # kaocha (3)
- # lsp (53)
- # malli (4)
- # meander (3)
- # off-topic (48)
- # re-frame (11)
- # releases (2)
- # ring-swagger (2)
- # shadow-cljs (50)
- # squint (26)
- # tools-build (3)
- # tools-deps (8)
- # xtdb (4)
- # yamlscript (1)
Hi all:) Seeing all the cool gifs posted here, I wondered: What are the easiest ways to create a gif from a screen recording?
I use linux but I guess the same applies: 1. Some quick tool to record a gif immedately, maybe https://giphy.com/apps/giphycapture or something, on linux i use Peek or Kooha 2. Conversion of video -> gif I use some hacky ffmpeg + imagemagick scripts, but theres probably a mac app for it as well
I use gifski for short animations/screen recordings. It’s on App Store and developed by Sindre Sorhus (well known in the JS community).
For linux users https://github.com/phw/peek is awesome For cross-os solutions VLC is always able to record screens.
Since we're recommending video recording / GIF creation software, on macOS https://cleanshot.com/ is very good!
Hello 👋 I would to love to learn if anyone has any experience of programming in Python after they’ve programmed in Clojure for a little while? 😉 I’m now getting a bit into tinkering with AI/ML things— of course domain knowledge + APIs (pytorch, numpy etc.) dominate, but… I’m curious to hear if anyone has any observations/reflections/tips on programming Python with ‘Clojure brain’ 😜 (areas of interest: state mgmt, interactive development, ‘data driven’ development, functional programming, things like that…). 🙏
I'm the other way around - came to Clojure from Python (and Java, and C, and C++, and JS,...), so not sure how useful my advice would be, but still. So, the advice: don't. :D Stay in Clojure for as much as possible. You definitely don't need Pandas and NumPy - there are similar Clojure libraries for it. Same for SciPy, or at least for a significant chunk of it. There are libraries for AI/ML, although I personally have no experience with them. If there's just no alternative, there are still two approaches: either make that alternative, or use https://github.com/clj-python/libpython-clj.
Thanks Eugene! In generaI 💯 agree 🙂 I’m not planning to move anywhere 😉 I’m also aware of the amazing work that people in the SciCloj community are doing! For me, the journey into python is going to be mostly educational, as most of the content on AI/ML etc. is ofc written in Python and I would like to at least get to a level of a competent tinkerer to be able to benefit from that knowledge. I’ve had some experience w/ Python in the past, but that was in the days of 2.7 etc. Also my brain was wired a bit differently then, pre-clojure 😉 So I was curious to hear what people who ‘have to’ use Python think about it? Is there a way of working with it that would make a Clojure programmer feel (more) at home?
Another alternative I'll just throw on the table for consideration is hy lang (<https://hylang.org/>). It's a lisp that's fairly clojure-ish, but atop python.
> the journey into python is going to be mostly educational Hmm. That kinda contradicts the "make a Clojure programmer feel (more) at home" part, so it's hard to figure out what the advice should be. Learning Python in an fashion that's the most suitable to you along with reading and changing sources of existing Python projects would probably be the most educational. But also the least welcoming for a Clojure developer. Learning Hy is the opposite.
Also, not that much has changed since the days of 2.7. Yes, some new syntax, some new descriptors, slots, optional types, yada-yada. All fluff, the core of the language is still there (apart from the things that they keep moving and changing even in 3.* releases because screw backward compatibility).
The ‘educational’ is meant to refer to the AI/ML side of things, I don’t necessarily plan to explore the depths of the language and lib ecosystem etc. In that context—“make you feel at home” is just for the duration of the journey 😉 The kind of advice I was thinking of would be along the lines of: “you might find list comprehensions nice, but avoid X, Y, Z cause that might be a gotcha coming from Clojure”, but maybe there just is no generic advice like this that can be given without more context. But a good thing that I’m hearing is “the core lang is there, don’t worry about the new stuff initially”—thank you for that 🙏
Ah, well. Most of the stuff is mutable, so don't trust anything. Even reading things will occasionally mutate something. Debugging some Python programs is "fun" because of that.
I wrote my first line of python after more than 7 years of exclusively working in clojure. I've written a lot of perl back in the cgi days of the web, and done some ruby too, so I felt like python would be easy enough to pick up. This project wasn't a ML thing, so I can't comment on that. I worked on that project for 6 months ish, and moved on. Things that I remember thinking in no particular order: • python has lazy seqs in the form of list comprehensions with parens rather than square brackets! • the python ecosystem breaks backwards compatibility on minor version releases - requiring significant reworking of code to make it work on different installations • you can write functional code in the same way you can in js - but it requires a bit of mental gymnastics - but I felt like it was worth it at the time ;)
Oh, beware of scoping:
Clojure 1.11.1
user=> (doseq [f (map (fn [i] (fn [] i)) (range 3))] (println (f)))
0
1
2
nil
but:
Python 3.9.12 (main, Apr 21 2022, 11:34:27)
[GCC 11.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> for f in [lambda: i for i in range(3)]: print(f())
...
2
2
2
hm, so i
is not local to each lambda
? is that what’s happening? that is indeed… interesting
Thank you @U0P0TMEFJ! Love the last point 🙂 On of the last things I remember from when I was using Python was some discussions where Guido vR wanted to de-emphasis some of the tools usually associated with functional style (map, filter, reduce)—I might be mis-remembering though so don’t quote me on this 😉
> Closures there are over names, not values. Same thing in JS. yes, I see, that would’ve tripped me up
Yeah, Python community as a whole decided to shun lazy collection functions for some reason.
Oh, another "cool" thing in Python:
>>> i
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
NameError: name 'i' is not defined
>>> for i in [1, 2, 3]: pass
...
>>> i
3
I can understand that to some extent, i.e. they just sort of decided to embrace it rather than pretend they are some other kind of language
I’ve also seen quite a bit of scope shenanigans with nonlocal
& global
inside of some libs I’ve been looking into, might have been necessary, so I don’t judge but definitely made me uncomfortable 😉
After having dealt with a lot of Python code in its ecosystem, I skew heavily towards the "it was not necessary and only made things worse".
In general, developers in the Python ecosystem tend to significantly overuse dunder methods, meta stuff, nonlocal
/`global`/`locals()`/`globals()`/etc.
Yes! It was a bit surprising to me, what I remember was that more ‘advanced’ or meta programming techniques were not really idiomatic, there were some talks on meta programming getting some interest, but it was more of a fun/fringe thing, not an everyday kind of programming, my perception at the time was that some version of the ‘simplicity’ ethos was also quite strong there (esp. w/ python 2.7)
I have a couple of posts and examples about Python and when coding with a Clojure mindset, such as REPL Driven Development.
And maybe this one (inspired by “just use maps” in ). But I’ve received some negative feedback about it 🙈 From my experience, there’s some devs within Python that leans on typing in a Java-like style, and some dislike dictionaries. https://davidvujic.blogspot.com/2022/07/just-use-dictionaries.html
I've enjoyed using the Dataspec Python package at work: https://dataspec.readthedocs.io/en/v0.3.2/ Strongly agree with @U018VMC8T0W (also: thanks for Python Polylith!) re: just using maps (Python dicts).
vscode has a nice interactive repl for sending forms from the editor - it's only for notebooks though I believe https://code.visualstudio.com/docs/python/jupyter-support-py
Great recommendation, @U051V5LLP. Likewise use notebooks to approximate the REPL.
@U051V5LLP I’ve seen in it somewhere but it escaped me, thanks for the link—makes more hopeful 😉 (EDIT: I’m probably not going to fight this one and just roll with VSCode but I would prefer Emacs; EDIT2: I see David has some info on Emacs, amazing!) @U03CPPKDXBL & @U018VMC8T0W thanks for the tips, reading through the blog posts now 🙏
https://gist.github.com/werenall/bba5438c3e78a1cca63d4d2ab14561b7 Couldn’t find any secret santa webapp that wouldn’t require account creation so I wrote one (well… two actually) 🙃 And man I wanted to code with some emojis for years. Finally found a silly excuse to do it 😅
Hi, does anybody know what happened in 2014? (source: https://madnight.github.io/githut/#/stars/2023/3)
Java got lambdas?
Oh for Clojure. I was looking at the link where Java trended up and Ruby down
Transducers?
Perhaps React came out and it was a good fit for ClojureScript which spawned Reagent, Om, etc?
^ IIRC David's React post that went viral was this one from December 2013, so that might fit. I know there were also a couple of RH talks that got a ton of traction, probably Simple Made Easy and Are We There Yet?, but those were earlier I think, maybe 2011 or so. It also might be that 2014 was just the main year that Clojure was the Shiny New Thing that all the language bloggers wrote about... https://swannodette.github.io/2013/12/17/the-future-of-javascript-mvcs/
This is a pretty cool tool: https://www.videogist.co/videos/design-in-practice-by-rich-hickey-2040