Bin given limits: Difference between revisions

Content added Content deleted
m (→‎{{header|Phix}}: added syntax colouring, made p2js compatible)
m (→‎{{header|R}}: Syntax highlighting.)
Line 1,945: Line 1,945:


Code such as 0:length(limits) is generally considered bad practice, but it didn't cause any problems here. To my amazement, this code works even if limits is of size 0 or 1. Even the <= printing doesn't break!
Code such as 0:length(limits) is generally considered bad practice, but it didn't cause any problems here. To my amazement, this code works even if limits is of size 0 or 1. Even the <= printing doesn't break!
<lang r>limits1<-c(23, 37, 43, 53, 67, 83)
<lang rsplus>limits1<-c(23, 37, 43, 53, 67, 83)
data1<-c(95,21,94,12,99,4,70,75,83,93,52,80,57,5,53,86,65,17,92,83,71,61,54,58,47,
data1<-c(95,21,94,12,99,4,70,75,83,93,52,80,57,5,53,86,65,17,92,83,71,61,54,58,47,
16,8,9,32,84,7,87,46,19,30,37,96,6,98,40,79,97,45,64,60,29,49,36,43,55)
16,8,9,32,84,7,87,46,19,30,37,96,6,98,40,79,97,45,64,60,29,49,36,43,55)
Line 2,032: Line 2,032:
Bin 9 covers the range: 634 ≤ x < 720 and contains 16 elements.
Bin 9 covers the range: 634 ≤ x < 720 and contains 16 elements.
Bin 10 covers the range: 720 ≤ x < ∞ and contains 59 elements.</pre>
Bin 10 covers the range: 720 ≤ x < ∞ and contains 59 elements.</pre>

=={{header|Racket}}==
=={{header|Racket}}==