Skip to main content
added 65 characters in body
Source Link
rturnbull
  • 3.9k
  • 16
  • 27

RR, 5959 44 bytes

Takes the time elapsed since the process beganF in R defaults to FALSE, formatsbut it's a regular variable and can be redefined. When used in arithmetic, FALSE is coerced to 0. Asking for F+1 therefore returns 1. We assign F to be F+1, format it nicely, printsprint, and waitswait for one second. Continues indefinitely.

repeat{print(hms::hms(round(proc.time()[3])))
Sys.sleep(1)}
repeat{print(hms::hms(F<-F+1))
Sys.sleep(1)}

Doesn't work on TIO (due to lack of the hms package), but here's a sample output from my machine:

00:00:00
00:00:01
00:00:02
00:00:03
00:00:04
00:00:05
00:00:06
00:00:07
00:00:08
00:00:09
00:00:10
00:00:11
00:00:12
00:00:13
00:00:00
00:00:01
00:00:02
00:00:03
00:00:04
00:00:05
00:00:06
00:00:07
00:00:08
00:00:09
00:00:10
00:00:11
00:00:12
00:00:13

R, 59 bytes

Takes the time elapsed since the process began, formats it nicely, prints, and waits for one second. Continues indefinitely.

repeat{print(hms::hms(round(proc.time()[3])))
Sys.sleep(1)}

Doesn't work on TIO (due to lack of the hms package), but here's a sample output from my machine:

00:00:00
00:00:01
00:00:02
00:00:03
00:00:04
00:00:05
00:00:06
00:00:07
00:00:08
00:00:09
00:00:10
00:00:11
00:00:12
00:00:13

R, 59 44 bytes

F in R defaults to FALSE, but it's a regular variable and can be redefined. When used in arithmetic, FALSE is coerced to 0. Asking for F+1 therefore returns 1. We assign F to be F+1, format it nicely, print, and wait for one second. Continues indefinitely.

repeat{print(hms::hms(F<-F+1))
Sys.sleep(1)}

Doesn't work on TIO (due to lack of the hms package), but here's a sample output from my machine:

00:00:00
00:00:01
00:00:02
00:00:03
00:00:04
00:00:05
00:00:06
00:00:07
00:00:08
00:00:09
00:00:10
00:00:11
00:00:12
00:00:13
Source Link
rturnbull
  • 3.9k
  • 16
  • 27

R, 59 bytes

Takes the time elapsed since the process began, formats it nicely, prints, and waits for one second. Continues indefinitely.

repeat{print(hms::hms(round(proc.time()[3])))
Sys.sleep(1)}

Doesn't work on TIO (due to lack of the hms package), but here's a sample output from my machine:

00:00:00
00:00:01
00:00:02
00:00:03
00:00:04
00:00:05
00:00:06
00:00:07
00:00:08
00:00:09
00:00:10
00:00:11
00:00:12
00:00:13