RosettaCodeData/Task/Floyds-triangle/Bracmat/floyds-triangle.bracmat
2023-07-01 13:44:08 -04:00

26 lines
720 B
Text

( ( floyd
= lowerLeftCorner lastInColumn lastInRow row i W w
. put$(str$("Floyd " !arg ":\n"))
& !arg*(!arg+-1)*1/2+1
: ?lowerLeftCorner
: ?lastInColumn
& 1:?lastInRow:?row:?i
& whl
' ( !row:~>!arg
& @(!lastInColumn:? [?W)
& @(!i:? [?w)
& whl'(!w+1:~>!W:?w&put$" ")
& put$!i
& ( !i:<!lastInRow
& put$" "
& 1+!lastInColumn:?lastInColumn
| put$\n
& (1+!row:?row)+!lastInRow:?lastInRow
& !lowerLeftCorner:?lastInColumn
)
& 1+!i:?i
)
)
& floyd$5
& floyd$14
);