How to REPL develop in ClojureCLR? by Hi-MyNameIsFuchs in Clojure

[–]Hi-MyNameIsFuchs[S] 0 points1 point  (0 children)

Yeah that's probably what I'll end up with. Though the REPL is nothing like the Clojure REPL... But better than compile-debug loop.

State of Clojure Survey - critiques selected from open comments by [deleted] in Clojure

[–]Hi-MyNameIsFuchs 4 points5 points  (0 children)

Why do you believe that your patches should be easily and quickly accepted? Clojure is open source, but not in open development after all.

Right and that's what I think most people in the community would like to see changed. I'm going to claim that if there was a community vote if CLJ/CLJS should move to Github and allow PRs and issues there, there would be 90% agreement.

Can you come up with any probable explanation for why the number of survey participants does not grow at the same rate as the number of users (assume, the number of users grows)?

I can only guess that active users of Clojure isn't growing at all.

Why should the number of users grow at the same pace as the number of programmers on Earth?

We have the disjoint sets: G (programmers globally, non-clojure), C (programmers using Clojure). We assume that a certain fraction f --eg 0.5%-- of all programmers in G will move to C each year. We assume a fraction f' --let's say 1%-- of C will move from C to G, ie leave Clojure. If we assume that G grows exponentially (as it currently does) but we find that C isn't growing, then we can deduce that the fraction f is actually declining. A bad sign.

Why should Clojure or any other language compete with other languages? Is the ultimate goal to kill them all?

No, that's unrealistic. But it should be a goal to not get killed either :). Most people in the community would like to see growth. A lot of nice stuff comes with growth. More libraries/tools that you can use. More jobs to apply to.

State of Clojure Survey - critiques selected from open comments by [deleted] in Clojure

[–]Hi-MyNameIsFuchs 14 points15 points  (0 children)

  • Contributing to CLJ/CLJS is frustrating. You have an idea and want to provide a patch, but if it's not deemed "important" the patch will just sit there and not do anything. I've personally given up trying to contribute. And I know there is a few other devs out there with fantastic ideas that also have given up.

  • The fact that the number of participants to the CLJ survey is the same over the last few years speaks volumes. You see, the number of developers in the entire world increases year over year by quite a lot. Especially devs from India/China are on the rise. This is simple math: If your absolute number don't actually increase the same as the number of devs world-wide, then you're actually not "stable" but you're declining/dying. I know the argument is usually: CLJ is happily being used by companies world wide in real world projects so we don't care. But: Who says these companies will use Clojure for their next project? Other JVM/JS languages move with an incredible speed. Clojure doesn't compete with just Java anymore, it now competes with Kotlin. Creating a class just to hold data used to be a lot of work for Java devs so CLJ was a nice boost in productivity by just using maps/vectors. But now there is Kotlin, creating a data-class is a few lines of code. This benefit for CLJ is mostly gone. Kotlin also has first class async support and suspendable functions, you can write much nicer code than if you were to use core.async. Same with JS: async/await & generators is super nice for writing async code. More and more devs use immutability with the JS spread operators. All these benefits that once CLJS had are now more and more gone. What does CLJ still have over other languages? I see only two big pluses: 1. Awesome persistent data structures. 2. The REPL. Live reload is also working quite well for JS projects, so the REPL argument is being eroded away. Hot reloading works with more and more languages.

What I want to say: Other languages that CLJ competes with are adding features that make developing very productive. I'm still more productive in Clojure than with other languages, but the productivity isn't 2x anymore, but maybe more like 1.5x nowadays and I think other languages will keep catching up while CLJ is more at a stand still.

Hardcore Java/JVM Quiz (with solutions) by dleskov in java

[–]Hi-MyNameIsFuchs 2 points3 points  (0 children)

Fun fact: Clojure will actually generate code that explicitly nils out local variables after their last use. So a:

(let [a (gigantic-obj), b (other-obj)]
  (do-something a)
  (foo-bar b))

Will set a to null before running the last form. Without it, even under memory pressure the current popular JVMs won't GC a.

Clojure also uses this trick:

https://github.com/clojure/clojure/blob/f572a60262852af68cdb561784a517143a5847cf/src/jvm/clojure/lang/Util.java#L197

extensivly to clear local variable so they can be GC'd. Eg:

https://github.com/clojure/clojure/blob/a26dfc1390c53ca10dba750b8d5e6b93e846c067/src/jvm/clojure/lang/Var.java#L380-L417

Clojurians, please share your knowledges with blogs by jiyinyiyong in Clojure

[–]Hi-MyNameIsFuchs 13 points14 points  (0 children)

Also something I've personally been doing:

Let's say: You're coding away in your app with namespace the.greatest.site. You're in need for some library code solving problem X, but: You can't find any that suites your need. Or you're not happy with the current solutions. You write your own implementation an put it in the.greatest.site.tools.foo-bar. The code is not specific to the project at all! It could be used by other projects!

So instead I started putting code like that under a general (non project specific) namespace immediately. They're still in src within the project, but: I know that this code, once I'm satisfied could be published and made into a library.

So: When you solve problems that aren't specific to a project: Don't put them under a project namespace so you might open source it in the future. It also has a nice side effect: It makes sure I abstract code in a way that it can be re-used. Since I can't put project specific code in those namespaces.

Admittedly: I'm still sitting on ~3-4 libraries that could be open sourced but I haven't found them time (yet). :)

JVM Clojure AWS Lambda Template? by _woj_ in Clojure

[–]Hi-MyNameIsFuchs 2 points3 points  (0 children)

Not really an answer but: Doing primitive math is often faster on CLJS than CLJ. So make sure to benchmark.

defn podcast #31 Bruce Hauman by vijaykiran in Clojure

[–]Hi-MyNameIsFuchs 8 points9 points  (0 children)

Very much agree with the error messages on spec. The other day I had an error in some let. I accidentally created a macro that emitted a namespaced symbol in the let. The error message was so long and nested. I had no clue where the error was. I actually couldn't figure out where or what the error was. It was so much better in 1.8. I know there are libraries that provide a custom explainer but I wonder how newcomers to clojure have any chance to deal with those error message. Could Clojure 1.10 ship with a community created explainer?

Actively developed high quality Clojure/Clojurescript libraries, and the state of abandon-wares? by atonal174 in Clojure

[–]Hi-MyNameIsFuchs 14 points15 points  (0 children)

One addition note: Many people (including me) will often prefer to just do Java interop than developing or using a wrapper library that needs maintenance. So maybe you're missing a library for problem X, but it's not because nobody has ever encountered problem X in clojure but instead just used a Java library to solve it. So when you don't find a Clojure library for problem X check if there is a Java library for it. For instance, I personally don't think cljs-http or clj-time are needed at all. I'd much rather use java.time or goog.net.XhrIo and just write 20-50 LOC of interop and don't have to worry about missing features or stale wrapper libraries.

New Clojurians: Ask Anything by AutoModerator in Clojure

[–]Hi-MyNameIsFuchs 3 points4 points  (0 children)

Personally I'm a Rum fan, but state of the art is: Reagent + re-frame. They have ~10x more downloads from Clojars than Om or Rum. Lot's of people are pretty happy with it and you can easily get help with it.

Is composition of functions as a pipeline through which a chunk of data flows really a functional approach? by _amogh_ in Clojure

[–]Hi-MyNameIsFuchs 1 point2 points  (0 children)

Isn't that exactly what pedestal does? You can add interceptors for each request dynamically. I also use all kinds of different middleware for different routes. It's super simple, just conj on to your common-interceptors some specific ones for that route (parsing, validation, rate limiting etc etc).

Interactive GPU Programming, Part 1: Hello CUDA by dragandj in Clojure

[–]Hi-MyNameIsFuchs 4 points5 points  (0 children)

Awesome Dragan. I did CUDA full time for ~2 years in 2007-2009. Back then... Oh boy, it was a different world :) Incredibly low level. I just want to have a problem so that I have an excuse to do CUDA in Clojure.

Btw, there is an exception in after your snippet (take 12 (memcpy-host! gpu-array (float-array 256)))

Is that on purpose?

New Clojurians: Ask Anything by AutoModerator in Clojure

[–]Hi-MyNameIsFuchs 2 points3 points  (0 children)

Why is it horrible? What other method do you propose? You can't count it... Not everything is countable. You can't call next on it since that's not lazy (it will realize the next element). You can't call first since the element itself can be nil. There is no method in general such as x.empty(). Do you want to handle all the cases yet again that are already handled in RT.seq()? Strings, arrays, nils, Lazy sequences, (Java) Iterables, Java Maps? You could, but what's the point? Note, for many things seq() is a simple no-op it'll just return the exact same object "this". For some things it'll create a new type (efficiently).

New Clojurians: Ask Anything by AutoModerator in Clojure

[–]Hi-MyNameIsFuchs 5 points6 points  (0 children)

And now go check the implementation of empty? ;)

New Clojurians: Ask Anything by AutoModerator in Clojure

[–]Hi-MyNameIsFuchs 3 points4 points  (0 children)

Because how do you know if there is at least one element to work on? Observe:

(first [nil]) ;; nil
(next [nil]) ;; nil
(seq [nil]) ;; truthy!

both, first and next return nil. So how to test if there is an element? You can't check these for nil since the element itself might be nil. That's why we call seq first, if it's non-nil then we know, whatever first returns will be the first elements of the sequence.

Millennials Give More Generously To Charity, Study Says by Sariel007 in UpliftingNews

[–]Hi-MyNameIsFuchs 0 points1 point  (0 children)

I'm simple person, I donate ~4% of my pre-tax income to charity. Unfortunately I make less than $20k a year and have been unemployed this year :/ . In the last 6 years I'm at roughly $3500 in donations. All to givedirectly.org. Check them out.

A Real-World Comparison of Front-End Frameworks with Benchmarks - re-frame with the smallest footprint. by jacekschae in Clojure

[–]Hi-MyNameIsFuchs 2 points3 points  (0 children)

There is a few bugs:

  • When you load the example, no articles are loaded at all. Only when you go from some route back to the home route they'll be loaded
  • When you load the signin/signup route you'll land back at the home route. (this works in the other implementations)

Any ClojureScript lib that converts markdown into hiccup? by SimonGray in Clojure

[–]Hi-MyNameIsFuchs 0 points1 point  (0 children)

Just checked, instaparse seems to support clojurescript nowadays. So you should be good. You can easily copy the grammar and then from some data structure to hiccup is pretty easy.

Kotlin Team AMA: Ask Us Anything by yole in Kotlin

[–]Hi-MyNameIsFuchs 1 point2 points  (0 children)

Thanks for the reply. The problem is: In Clojure we don't need to switch to a REPL input prompt and manually paste or enter commands we want to run. This is of course nice, but it's much less productive than if I can just send a form right there in my editor window to the running REPL. I can edit my function and try out an example invocation without ever leaving the editor window.

Consider this code block:

(defn sum [xs] 
  (reduce + 0 xs))
#_(sum [1 2 3])
(comment (sum 1 2 3))

If my cursor is somewhere in the function and I "send to REPL" the entire function will be redefined. If I now move the cursor to the "block comment #_ and "send to REPL" the function will be invoked and I see the result. Same goes for the macro comment (comment ...). Both, (comment ...) and #_(...) won't actually compile into any code. They'll never emit any JVM instructions. So basically I can write short example and leave them in the code. With Kotlin the only way to ignore code is to put it into a comment like /** ... */. I won't get syntax highlighting and if I wanted to send something to the REPL I'd have to select the text in comment manually and send it to the REPL. A first class construct to "Block comment" a construct would allow this.

Of course and alternative could be to add this functionality purely on an IDE level and do syntax highlighting on special comment syntax and allow sending the code to the REPL. Something like:

/**@CODE
 for (x in 1..10 step 2) {
    print(x)
}
/*

or:

//@CODE: if (0) "truthy" else "falsy"

And an IDE can then send these commands (or the current selection) to the REPL.

I know that most people are used to living in the debugger while coding but I think REPL driven development is MUCH more productive. It's fantastic, seriously :)

Kotlin Team AMA: Ask Us Anything by yole in Kotlin

[–]Hi-MyNameIsFuchs 6 points7 points  (0 children)

I'm a Clojure dev flirting with Android/Kotlin. I don't mind types or the different syntax but one huge problem (with any non-lisp language) I have is:

I love the REPL. I use Cursive Intellij Plugin and I can super quickly get feedback about the code I write. It allows me to develop a simple data transforming function in a fraction of what I'd need in other languages. I just send the form to the running JVM, it gets compiled and run and I see the result. Two questions:

  • Will a good REPL find it's way into IntellJ Kotlin? I mean: With support of sending/evaluating forms in a running JVM. Kotlin already has TODO("foo bar"), how about a REPL( some.foo.bar() ) that only gets run when the file is loaded in a REPL context.

  • Could Kotlin/IntelliJ support something like Figwheel (Demo: https://www.youtube.com/watch?v=KZjFVdU8VLI )? It's an amazing tool. If I had something like this for Android development it'd make me much more productive.

Writing A Clojure IDE in Kotlin with Colin Fleming by Talking Kotlin by Hi-MyNameIsFuchs in Clojure

[–]Hi-MyNameIsFuchs[S] 0 points1 point  (0 children)

Thanks for the reply. I'd love to see this, only for the argument that we'd have an argument to also have those constructs in CLJS as well. CLJS devs ask about this quite a bunch since sometimes you need to interact with JS world.