Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

all-corners function (See related posts)

    all-corners: func [
       {Returns all corners of the rectangle
        given the upper-left and lower-right corners.}
       ul [pair!] "The upper-left corner of the rectangle"
       lr [pair!] "The bottom-right corner of the rectangle"
       /local result
    ][
        result: make block! 4
        repend result [
            ul
            to-pair compose [(first ul) (second lr)]  ;ur
            to-pair compose [(first lr) (second ul)]  ;ll
            lr
        ]
        return result
    ]
    ; example: all-corners 0x0 10x10

You need to create an account or log in to post comments to this site.


Click here to browse all 5147 code snippets

Related Posts