Time for an 2014 update…
This commit is contained in:
parent
372c577f83
commit
09687c4926
2520 changed files with 34227 additions and 7318 deletions
6
Task/Factorial/Deja-Vu/factorial-1.djv
Normal file
6
Task/Factorial/Deja-Vu/factorial-1.djv
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
factorial:
|
||||
1
|
||||
while over:
|
||||
* over
|
||||
swap -- swap
|
||||
drop swap
|
||||
5
Task/Factorial/Deja-Vu/factorial-2.djv
Normal file
5
Task/Factorial/Deja-Vu/factorial-2.djv
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
factorial:
|
||||
if dup:
|
||||
* factorial -- dup
|
||||
else:
|
||||
1 drop
|
||||
|
|
@ -1 +1 @@
|
|||
fact(n) = prod(1:big(n))
|
||||
fact(n) = prod(one(n):n)
|
||||
|
|
|
|||
1
Task/Factorial/Scilab/factorial.scilab
Normal file
1
Task/Factorial/Scilab/factorial.scilab
Normal file
|
|
@ -0,0 +1 @@
|
|||
answer = factorial(N)
|
||||
30
Task/Factorial/VHDL/factorial.vhdl
Normal file
30
Task/Factorial/VHDL/factorial.vhdl
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
use std.textio.all;
|
||||
|
||||
entity rc is
|
||||
end entity rc;
|
||||
|
||||
architecture beh of rc is
|
||||
function fact(n:integer) return integer is
|
||||
variable f: integer := 1;
|
||||
variable i: integer;
|
||||
begin
|
||||
for i in 2 to n loop
|
||||
f := f*i;
|
||||
end loop;
|
||||
return f;
|
||||
end;
|
||||
|
||||
begin
|
||||
process
|
||||
variable i: integer;
|
||||
variable l: line;
|
||||
begin
|
||||
for i in 0 to 5 loop
|
||||
write(l, i);
|
||||
write(l, string'(" "));
|
||||
write(l, fact(i));
|
||||
writeline(output, l);
|
||||
end loop;
|
||||
wait;
|
||||
end process;
|
||||
end;
|
||||
Loading…
Add table
Add a link
Reference in a new issue