Mosaic matrix: Difference between revisions
Content added Content deleted
(→{{header|jq}}: simplify) |
(→{{header|jq}}: simplify) |
||
Line 389: | Line 389: | ||
'''Works with gojq, the Go implementation of jq''' |
'''Works with gojq, the Go implementation of jq''' |
||
<lang jq>def mosaicMatrix: |
<lang jq>def mosaicMatrix: |
||
. as $ |
[range(0;.) | . % 2] as $one |
||
| [range(0; |
| [range(0;.) | (. + 1) % 2] as $two |
||
| [range(0; |
| [range(0;.) | if .%2 == 1 then $one else $two end];</lang> |
||
| [range(0;$n) | if .%2 == 1 then $one else $two end];</lang> |
|||
'''Example''': |
'''Example''': |
||
<lang jq>def display: |
<lang jq>def display: |