Live data from Hacker News

How much can a Clojure developer do alone?

yyhh.org

101–106 of 106 posts

Re: How much can a Clojure developer do alone?

#101
post #94

I don't use Clojure, but I've applied some of its lessons to my work in Julia. The biggest one is the benefit of using simple, literal datatypes over classes/structs. If a function takes literals, you can just pick it up and run it, and if most of your code uses simple data types, it's more composable by default. The mini-project I'm working on now has just one custom type, if I had written it 2 years ago it would pr…

Pretty interesting topic. I am all for composability. However, I don't necessarily agree with particular benefits of pure data literals. I feel more secure when I wrap even simple types like Strings so that ItemId, UserId is a String but I cannot interchange them. Similar level of composability with objects and structs can be achieved with generics and traits. I have a code that operates on arrays and matrices howeve…

For sure. You can think of static types as deliberately preventing composability in cases where you definitely don't want it (e.g. passing in a user_id when dollars are expected), and that's often worth it.

The point about matrix types is interesting, because Julia does have a huge host of matrix types, which are primarily used for efficiency via multiple dispatch. Some examples are upper triangular, symmetric, diagonal etc.

One cool case is UniformScaling, which is an almost-matrix representing the identity times a constant. It's stored as just that constant, and can be used in 90% of the places a matrix can be used. Implementing these sorts of partial interfaces is one of the tricky parts of static typing, especially when you have multiple partial interfaces for one main interface. You can get around this with typeclasses a la Haskell, but that's a lot of overhead, especially if you have just one example of each partial interface.

Re: How much can a Clojure developer do alone?

#102

Earlier quoted context omitted.

That's why you write code in your editor, and just ask your editor to send code to the REPL.

Why not just run the file? To be more specific, I get a lot of value out of Ruby, Elixir, and JavaScript REPLs because I can type right into them to try stuff out in one long, ridiculous command. If I have to type in a file, I'm just gonna run the file & print the result.

>Why not just run the file?

It's faster. That's the point of using a REPL.

>To be more specific, I get a lot of value out of Ruby, Elixir, and JavaScript REPLs because I can type right into them to try stuff out in one long, ridiculous command.

You can type long, ridiculous commands in a file too. Just clean it up as you go along.

I like to use my editor to send inputs to the REPL instead of typing directly into the REPL because different REPLs provide different editing experiences. Using my editor means all the editing features I like to use are always available.

Re: How much can a Clojure developer do alone?

#103
post #80

Earlier quoted context omitted.

To me, that's similar to waiting to save your Word document until you have finished editing your document. REPL should be used for rapid experimentation, but then the code should be transferred to a source file and saved before moving on to the next thing.

When doing REPL dev with clojure, I usually never type directly in the REPL, it's connected my editor and there are shortcuts for evaluating forms already typed in there (e.g. form under cursor, form before cursor, outer most form, entire file) and it outputs the results right after the form (as a temporary display or can even be output the text into the file). There's also the handy "comment" function that lets you…

That is my understanding of REPL driven development, too.

Re: How much can a Clojure developer do alone?

#104

I’d really like to see a video of someone doing this REPL driven development. I’ve never come across one though. Has anyone?

I like this video. IMHO it is a good example of REPL driven development. Nothing to do with typing things into the REPL.

https://youtu.be/C-kF25fWTO8?t=1039

Re: How much can a Clojure developer do alone?

#105
post #4

> There is no other language that places such an emphasis on programming directly with plain and naked data literals. Counterexamples: Erlang and Elixir. Arguably also Prolog. Also Lua. Many Schemes, and Racket. Of course, REBOL and Red. TCL probably, too. I can't help but think that people making claims of "no other language has X" are in most cases wrong, and should study a bit more before making them. There's a lo…

> [1] Why aren't we all writing in APL/K/J if it matters that much? Because most programmers aren't nearly as productive as we could be. And because "concise" should be measure in the number of tokens needed to achieve certain functionality, not by excessive use of single character tokens.

> And because "concise" should be measure in the number of tokens needed to achieve certain functionality, not by excessive use of single character tokens.

That makes me wonder how this would shake out differently if we didn’t use Latin-based writing as the foundation of our programming languages. If you had a programming language that used Chinese characters, would that be fundamentally more usable, assuming that you understood Chinese characters to begin with?

Re: How much can a Clojure developer do alone?

#106
post #23
post #7

The description here of using the Clojure REPL for development is one of the best I've seen. I think part of the issue is nomenclature -- Read Eval Print Loop applies to lots of systems in lots of languages that many devs are familiar with that are not really what Clojure devs mean when they say "REPL." The actual experience is closer to something like Smalltalk where you alter a running system and experiment with it…

I guess I need to watch some of the videos he links, because this sounds horrible to me. I mostly work in Python, which has a repl (though I'm sure not as complete) and sometimes I poke around in it. But if I am working on a real project, or even just a small script, I always want to run it from the beginning on every invocation, because anything short of that is not proof that it works. "Editing a running system" so…

I liked this video. https://vimeo.com/230220635

I had similar preconceptions from Python's REPL. Now after reading (at the least the first section of) the article and watching the video my mind is blown.

I've also been dabbling with Emacs Lisp recently and it appears that you can do basically the same thing.

Post reply on HN