Data update
This commit is contained in:
parent
5150844a7d
commit
4bb20c9b71
7735 changed files with 38060 additions and 199180 deletions
|
|
@ -1,26 +0,0 @@
|
|||
with Ada.Text_IO; use Ada.Text_IO;
|
||||
|
||||
procedure Jensen_Device is
|
||||
function Sum
|
||||
( I : not null access Float;
|
||||
Lo, Hi : Float;
|
||||
F : access function return Float
|
||||
) return Float is
|
||||
Temp : Float := 0.0;
|
||||
begin
|
||||
I.all := Lo;
|
||||
while I.all <= Hi loop
|
||||
Temp := Temp + F.all;
|
||||
I.all := I.all + 1.0;
|
||||
end loop;
|
||||
return Temp;
|
||||
end Sum;
|
||||
|
||||
I : aliased Float;
|
||||
function Inv_I return Float is
|
||||
begin
|
||||
return 1.0 / I;
|
||||
end Inv_I;
|
||||
begin
|
||||
Put_Line (Float'Image (Sum (I'Access, 1.0, 100.0, Inv_I'Access)));
|
||||
end Jensen_Device;
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
harmonicSum: function [variable, lo, hi, term][
|
||||
result: new 0.0
|
||||
result: 0.0
|
||||
loop lo..hi 'n ->
|
||||
'result + do ~"|variable|: |n| |term|"
|
||||
result
|
||||
|
|
|
|||
|
|
@ -1,14 +1,12 @@
|
|||
(phixonline)-->
|
||||
<span style="color: #008080;">with</span> <span style="color: #008080;">javascript_semantics</span>
|
||||
<span style="color: #008080;">function</span> <span style="color: #000000;">sumr</span><span style="color: #0000FF;">(</span><span style="color: #004080;">integer</span> <span style="color: #000000;">lo</span><span style="color: #0000FF;">,</span> <span style="color: #000000;">hi</span><span style="color: #0000FF;">,</span> <span style="color: #000000;">rid</span><span style="color: #0000FF;">)</span>
|
||||
<span style="color: #004080;">atom</span> <span style="color: #000000;">res</span> <span style="color: #0000FF;">=</span> <span style="color: #000000;">0</span>
|
||||
<span style="color: #008080;">for</span> <span style="color: #000000;">i</span><span style="color: #0000FF;">=</span><span style="color: #000000;">lo</span> <span style="color: #008080;">to</span> <span style="color: #000000;">hi</span> <span style="color: #008080;">do</span>
|
||||
<span style="color: #000000;">res</span> <span style="color: #0000FF;">+=</span> <span style="color: #000000;">rid</span><span style="color: #0000FF;">(</span><span style="color: #000000;">i</span><span style="color: #0000FF;">)</span>
|
||||
<span style="color: #008080;">end</span> <span style="color: #008080;">for</span>
|
||||
<span style="color: #008080;">return</span> <span style="color: #000000;">res</span>
|
||||
<span style="color: #008080;">end</span> <span style="color: #008080;">function</span>
|
||||
with javascript_semantics
|
||||
function sumr(integer lo, hi, term)
|
||||
atom res = 0
|
||||
for i=lo to hi do
|
||||
res += term(i)
|
||||
end for
|
||||
return res
|
||||
end function
|
||||
|
||||
<span style="color: #008080;">function</span> <span style="color: #000000;">reciprocal</span><span style="color: #0000FF;">(</span><span style="color: #004080;">atom</span> <span style="color: #000000;">i</span><span style="color: #0000FF;">)</span> <span style="color: #008080;">return</span> <span style="color: #000000;">1</span><span style="color: #0000FF;">/</span><span style="color: #000000;">i</span> <span style="color: #008080;">end</span> <span style="color: #008080;">function</span>
|
||||
function reciprocal(atom i) return 1/i end function
|
||||
|
||||
<span style="color: #0000FF;">?</span><span style="color: #000000;">sumr</span><span style="color: #0000FF;">(</span><span style="color: #000000;">1</span><span style="color: #0000FF;">,</span> <span style="color: #000000;">100</span><span style="color: #0000FF;">,</span> <span style="color: #000000;">reciprocal</span><span style="color: #0000FF;">)</span>
|
||||
<!--
|
||||
?sumr(1, 100, reciprocal)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue