Tips for golfing in Julia What general tips do you have for golfing in Julia? I'm looking for ideas that can be applied to code golf problems in general that are at least somewhat specific to Julia (e.g. "remove comments" is not an answer).
NOTE: The below are correct as of Julia 1.4.1
A few tricks to save a few characters

Overload operators with frequently used binary functions. For example, if you need to do a lot of integer divisions, and no need for inverse division, use \ =div, and you can then type a\b instead of div(a,b). Note the space - this is necessary to avoid it parsing as a &quot;=&quot; operator. Also note that, if overloaded at REPL prompt level, use (\)=Base.(\) or \ =Base. \ to reset it. NOTE: some functions have existing UTF-8 operators pre-defined, such as ÷ for div, as noted by Alex A.
Use ^ with strings for conditional output. That is, rather than a&gt;0?&quot;Hi&quot;:&quot;&quot;, use &quot;Hi&quot;^(a&gt;0) to save one byte, or for boolean a, use &quot;Hi&quot;^a to save three bytes.
(sometimes) Store small fixed-size vectors as separate variables. For instance, rather than a=split(&quot;Hi there&quot;,&quot; &quot;), you may be able to avoid a[1] and a[2] by using a,b=split(&quot;Hi there&quot;,&quot; &quot;), which can be referenced as a and b, saving three bytes for each use, at the cost of just two extra characters at assignment. Obviously, do not do this if you can work with vector operations.
Don't use isempty for Arrays, Tuples, or Strings - instead, use ==[] for arrays and ==() for tuples; similarly, for the negative, use !=[] and !=(). For strings, use ==&quot;&quot; for empty, but use &gt;&quot;&quot; for not-empty, as &quot;&quot; is lexicographically before any other string and it saves one byte.
Use the right short-circuit boolean operator in place of &quot;if&quot;. It might be a bit less Julia-specific, but it is worth bearing in mind. x&lt;=1&amp;&amp;&quot;Hi&quot; can be written as x&gt;1||&quot;Hi&quot;, saving a character (so long as the return of the boolean isn't important).
Don't use contains to check presence of character in string - if you're restricted to the basic ASCII, use in('^',s) rather than contains(s,&quot;^&quot;). If you can use other characters, you can save a bit more with '^'∈s, but note that ∈ is 3 bytes in UTF-8.
Looking for minimum/maximum values in an array? Don't use minimum or maximum - rather than using minimum(x) or maximum(x), use min(x...) or max(x...), to shave one character off your code. Alternatively, if you know all elements of x will be non-negative, use minabs(x) or maxabs(x)
Where possible and permitted by the challenge, use an actual newline instead of \n - note that this will make your code harder to read, and may mean that you need to provide an &quot;ungolfed&quot; version to make it possible for people to actually understand it.
Put options after the regex string - if you want to have a regex string in multiline mode, for example, don't type r&quot;(?m)match^ this&quot;, type r&quot;match^ this&quot;m, saving three characters.
Where possible, use array concatenation instead of push!, unshift!, append!, or prepend! - for normal arrays, this can be done easily. For arrays of type Any with array elements, you will need the type Any, as in Any[[1,2]]. At one stage, curly braces could be used as an alternate notation ({[1,2]}), but this has been discontinued.
Don't use collect to convert a string into a char array - instead of collect(A), use [A...], which will do the same thing and save 4 bytes.
Need a number converted to a string? Use &quot;$(s[i])&quot; or dec(s[i]) for expressions or multi-character variables, and &quot;$i&quot; for single-character variables.
Use union or ∪ instead of unique - union(s) will do the same thing as unique(s), and save a byte in the process. If you can use non-ASCII characters, then ∪(s) will do the same thing, and ∪ only costs 3 bytes instead of the 5 bytes in union. In some circumstances, for single-character variables, you can save another byte using s∪s (thanks, MarcMush, for s∪s).
Use array indexing to get the size of an array or string - when you use end within array indexing, it automatically gets converted to the length of the array/string. This can be handy when you want to collect the length while doing certain operations. For example, if you need the length of A and the middle value, you might write A[(k=end)÷2]. This can also work in multiple dimensions, and for index iterators - A[(k=1:end;)] will give you an iterator for k=1:length(A), which can be handy when you also want to use A. Note that the assignment must occur in brackets, with a semicolon (such as (k=end;)) if no operation is done outside the brackets. (thanks to MarcMush for identifying a workaround for keywords in array indexing)

Outdated tricks that worked at some point, but no longer do:

 Access first element of Array with [] - for arrays, the expression A[] is equivalent to A[1]. Note that this does not work for Strings if you wish to get the first character, or for Tuples. - A[] no longer works.


 Reverse 1-D arrays using flipud - reverse(x) is one byte longer than flipud(x) and will perform the same operation, so the latter is better. - flipud is no longer in Base.


 Use ?: instead of &amp;&amp; or || for conditional assignment - that is, if you want to perform an assignment only on some condition, you can save one byte by writing cond?A=B:1 rather than cond&amp;&amp;(A=B), or cond?1:A=B rather than cond||(A=B). Note that the 1, here, is a dummy value. - the ?: notation now requires spaces around ? and :.