Skip to main content
Woo-hoo! -2 bytes! Updated TIO link, changelog, byte count, explanation and golfed code.
Source Link

Racket, 43 37 2828 26 bytes

Changelog

  1. Thanks to @Dadsdy for the -2 bytes.
  2. The -4 bytes comes from converting #lang racket to #!racket.
  3. Another -9 as I found out that language statements may go into the header of TIO, and as such, don't contribute to number of bytes.
  4. I just learnt about Racket's do loop! -2 bytes! 🎉

Code

(let ado()(#f)(write(sleep 1))(a)) 

Try it online!Try it online!


Explanation

We create a named letdo loop that actsruns infinitely. Since we used #f (false) in dos second argument, the loop won't terminate as an infinite recursive callit will only terminate if there is a #t value.

If we were to expand this out and make it more readable, it would look like this:

(letdo loop() (#f) ; (sleep 1) doesn't return anything, so #<void> will be printed. (write (sleep 1)) (loop)) 

The named letdo loop acts a bit similar to JavaScript's IIFE techniquewhile loop:

(functionwhile (!false) {   setInterval(() =>// console.log(1), 1000);.. })(); 

Racket 43 37 28 bytes

Changelog

  1. Thanks to @Dadsdy for the -2 bytes.
  2. The -4 bytes comes from converting #lang racket to #!racket.
  3. Another -9 as I found out that language statements may go into the header of TIO, and as such, don't contribute to number of bytes.

Code

(let a()(write(sleep 1))(a)) 

Try it online!


Explanation

We create a named let that acts as an infinite recursive call.

If we were to expand this out and make it more readable, it would look like this:

(let loop () ; (sleep 1) doesn't return anything, so #<void> will be printed. (write (sleep 1)) (loop)) 

The named let acts similar to JavaScript's IIFE technique:

(function() {   setInterval(() => console.log(1), 1000); })(); 

Racket, 43 37 28 26 bytes

Changelog

  1. Thanks to @Dadsdy for the -2 bytes.
  2. The -4 bytes comes from converting #lang racket to #!racket.
  3. Another -9 as I found out that language statements may go into the header of TIO, and as such, don't contribute to number of bytes.
  4. I just learnt about Racket's do loop! -2 bytes! 🎉

Code

(do()(#f)(write(sleep 1))) 

Try it online!


Explanation

We create a do loop that runs infinitely. Since we used #f (false) in dos second argument, the loop won't terminate as it will only terminate if there is a #t value.

If we were to expand this out and make it more readable, it would look like this:

(do () (#f) ; (sleep 1) doesn't return anything, so #<void> will be printed. (write (sleep 1))) 

The do loop acts a bit similar to JavaScript's while loop:

while (!false) { // ... } 
Fixed Explanation to match updates to the changelog.
Source Link

Racket 43 37 28 bytes

Changelog

  1. Thanks to @Dadsdy for the -2 bytes.
  2. The -4 bytes comes from converting #lang racket to #!racket.
  3. Another -9 as I found out that language statements may go into the header of TIO, and as such, don't contribute to number of bytes.

Code

(let a()(write(sleep 1))(a)) 

Try it online!


Explanation

On line 1, we have Racket's #!racket language statement. This is required, but if we were to remove it, the program would be 28 bytes long.

On the second line, weWe create a named let that acts as an infinite recursive call.

If we were to expand this out and make it more readable, it would look like this:

(let loop () ; (sleep 1) doesn't return anything, so #<void> will be printed. (write (sleep 1)) (loop)) 

The named let acts similar to JavaScript's IIFE technique:

(function() { setInterval(() => console.log(1), 1000); })(); 

Racket 43 37 28 bytes

Changelog

  1. Thanks to @Dadsdy for the -2 bytes.
  2. The -4 bytes comes from converting #lang racket to #!racket.
  3. Another -9 as I found out that language statements may go into the header of TIO, and as such, don't contribute to number of bytes.

Code

(let a()(write(sleep 1))(a)) 

Try it online!


Explanation

On line 1, we have Racket's #!racket language statement. This is required, but if we were to remove it, the program would be 28 bytes long.

On the second line, we create a named let that acts as an infinite recursive call.

If we were to expand this out and make it more readable, it would look like this:

(let loop () ; (sleep 1) doesn't return anything, so #<void> will be printed. (write (sleep 1)) (loop)) 

The named let acts similar to JavaScript's IIFE technique:

(function() { setInterval(() => console.log(1), 1000); })(); 

Racket 43 37 28 bytes

Changelog

  1. Thanks to @Dadsdy for the -2 bytes.
  2. The -4 bytes comes from converting #lang racket to #!racket.
  3. Another -9 as I found out that language statements may go into the header of TIO, and as such, don't contribute to number of bytes.

Code

(let a()(write(sleep 1))(a)) 

Try it online!


Explanation

We create a named let that acts as an infinite recursive call.

If we were to expand this out and make it more readable, it would look like this:

(let loop () ; (sleep 1) doesn't return anything, so #<void> will be printed. (write (sleep 1)) (loop)) 

The named let acts similar to JavaScript's IIFE technique:

(function() { setInterval(() => console.log(1), 1000); })(); 
Added Changelog header. Added styling list. Subtracted 9 bytes. Modified code to reflect changes.
Source Link

Racket 43 3737 28 bytes

Thanks to @Dadsdy for the -2 bytes. The -4 bytes comes from converting #lang racket to #!racket

Changelog

  1. Thanks to @Dadsdy for the -2 bytes.
  2. The -4 bytes comes from converting #lang racket to #!racket.
  3. Another -9 as I found out that language statements may go into the header of TIO, and as such, don't contribute to number of bytes.

Code

#!racket (let a()(write(sleep 1))(a)) 

Try it online!Try it online!


Explanation

On line 1, we have Racket's #!racket language statement. This is required, but if we were to remove it, the program would be 28 bytes long.

On the second line, we create a named let that acts as an infinite recursive call.

If we were to expand this out and make it more readable, it would look like this:

(let loop () ; (sleep 1) doesn't return anything, so #<void> will be printed. (write (sleep 1)) (loop)) 

The named let acts similar to JavaScript's IIFE technique:

(function() { setInterval(() => console.log(1), 1000); })(); 

Racket 43 37 bytes

Thanks to @Dadsdy for the -2 bytes. The -4 bytes comes from converting #lang racket to #!racket

#!racket (let a()(write(sleep 1))(a)) 

Try it online!


Explanation

On line 1, we have Racket's #!racket language statement. This is required, but if we were to remove it, the program would be 28 bytes long.

On the second line, we create a named let that acts as an infinite recursive call.

If we were to expand this out and make it more readable, it would look like this:

(let loop () ; (sleep 1) doesn't return anything, so #<void> will be printed. (write (sleep 1)) (loop)) 

The named let acts similar to JavaScript's IIFE technique:

(function() { setInterval(() => console.log(1), 1000); })(); 

Racket 43 37 28 bytes

Changelog

  1. Thanks to @Dadsdy for the -2 bytes.
  2. The -4 bytes comes from converting #lang racket to #!racket.
  3. Another -9 as I found out that language statements may go into the header of TIO, and as such, don't contribute to number of bytes.

Code

(let a()(write(sleep 1))(a)) 

Try it online!


Explanation

On line 1, we have Racket's #!racket language statement. This is required, but if we were to remove it, the program would be 28 bytes long.

On the second line, we create a named let that acts as an infinite recursive call.

If we were to expand this out and make it more readable, it would look like this:

(let loop () ; (sleep 1) doesn't return anything, so #<void> will be printed. (write (sleep 1)) (loop)) 

The named let acts similar to JavaScript's IIFE technique:

(function() { setInterval(() => console.log(1), 1000); })(); 
Added new TIO link, -6 bytes, simplified explanation a bit, fixed a tiny bit of styling also.
Source Link
Loading
Source Link
Loading