Pascal's triangle: Difference between revisions

Content added Content deleted
(add UNIX Shell)
Line 3,263: Line 3,263:
0 OK, 0:380
0 OK, 0:380
</pre>
</pre>
=={{header|UNIX Shell}}==
{{works with|Bourne Again SHell}}
<lang bash>#! /bin/bash
pascal() {
local -i level=${1:-1} n
if (( level <= 1 )); then
echo 1
else
local output=$( $FUNCNAME $((level - 1)) )
set -- $( tail -n 1 <<<"$output" ) # previous row
echo "$output"
n=0
for arg do
printf "%d " $((n + arg))
n=$arg
done
echo 1
fi
}
pascal "$1"</lang>

=={{header|Ursala}}==
=={{header|Ursala}}==
Zero maps to the empty list. Negatives are inexpressible.
Zero maps to the empty list. Negatives are inexpressible.