What should I call the REBOL function that does the renaming?

REBOL has no built-in way to check lists. However, REBOL has a powerful tool (known as parse ) that can be used to create domain languages ​​(DSLs). I used parse to create such a mini DSL for list comprehension. To interpret the expression, a block containing understanding is passed to a function, which, due to the lack of a better term, which I called comprehend .

Example:

 comprehend [(a * b) for a in 1x100 for b in 4x10 where (all [odd? a odd? b])] 

For some reason, comprehend is not suitable for me, but something like eval is too general.

I have not found another language that requires a keyword or function to understand lists. They are pure syntactic sugar, wherever they exist. Unfortunately, I do not have such an option. So, seeing that I should have a function, what is a good, short, logical name for it?

+6
list-comprehension naming dialect rebol
source share
4 answers

How about select ?

select [(a * b) for a in 1x100 for b in 4x10 where (all [odd? a odd? b])]

+4
source share

Since list views can be thought of as similar to a map, you might consider calling it something like "listmap". Alternatively, since the understanding of lists is based on set-builder notation, you can call it something in the "build" or "buildlist" lines.

(Disclaimer: I know very little about REBOL, so sorry if these names are already accepted)

+2
source share

turn

+2
source share

do may be appropriate since list comprehension is just one instance of Monad concepts, and do is the keyword used by Haskell for sugared Monadic computing, but I suspect it is too vague for the user library. I called the comp list recognition function, but this is just an abbreviation of what you already have. Perhaps yielding ? For example. yielding [(a * b) for a in 1x100 for b in 4x10 where (all [odd? a odd? b])] . It’s just like squinting and pretending that [] does not exist.

+1
source share

All Articles