Get the latest tech news

2D Racket Syntax


8.15 2D Syntax🔗ℹ The 2d language installs #2d reader support in the readtables , and then chains to the reader of another language that is specified immediately after 2d . The #2d syntax extension adds the ability use a two-dimensional grid syntax.

The reading stage converts anything that begins with #2d into a parenthesized expression (possibly signaling errors if the ═ and ║ and ╬ characters do not line up in the right places). That macro will take over and then expand into ordinary conditional expressions, in this case figuring out whether or not the inputs are pairs or numbers and evaluating the code in the appropriate cell. In case of a tie (i.e., both expressions start at the same column, but on different lines), the bottommost one will count as col-expr.

Get the Android app

Or read this on Hacker News

Read more on:

Photo of 2D Racket Syntax

2D Racket Syntax