Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
18
Task/Jensens-Device/Racket/jensens-device-1.rkt
Normal file
18
Task/Jensens-Device/Racket/jensens-device-1.rkt
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
#lang algol60
|
||||
begin
|
||||
integer i;
|
||||
real procedure sum (i, lo, hi, term);
|
||||
value lo, hi;
|
||||
integer i, lo, hi;
|
||||
real term;
|
||||
comment term is passed by-name, and so is i;
|
||||
begin
|
||||
real temp;
|
||||
temp := 0;
|
||||
for i := lo step 1 until hi do
|
||||
temp := temp + term;
|
||||
sum := temp
|
||||
end;
|
||||
comment note the correspondence between the mathematical notation and the call to sum;
|
||||
printnln (sum (i, 1, 100, 1/i))
|
||||
end
|
||||
4
Task/Jensens-Device/Racket/jensens-device-2.rkt
Normal file
4
Task/Jensens-Device/Racket/jensens-device-2.rkt
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
#lang racket/base
|
||||
(define (sum lo hi f)
|
||||
(for/sum ([i (in-range lo (add1 hi))]) (f i)))
|
||||
(sum 1 100 (λ(i) (/ 1.0 i)))
|
||||
Loading…
Add table
Add a link
Reference in a new issue