Data update
This commit is contained in:
parent
29a5eea0d4
commit
5c1bb7bfa9
2011 changed files with 35081 additions and 3229 deletions
|
|
@ -1,3 +1 @@
|
|||
⍝⍝ Also works with GNU APL after introduction of
|
||||
⍝⍝ the ⍸ function with SVN r1368, Dec 03 2020
|
||||
⍸≠⌿0=(⍳100)∘.|⍳100
|
||||
≠⌿0=(⍳100)∘.|⍳100
|
||||
|
|
|
|||
1
Task/100-doors/APL/100-doors-3.apl
Normal file
1
Task/100-doors/APL/100-doors-3.apl
Normal file
|
|
@ -0,0 +1 @@
|
|||
⍸≠⌿0=(⍳100)∘.|⍳100
|
||||
|
|
@ -1,9 +1,9 @@
|
|||
var .doors = [false] * 100
|
||||
var doors = [false] * 100
|
||||
|
||||
for .i of .doors {
|
||||
for .j = .i; .j <= len(.doors); .j += .i {
|
||||
.doors[.j] = not .doors[.j]
|
||||
for i of doors {
|
||||
for j = i; j <= len(doors); j += i {
|
||||
doors[j] = not doors[j]
|
||||
}
|
||||
}
|
||||
|
||||
writeln for[=[]] .i of .doors { if(.doors[.i]: _for ~= [.i]) }
|
||||
writeln for[=[]] i of doors { if doors[i]: _for = more(_for, i) }
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
writeln foldfrom(fn(.a, .b, .c) if(.b: .a~[.c]; .a), [], .doors, series 1..len .doors)
|
||||
writeln foldfrom(fn a, b, c: if(b: a~[c]; a), [], doors, series(1..len(doors)))
|
||||
|
|
|
|||
|
|
@ -1 +1 @@
|
|||
writeln map fn{^2}, 1..10
|
||||
writeln map(fn{^2}, 1..10)
|
||||
|
|
|
|||
|
|
@ -1,27 +0,0 @@
|
|||
MODULE Doors;
|
||||
IMPORT Out;
|
||||
|
||||
PROCEDURE Do*; (* In Oberon an asterisk after an identifier is an export mark *)
|
||||
CONST N = 100; len = N + 1;
|
||||
VAR i, j: INTEGER;
|
||||
closed: ARRAY len OF BOOLEAN; (* Arrays in Oberon always start with index 0; closed[0] is not used *)
|
||||
BEGIN
|
||||
FOR i := 1 TO N DO closed[i] := TRUE END;
|
||||
FOR i := 1 TO N DO
|
||||
j := 1;
|
||||
WHILE j < len DO
|
||||
IF j MOD i = 0 THEN closed[j] := ~closed[j] END; INC(j) (* ~ = NOT *)
|
||||
END
|
||||
END;
|
||||
(* Print a state diagram of all doors *)
|
||||
FOR i := 1 TO N DO
|
||||
IF (i - 1) MOD 10 = 0 THEN Out.Ln END;
|
||||
IF closed[i] THEN Out.String("- ") ELSE Out.String("+ ") END
|
||||
END; Out.Ln;
|
||||
(* Print the numbers of the open doors *)
|
||||
FOR i := 1 TO N DO
|
||||
IF ~closed[i] THEN Out.Int(i, 0); Out.Char(" ") END
|
||||
END; Out.Ln
|
||||
END Do;
|
||||
|
||||
END Doors.
|
||||
|
|
@ -11,11 +11,10 @@ fn main(){
|
|||
doors[current - 1] = true
|
||||
increment++
|
||||
door_nbr += 2 * increment + 1
|
||||
}
|
||||
print('O')
|
||||
} else {
|
||||
print('=')
|
||||
}
|
||||
}
|
||||
doors.map( fn( it bool) bool { // graphically represent opened doors
|
||||
print( if it {( 'O')} else {('=')} )
|
||||
return it
|
||||
})
|
||||
println('')
|
||||
}
|
||||
|
|
|
|||
5
Task/100-doors/V-(Vlang)/100-doors-3.v
Normal file
5
Task/100-doors/V-(Vlang)/100-doors-3.v
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
fn main() {
|
||||
for i in 1..11 {
|
||||
print ( " Door ${i*i} is open.\n" )
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue