Preamble
Following the recommendation of a presentation or article which I now only vaguely remember I have been experimenting with a particular code format:
fn[args_] := (
expr
// operation1
// operation2
// operation3
)
Each operation is cast as a Function
as necessary, though operator forms are used where available. Some examples: (138146), (138650), (139228).
I have found this format to be reasonably general and have above average readability. I note that my use of it (which is by no means unique) seems to be well accepted so I think others must find it readable too.
A couple of things keep me from adopting this format as my go-to style: the first is the requirement for additional Function
constructs over more heavily bracketed code. The second is the way that this code is automatically formatted in Notebook Input Cells which is what my question is about.
(Pardon the long introduction but I feel that context is necessary.)
Summary
When multiple //
postfix operations are written one on each line the standard code indenter does this:
I find this indenting weird and inconvenient. I suppose it exists to indicate that operation1
is "inside" operation5
, etc., but that's not really how I think about these operations; rather I think of them as a series of sequential steps performed in order from one to five.
It also ends up crowding code into the right margin when there would otherwise be plenty of room.
Question
All that out of the way my actual question is this: do other people regularly benefit from the indenting shown above, and what coding style(s) is it useful for?
If this indenting is not of use in other styles or from different perspectives I would perhaps campaign to have the indenting changed in future versions to the vertically aligned form shown in the first code block in this question.
splitEvery
code from (139228). That could instead be written assplitEvery[list_, x_, n_Integer] := MapThread[Take[list, {##}] &, {Prepend[# + 1, 1], Append[#, -1]}] &[ SparseArray[Unitize[list - x], Automatic, 1]["AdjacencyLists"][[n ;; ;; n]] ]
which I find considerably less readable, however it involves fewer total operations because it eliminates severalFunction
constructs. $\endgroup$//
and vertical alignment. I have given up fighting the parser and reluctantly put the operators on the end of the preceding line instead of the start of the next. I still fight the auto-formatter, though, by using code cells for everything but one-off evaluations. I'm not sure my opinion counts for much given my alien indentation style :) The formatter could be readily fixed but a parser change is unlikely. $\endgroup$//
by@
and reverse the order. So your interpretation of the indentation is likely correct. But that also means that changing it just for//
may not be consistent in the bigger picture. $\endgroup$