Re:Data Structures Sketches
by pasquinelli on Monday October 10, 2022 @12:27AM
(#33147787)
it's just a different symbol from the usual assignment operator, that is to say "put the value you're referring to as `n` in the variable `head`", just like `head = n` in most languages with assignment. the only reason for the arrow is if you're using `=` for true equality, as in `head` is always the same as the value `n`, or if you wanted to use `=` to mean `equals?`, a boolean test for momentary equality.
i don't know if any of that helps, it all just comes down to recognizing the symbol and interpreting it correctly.
I have no tips, but I share the pain. My intuitive reaction when seeing an arrow is that it changes the text direction, and I do not give semantic meaning to the arrow direction. Iow, my brain essentially treats `a <- b` and `b -> a` identically.
This is the usual way that directional operators work in maths: comparisons, set membership and inclusion, implication (to be fair the symmetric version is rare enough), etc.
Re:Data Structures Sketches
by derekbaker783 on Monday October 10, 2022 @04:35AM
(#33149150)
There are programming languages where that syntax is used for assignments to mutable vars (F# being one example).
Maybe play around with a language that uses that syntax?
https://learn.microsoft.com/en-us/dotnet/fsharp/language-ref...
Re:Data Structures Sketches
by quadrifoliate on Monday October 10, 2022 @07:10AM
(#33149976)
This is an excellent suggestion! I was going to say that the only place I have seen arrows used are either struct membership in C or the fat arrow function in JS, and neither of those go from right to left. So playing around with F# might help.
Has anyone else struggled with this, and have suggestions on how to rewire my brain so the notation "flows" better?