lockstep gave the definition; let's look at what the original code means.
This sets up a new parameter.
This sets the value; I'd prefer
but the developers of
memoir chose differently.
This starts the definition of
\raggedyright which has an optional argument, with default value 2em
This says that
\\ must be
\@centercr, a wrapper command of the LaTeX kernel used in
\raggedleft for properly ending lines.
\@rightskip \z@ \@plus #1\relax
The internal parameter
\@rightskip is set to a flexible glue with natural width 0pt and stretchability equal to the value given as optional argument. The commented line would set
\rightskip to equal
\rightskip is an amount of glue that TeX always adds to the right of the lines (and is usually zero. For compatibility with the
bidi package the parameter
\memRTLrightskip is set instead (so it will be
\rightskip in LTR writing,
\leftskip in RTL writing).
The leftskip is set to zero.
This ends the definition, by setting the
\parindent (we might be in a situation where the parindent has been changed or cleared).
So, changing what's needed, the definition of
\raggedyleft would be
\leftskip \z@ \@plus #1\relax
While in a ragged right setting a non zero parindent can be desirable (indeed, it is), in a ragged left setting it's definitely not needed. And there's another adjustment to do: also the final line should be flush right, so also
\parfillskip must be set to zero.
There is an asymmetry between left and right, because
\rightskip is used also in the
trivlist environment and so the kernel needs a "duplicate register" for maintaining a stable value. This isn't the case for
\leftskip, so there is no
A word about
\@plus. The first is a dimension register that's permanently set to 0pt and, by the rules of TeX, can be used in all situations TeX needs a dimension or an integer number (to denote 0pt or 0 respectively). Next,
\z@skip is a skip register permanently set to
0pt plus 0pt minus 0pt and can be used to set to zero any skip parameter (rubber length in LaTeXspeak).
\@plus stands for the keyword
\z@skip\z@ \@plus \z@ \@minus \z@
is the same as saying
\z@skip=0pt plus 0pt minus 0pt
but in a definition the former uses six tokens, while the latter uses 24. When the LaTeX kernel was written, token memory considerations were very important, so it has become customary to still use the "abbreviated forms" that, however, have another advantage: they lift some burden in taking into account spaces that should be present but are eventually ignored.