Fork me on GitHub
Ben Sless05:05:07

Did you turn on warn of reflection?

Ben Sless05:05:00

And is that with a lein repl or deps?


with deps and I did turn on warn on reflection which is what gets me


i just assume aset does reflection otherwise i dont have an explanation

Ben Sless13:05:28

It does, you need to type hint it


Okay so even with the objects hint still getting this in the bytecode


Reflector.invokeStaticMethod(RT.classForName("clojure.lang.RT"), "aset", new Object[]{const__5.getRawRoot(), RT.intCast(i), const__7});

Ben Sless14:05:09

Where did you put the hint?


(aset ^objects regular-small-array i 10)

Ben Sless15:05:34

Found it, you need to box 10

Ben Sless15:05:03

this is well behaved

(def n 10)

   (doseq [i (range 100)]
     (when (even? i)
       (aset ^objects regular-array i n)))))

Ben Sless15:05:17

And it's faster

Oliver George05:05:56

Free idea: a tool which generates conservative preconditions for a defn form based on how it uses inputs (static analysis of direct use - no consideration for how args passed to other defns might be used).


why statically though? Sounds like best done at runtime (just like with code coverage tools)


Hi. I am curious, what type of programming do you do at your job? Backend for web apps Frontend Mobile Software for systems (planes, cars, IoT devices, etc) ML/Data science Would love to hear about other type of programming/application you are working or that you know other people are working in Clojure

Martynas Maciulevičius14:05:12

I use XTDB and I'm making a database for back-end devs to use. And then I do DB relationship modelling and then I do some system design as in performance improvement or some kind of new query type support (I implement them by hand). It's quite far away from regular DB stuff because some of the things found in SQL DBs simply don't exist here. And I have to... code them... Edit: It's not that I'm trying to make XTDB into ACID SQL DB. In here I have something very different from most systems that I saw in the past.

👍 1
respatialized14:05:06 you may be interested in last year's State of Clojure survey for a high-level view in addition to whatever experiences people share here. I think we'll get a writeup of this year's results soon as well :pencil:.

👍 3

Hi. If somebody had time to learn one other language in addition to Clojure, what would language would you recommend. Criteria for choice could be better programmer, or complement Clojure to make one more effective in writing apps, etc. Just curious


ClojureScript :-D

😁 1

Java but only basics, try to avoid learning frameworks like Spring 🙂


Javascript because... You can't escape it 🤷


I've been wanting to get more into Rust. Seems to cover Clojure's limitations well.

👍 4

Haskell. I don’t know Haskell at all, but I enjoy getting a peak at the algebraic types in Clojure. Also it’s nice to understand what a nice statically typed language is all about so it’s easier to understand the tradeoffs

👍 4

I like the Pragmatic Programmer advice of trying to learn a new language every year. Every year is a bit of a stretch, but I generally manage one every couple of years. Haskell is definitely a good suggestion. Prolog and APL are two others that are "different" and make you think about problems in a completely different way. Other languages I've found interesting to learn alongside Clojure -- just for "fun" and to improve my thinking -- in no particular order: Go, Kotlin, Rust, Elm.

👍 2

> Criteria for choice could be better programmer In terms of the former, if you don't care about whether you'll be able to use them in production, I'd consider: Prolog (or learn core.logic in Clojure), Forth, Haskell, some variant of Smalltalk. >> , or complement Clojure to make one more effective in writing apps, etc. For this I think it's useful to learn a language that's much closer to the bare metal -- C, Go, Rust, maybe even assembly.


maybe I've become complacent but haven't learned much (anything?) PL-wise in many years. rich 's stance on mastery (it's easy to google with that word) deeply resonated with me, so I've been happy to master Clojure, in a few dimensions. In practice it has paid off - it's really useful to be able to pick up a variety of projects quickly (which is handy as a contractor, OSS lover, and likely more!), or design new solutions in unsuspected ways.


@U45T93RA6 I don't think that stance is at odds with also learning enough of other languages to pick up alternative ways of thinking about problems -- and I think several languages have features that can teach us important lessons about idioms in Clojure. For example, Go's error handling provides good insight into whether to use exceptions in Clojure or structured results containing error/success information (and working with Go's channels etc can help master core.async); Haskell helps focus on separating side effects and pure functions; Kotlin helps us think about nullability, especially around interop. I think even Rust's borrow checker can teach us to think more precisely about lazy sequences and holding onto the head of those... I always view learning other languages as an opportunity to improve mastery of my "home" language.


Yeah, these aren't exclusive approaches and of course is up to one to decide what the right balance is


There's a lot of cool languages to learn just for the experience, and there's a lot to recommend just for practical reasons. If you have a goal in mind then we could probably be more specific


I like rust and Lua because they fill in the minor gaps where clojure doesn't fit that well (embedded systems, or low memory things)

babashka 4

I keep thinking I should spend time learning Haskell although I have already mostly made up my mind. What would be a good lisp to spend time on? Elisp is obvious because I use Emacs but maybe something else would be worth it too.


Common lisp and scheme are common ones (people use it for trying to follow along with the SICP book)


I am not sure I understood Rich Hickey's point when it comes to programming practically speaking. Would his point imply: learn programming in the fundamental sense (Data structure, Algorithm, problem solving type of stuff) or does he mean learn one programming language deeply...would love to hear your takes


I wish "the entire premise" that he was disagreeing with had been preserved in all those gists and discussions. There's an interesting HN discussion about it -- normally I wouldn't recommend HN for much but there's some good back and forth on reconciling some of Norvig's advice with Hickey's advice.


I'm very much in the "it's useful to learn multiple languages" camp but I don't mean "you should switch languages every few years". I mean it more in Norvig's sense that having exposure to several different ways of thinking is helpful to improve your specialty and see the "big picture" -- if nothing else, it helps reinforce why Clojure (for example) doesn't do X or does Y differently to <insert other languages>. I've focused on being a backend developer, often close to the database, rather than trying to be a full stack developer, for example. The three main areas I've spent time on that were really challenging were: databases, parsers/compilers, and network stuff, roughly in decreasing order of experience.


I think the best way to select a new language to learn (to a reasonable degree) is to look for either reach, alien concepts or both. Reach as in it is used in different contexts or domains. Say bash vs C vs JavaScript vs Julia. Alien concepts as in different way of thinking and programming. Say Forth vs APL vs Scheme vs Go. Examples: I'm currently learning Rust, because it has reach into lower level programming and introduces concepts that are alien to me such as affine types. And bash because I never got around to really learning to use and structure it well, but it is so damn practical. Forth is on my list, because I it seems so alien and quite unique.


Oh and I'm also learning TypeScript, because of practical reasons, but it turns out it is more interesting than I initially thought.


In terms of breadth vs depth and mastery, I say "learning a new language" as more of a hobby thing. Having fun with it, asking myself questions and exploring it, maybe write some useful or fun little programs. I don't think that does any harm :)


@U077BEWNQ Ah, I missed that there was a link to the non-existent comments from that blog and that it was originally from Rich... Thanks.


Yeah, the comments aren't preserved even in the Wayback Machine versions I looked at, but I think it's pretty clearly a response to the original blog post, since eg the bullet points in Rich's 'imagine your proposal recast' section are modified versions of topic headers in the original post.


I'll +1 APL, learning it was definitely the most brain-stretching experience I've had in a while


I would definitely go for a static typed language with a strong type system like Haskell.


I spent almost a year on Haskell, and unpopular opinion, but I think the time and energy I put into category theory and working through a Haskell book and eventually writing a real Haskell application (which I could write in an hour in Clojure) maybe wasn't worth it


It's of course hard to measure scientifically what I learned from it and not everything has to be productive


Do you think you really need to learn the math / theory to be able to understand / work in haskell ?


I keep wanting to work through Learn You a Haskell, but I think I'd be terrible if I had to learn a lot of theory first


Yes, you really need to understand the category theory (monads, functors, monad transformers) to be productive in Haskell. If you're just messing around you won't get very far.


To add to what borkdude said, I think you don’t necessarily have to understand the theoretical underpinnings of the category theory you’re using in Haskell, but you do have to understand what the functor/applicative/monad abstraction is to understand how to use it, so while you can often get by with an informal (i.e. non-mathematical) definition for those, you do end up touching on some of the underlying mathematical ideas

👍 2

Agreed. I have a BSc in Math (w/Comp Sci) that was very traditional from an English university so there was a lot of theoretical math included -- and when I learned Haskell (the first time -- I've "learned" it repeatedly since the early '90s!), I found myself drawing on that math background, even subconsciously. I am always very skeptical when Haskellers claim "Oh, you don't need a category theory background to learn Haskell!"... I think that's glossing over a lot of foundational knowledge 🙂