ghci> unlines ["a list","of lines","of text"]
"a list\nof lines\nof text\n"
(Haskell also has the reverse function lines, which splits up a string into a list of lines. There’s also unwords/words, which do the same thing for all whitespace.)
Er, to be clear, I should note that the naming wasn’t my main focus here. I was simply suggesting that it’s convenient to have a function for adding newlines, not just spaces.
...which would let you keep LINES for a noun variable name.
The reverse of SPACED could be DESPACED.
Er, so I guess by that thinking we could use LINED and DELINED ...?
Stickler that I am for enforcing newlines at end of file, I'd probably want the default for DELINED to ensure a terminal line unless you used a refinement. DELINED/RELAX ?
Yep, the naming is slightly weird, but it’s one of those things which makes sense in the context of Haskell’s history. For Rebol, I agree that ENLINE/DELINE sound better.
Insofar as I understand the history: in Haskell it’s a counterpart to lines, which splits up a string into lines:
ghci> text = "some\nlines\nof\ntext"
ghci> lines text
["some","lines","of","text"]
So, when they wanted the reverse, it made sense to call it unlines! Same story with words (splitting a string into its words) vs unwords (concatenating a list of words to a single string). And everyone just got used to that situation.
I've never paid much attention to it, so I haven't put in my 2 cents on the design.
I don't want to change SPACED to ENSPACED :-/ so following the pattern and doing LINED and DELINED is probably the most consistent if it's SPACED and DESPACED.
LINED would be evaluative, like SPACED, unless you use an @[...] block.
Some people might be confused by DESPACED vs. UNSPACED. :-/ An interesting past naming decision was that DEQUOTE once meant "remove all quoting levels" while UNQUOTE meant "remove one quoting level"... but DEQUOTE and UNQUOTE seemed so interchangeable that DEQUOTE was named NOQUOTE