[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: macros vs. blocks




> List comprehensions make a good example. Consider the following
> bit of Haskell code:  
>
> [ (a, b) | a <- as, b <- bs, a < b ]

and a hypothetical Scheme + blocks version:

> (foldl [a acc:
>        (foldl [b acc: (if (< a b) (cons (pair a b) acc) acc)] acc bs)]
>       '() 
>       as)

but the latter's a strawman.  Why not write
it more like Thmalltalk?

	(collect [(a b) | (< a b)] (cart-product as bs))

or maybe even:

	(cart-product #:when [a b | (< a b)] as bs)

-Dave

(have all the examples of potentially
non-blockable macros so far been cases
of punning, treating something as both
code and data?)