cartesian icon indicating copy to clipboard operation
cartesian copied to clipboard

Similarity with list comprehensions

Open danr opened this issue 7 years ago • 1 comments

I see this library as a way of expressing list comprehensions in javascript. Your example can be written this way using list comprehensions (using syntax from python and haskell and ecmascript):

config = [ 
    {box, compiler, test, cmdline} 
    for box in [box1, box2, box3, box4],
    for compiler in [gcc, clang, msvc],
    for test in [frobnicate, loadtest, end2end],
    let cmdline = compiler.binary + ' ' + test.sources + ' -o ' + test.binary,
    !(test.binary == 'loadtest' && box.ram < 8)
]

Maybe it could be pedagogical to point this out in the readme.

danr avatar Dec 02 '17 13:12 danr

Good point. It can be implemented using list comprehensions. However, I think that diving into implementation details would divert the attention from the concept I was trying to express.

sustrik avatar Dec 05 '17 21:12 sustrik