REBOL Technologies

Wanted: An Idiom Dictionary

Carl Sassenrath, CTO
REBOL Technologies
14-Jan-2005 19:28 GMT

Article #0101
Main page || Index || Prior Article [0100] || Next Article [0102] || 2 Comments || Send feedback

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

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."

A Possible Solution?

If someone wants to write a CGI-based idiom dictionary, we can host it on for REBOL users to access. To start, it does not need to be anything fancy or polished. The main thing is that it must be trivial to add a useful idiom to the list. Perhaps it could start like the one-liner script from a few years back.

I know that wanted to allow idioms within the library. But, at last glance, I did not see any. I think for 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.


Updated 20-Feb-2018   -   Copyright Carl Sassenrath   -   WWW.REBOL.COM   -   Edit   -   Blogger Source Code