I have always felt that appending an element to the right of the list or string is a very important operation. What do I like in newlisp, it is its ability to pass -1 as a third argument to 'push'. But writing -1 explicitly is boring, and arguments order seems unnatural. 'push @lst, $elt;' from Perl is much better, but 'push' is already defined in other way in newlisp. Of course I can define my own macro in a trivial way, but I stumbled at a name for it. I am not a native English speaker, so I don't know which verb looks natural to the most of you here. My current solution is 'tack':
'concat' and 'append' look like pure functions for me. Seeing such a word in the code, I assume that result is yield and arguments leaved intact. On the other hand, 'push', 'tack' and 'shove' look like actions. More then, like brutal and destructive actions. I readily believe that they are breaking their arguments. But there are my deep-in-mind associations, and I am not a native English speaker. Maybe other people feel it in other way. And yes, I opine that good mnemonics matters.
With newLISP you can grow your lists from the right side!
I know. That would be too slow. I was hoping for something more along the lines of using device to assign stdin to a string-buffer so that print would act more like write-buffer.
Jeff
=====
Old programmers don't die. They just parse on...
m35 wrote:I suppose the lispy way of doing it is to pass a function that performs the write?
I have no clue how other people do it, but my experimental 'sxml2xml' function accepts an output function as argument. It is called like '(sxml2xml print pattern 4)', you can also pass '(curry net-send soc)' or '(curry write-buffer buf)' instead or 'print'.
With newLISP you can grow your lists from the right side!
Actually, I would suggest something similar. I like how other LISPs use '!' at the end of their functions to imply destructive behaviour. It makes it very clear. See for example dotlisp: http://dotlisp.sourceforge.net/dotlisp.htm#Lists