5 Apr 2004 22:50
[stack] Pattern matching, stack comments
andrew cooke <andrew <at> acooke.org>
2004-04-05 20:50:17 GMT
2004-04-05 20:50:17 GMT
Hi, Are either of these ideas useful? I've not used Joy (or APL, J, K etc), although I did play with Forth a little just under 20 years ago... First - maybe you add some kind of support for comments on the stack, so that operations that pushed values could attach comments. Then a stack dump might show not just values, but also comments. Second - could you add pattern matching to definitions, to make them simpler to read? Then swap might be defined something like: swap a b == b a I can already see at least two objections to the second point - first that it's not clear whether you match atomic values or sub-stacks and second that you might lose much of the concatenative flavour of the language (or, alternative, that if you're used to programming in a such a style, such matching appears redundant). Thanks, Andrew -- -- ` __ _ __ ___ ___| |_____ work web site: http://www.ctio.noao.edu/~andrew / _` / _/ _ \/ _ \ / / -_) personal web site: http://www.acooke.org/andrew \__,_\__\___/\___/_\_\___| personal gallery: http://www.acooke.org/pancito Yahoo! Groups Links(Continue reading)
. If I did, I'd probably modify it to
pattern-match against the car and cdr of the list, not against every
specific item in the list. That way every list pattern would work for ANY
list, not just the lists with the same length as the pattern.
>dg
-Billy
Yahoo! Groups Links
<*> To visit your group on the web, go to:
RSS Feed