0
\$\begingroup\$

This challenge requires us to create a "full program" that produces an infinite loop, and never outputs.

The problem is, I'm not sure what's considered a full program in Clojure.

If I were writing non-golfing code, my project would start out as:

(ns package1.package2)

(defn -main [& args])

At the bare minimum. I know the ns macro is pretty much a requirement for any real code, but is it required for a "full program"?

And what about -main? Technically, the main function doesn't even need to be called -main; that's just the default. I could name it anything as long as I adjusted the project.clj accordingly. I don't think an anonymous function would be passable though since it couldn't be called. Does that mean the only requirement is that it contains a named function?

\$\endgroup\$

1 Answer 1

3
\$\begingroup\$

Disclaimer: I know nothing about Clojure.

A full program is anything that can be compiled/interpreted on its own, usually from a standalone file, using any pre-existing compiler/interpreter.

For example, a simple hello world program that works on Ideone is

(print "Hello, World!")

Everything else would be overkill.

Note that if you do require the ns macro or a project.clj file for any specific task requiring a full program, you would have to include these in your byte count.

\$\endgroup\$
1
  • \$\begingroup\$ If you paste your Hello World in a otherwise empty file, it will run fine. The namespace macro would only be required if I were including multiple files, in retrospect. Thanks. \$\endgroup\$ Commented Dec 1, 2016 at 15:52

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .