Comments on: Wanted: An Idiom Dictionary
Wouldn't it be nice to have a REBOL idiom dictionary? In other words, a place where users could look up the common idioms of REBOL? We've talked about this before.
An idiom is a sequence of words (functions) that produces a commonly needed result. Most idioms are short and sweet like this what that removes the last element from a series (string, block, etc.):
remove back tail series
Other idioms are more involved like the third line of this example that pads an integer with leading zeros to produce a five digit result. (I use this one a lot for making file names.)
number: 12 out: form number insert/dup out "0" 5 - length? out print out 00012
Many users do not realize that such idioms exist and that these idioms are the reason why functions like REMOVE-LAST are not part of the language. The idiom is easy.
An open idiom dictionary would be useful because it helps users find these common sequences. No guessing needed. I often hear new users tell me, "oh, that's how you do it, I did not think of that."
I know that REBOL.org wanted to allow idioms within the library. But, at last glance, I did not see any. I think for REBOL.org to successfully support idioms, there might need to be a streamlined submission process that has a special form that includes: summary of the idioms function (e.g. remove last value from a series), the idiom itself, and an optional description of how it works. It could also include an optional author name.
Anyway, until then, we can start collecting idioms from the community at large.
Post a Comment:
You can post a comment here. Keep it on-topic.