For the Friday the 13th challenge, I have some code that requires an import, but results in an unnamed function when golfed:

(import '[java.time LocalDate DayOfWeek])

(defn count-friday-13ths [year]

When I compact this, it looks like it may be unacceptable:

(import '[java.time LocalDate DayOfWeek])#(CODE HERE)

The anonymous function at the end isn't named (obviously), so there isn't an obvious way to call it. To use it, parenthesis need to be placed around the function, with the argument, after the import:

(import '[java.time LocalDate DayOfWeek])(#(CODE HERE) the-year)

Is this acceptable?

  • \$\begingroup\$ "Any imports/includes/requires/whatever may be imported/included/required/whatever outside of the function", like import math;math.gcd or import math;lambda n:math.gcd(n) \$\endgroup\$
    – mbomb007
    Mar 1 '17 at 19:59

Browse other questions tagged .