Expected Clojure template

Hello,

Did you consider expecting users to write clojure “scripts” which could be directly evaluated instead of first compiled then executed?

Evaluation through : java -cp clojure.jar clojure.main /path/to/myscript.clj ( see https://clojure.org/reference/repl_and_main#_launching_a_script )

This would be better in several areas:

  • probably a little faster (compiles on the fly) while developing (skip the AOT compilation phase)
  • scripts could be way shorter, especially useful for code size challenges.

for instance, here is the same code today and if we had a “Clojure script” option:

Currently:

(ns Solution (:gen-class))
(defn -main[]
  (println (read-string(str"0x"(read-line)))))

As a script:

(println(read-string(str"0x"(read-line))))
4 Likes

I am so for this.
The same thing is bothering me since i started to play clash of code.
Its so frustrating when people submit solutions that take half of the bytes we need to declare the namespace and main function.

Of course there are other languages that have the same problem, but it simply has not to be the case with clojure.

At least you could reduce (maybe for all languages that are affected) the Namespace / Class Name to “S” or something for Codegolf challenges, even that would be great.

So it’s nearly half past 2019 now, and the Clojure template still contains the nasty header.
That’s sad. Is it really nobody cares? Devs, please make it possible to write Clojure scripts.
The header is really disaster for clash of code. If you don’t know Python or at least JavaScript, then you will just suck at almost any clash.