[erlang-questions] Charging your phone with Erlang

John Hughes <>
Sat Feb 7 12:50:32 CET 2009


Here's a little tip.

Imagine you're in a hotel room with your laptop, but you forgot your phone 
charger. Luckily, you can plug in the lap-top, connect your phone to it with 
a USB cable, and then the phone charges... but only while the laptop remains 
awake. So you need a way to prevent Windows (in my case) from putting the 
laptop into stand-by mode during the night.

Simple! Start the Erlang shell, and type

1> F=fun(F)->F(F)end, F(F).

The shell will sit there 'till morning, keeping your machine awake and your 
phone charging. (Thank you, tail-call optimisation!)

It's no doubt more environmentally friendly to remember your phone charger, 
but I'm only human and this tip has served me well a number of times!

John 




More information about the erlang-questions mailing list