Comment by wewtyflakes

3 years ago

Isn't the assignment operator evaluated last, though? I don't know of any language that would support "true" left to right evaluation, though it would be neat! I suppose it would look like:

File("file.txt").byLineCopy.array.sort = sortedLines;

...which by first blush, seems bananas, but if you were to read it as English, would make sense: "Load the file 'file.txt' into an array of lines, sort them, then assign it to sortedLines"

> Isn't the assignment operator evaluated last, though?

Yes. Though one could use the . operator and a sink to make it completely left-to-right.

It's the symmetry of the '=' symbol which creates the difficulty. Replace it by an arrow in the direction of the assignment and it doesn't look strange anymore. File("file.txt").byLineCopy.array.sort -> sortedLines;

Especially if you add the |> operator (from Erlang I believe) to 'pipe' the data.

File("file.txt") |> readlines |> sort -> sortedLines;