Four sides of square: Difference between revisions

m
(→‎BQN: add)
 
(4 intermediate revisions by 3 users not shown)
Line 1:
{{Draft task|Matrices}}
 
;Task:
Line 6:
<br>
[http://keptarhely.eu/view.php?file=20220218v00x6hugz.jpeg Four sides of square - image]
 
 
===See also===
Line 14 ⟶ 13:
=={{header|11l}}==
{{trans|Python}}
 
<syntaxhighlight lang="11l">
V size = 9
Line 435 ⟶ 433:
 
=={{header|Arturo}}==
 
<syntaxhighlight lang="rebol">drawSquare: function [side][
loop 1..side 'x ->
Line 661 ⟶ 658:
</pre>
 
=={{header|EasyLang}}==
<syntaxhighlight>
proc holmat n . .
for i to n
for j to n
if i = 1 or i = n or j = 1 or j = n
write "1 "
else
write "0 "
.
.
print ""
.
.
holmat 10
</syntaxhighlight>
{{out}}
<pre>
1 1 1 1 1 1 1 1 1 1
1 0 0 0 0 0 0 0 0 1
1 0 0 0 0 0 0 0 0 1
1 0 0 0 0 0 0 0 0 1
1 0 0 0 0 0 0 0 0 1
1 0 0 0 0 0 0 0 0 1
1 0 0 0 0 0 0 0 0 1
1 0 0 0 0 0 0 0 0 1
1 0 0 0 0 0 0 0 0 1
1 1 1 1 1 1 1 1 1 1
</pre>
 
=={{header|F_Sharp|F#}}==
Line 683 ⟶ 709:
[1; 1; 1; 1; 1; 1]]
</pre>
 
 
=={{header|FreeBASIC}}==
Line 734 ⟶ 759:
{{out}}
https://www.dropbox.com/s/9g5ahfzw1muuzgm/hollowMatrix.bmp?dl=0
 
 
=={{header|Go}}==
Line 867 ⟶ 891:
 
=={{header|J}}==
 
Implementation:
<syntaxhighlight lang="j">fsosq=: {{+./~(+.|.)y{.1}}</syntaxhighlight>
Line 961 ⟶ 984:
squareonesapp(8)
</syntaxhighlight>
 
=={{header|K}}==
<syntaxhighlight lang="k">square: {x|/:x}{x||x}@~-':!:
 
square 5</syntaxhighlight>
{{out}}
<pre>(1 1 1 1 1
1 0 0 0 1
1 0 0 0 1
1 0 0 0 1
1 1 1 1 1)</pre>
 
=={{header|Mathematica}}/{{header|Wolfram Language}}==
Line 1,206 ⟶ 1,240:
 
=={{header|Quackery}}==
 
<syntaxhighlight lang="quackery"> [ 0 over 2 - of
1 tuck join join nested
Line 1,388 ⟶ 1,421:
1 1 1 1
</pre>
 
 
=={{header|Ruby}}==
Line 1,426 ⟶ 1,458:
=={{header|Wren}}==
===Text based===
<syntaxhighlight lang="ecmascriptwren">var hollowMatrix = Fn.new { |n|
for (i in 0...n) {
for (j in 0...n) {
Line 1,453 ⟶ 1,485:
{{libheader|Go-fonts}}
This is designed to look as close as possible to the Red entry's image so that we don't have to fill up Wikimedia Commons with similar looking images.
<syntaxhighlight lang="ecmascriptwren">import "dome" for Window
import "graphics" for Canvas, Color, Font
class Main {
1,978

edits