Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

16
  • 1
    $\begingroup$ @jjc385 Take for example the splitEvery code from (139228). That could instead be written as splitEvery[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 several Function constructs. $\endgroup$ Commented Mar 6, 2017 at 6:17
  • 1
    $\begingroup$ Very much opinion-based indeed. I'd remark, basing this on coding style guidelines of more traditional programming languages, that if you really run into the problem of code being pushed into the right margin, perhaps your postfixed functions are too long, complex, and maybe not so readable, which seems contrary to your intent. This reminds me of your question from some time ago about verbose vs. terse code, where you and Leonid had a rather lengthy discussion. It would be good to link it here. $\endgroup$ Commented Mar 6, 2017 at 13:32
  • 1
    $\begingroup$ (131919) asks a similar question with respect to currying and right-composition operators. +1 for chaining operations using // 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$ Commented Mar 6, 2017 at 15:44
  • 2
    $\begingroup$ The mirror image of this happens when you replace // 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$ Commented Mar 6, 2017 at 17:10
  • 1
    $\begingroup$ Related: 80184 $\endgroup$ Commented Jun 5, 2019 at 16:06