The pomodoro technique done the chicken way

I have come accross The Pomodoro Technique(tm) which is intended to keep you focused on your current task. It is a simple method of constraining oneself to a work cycle of 25 minutes followed by a 5 minutes break. After that set the clock for the next task. Repeat.

If one work cycle is interrupted, it has to be restarted. Once the work cycle is over you are not allowed to do anything work related for the following 5 minutes. This helps refilling your attention reservoir and relaxes the mind.

This insane person writes about a 30/30 cycle. This is hard to explain to my boss and I wondered how the 25/5 cycle proposed in the promodoro book would work out.

Because I am working at my computer most of the time in addition to the impracticability of running a kitchen timer in my office I was looking for a simple timer application that would do just that:

Of course Chicken Scheme comes to the rescue:

(use al alc linenoise openal posix)

(define device (alc:OpenDevice #f))
(define context (alc:CreateContext device #f))
(alc:MakeContextCurrent context)


(define end-source (openal:make-source
                     (openal:load-buffer "clock.wav")))
(define running-source (openal:make-source
                        (openal:load-buffer "ticking.wav")))

(define (signal-end) (al:Sourcei end-source 0 0) (al:SourcePlay end-source))
(define (signal-running) (al:Sourcei end-source 0 0) (al:SourcePlay running-source))

(define (clock minutes tick)
  (let loop ((left (* 60 minutes)))
    (cond ((<= left 0) 'done)
          (else (sleep 1)
                (tick)
                (loop (sub1 left))))))

(define (relax-cycle)
  (clock 5 signal-running)
  (signal-end))

(define (work-cycle)
  (clock 25 signal-running)
  (signal-end))

(define *pomodoro-tasks* '())

(define (pomodoro)
  (print "Welcome to another Pomodoro work cycle of 25 minutes!")
  (set! *pomodoro-tasks* (cons (linenoise "You will now work on: ") *pomodoro-tasks*))
  (work-cycle)
  (print "Good Job! Now relax for 5 minutes")
  (relax-cycle)
  (print "Tasks completed so far:")
  (map print *pomodoro-tasks*)
  (print "Press [Enter] for another pomodoro!")
  (pomodoro))

(pomodoro)

(alc:MakeContextCurrent #f)
(alc:DestroyContext context)
(alc:CloseDevice device)

This small script uses the OpenAL sound library to play wavs I found "on the internet". Chicken's OpenAL egg does the magic. All that is left is setting a counter and be done.

Here is a sample session:

$ ./pomodoro
Welcome to another Pomodoro work cycle of 25 minutes!
You will now work on: Writing a blog article about pomodoro script
Good Job! Now Relax for 5 minutes
Tasks completed so far:
Writing a blog article about pomodoro script
Press [Enter] for another pomodoro!

Have fun trying the pomodoro technique for yourself!

Code on this site is licensed under a 2 clause BSD license, everything else unless noted otherwise is licensed under a CreativeCommonsAttribution-ShareAlike3.0UnportedLicense