Karel

Educational programming language re-implemented in Perl.

E. Choroba

GoodData, Prague

PerlMonks, CPAN, StackOverflow

choroba@matfyz.cz

Educational Language?

Baby with a computer

Karel?

Karel ČapekRossum

Why?

Karel the Robot—the Details

Karel the Robot—the Details (2)

The robot can learn new commands

Example - Turning Right

command right
    repeat 3 x
        left
    done  # <- Here ends the repeat.
end
traffic sign: turn left traffic sign: turn left traffic sign: turn left  = traffic sign: turn right

Calling a Function

command stairs
    while there's no wall
        forward
        left
        if there's no wall
            forward
            right  # User-defined.
        done
    done
end

The Killer Feature

Recursion

command follow-right-hand
    while there's no mark
        right
        while there's a wall
            left
        done
        if there's no wall
            forward
            follow-right-hand  # Recursion!
        done
    done
end
  • Like when calling another function, the robot remembers from where it recursed from and returns back.
  • Turing complete.

Homework

A laughing man

Implementation

Tested on Humans

Surgery

Current State

Future

Attacking robot

Thank you.

https://e-choroba.eu/16-yapc

Questions?

Thank you.

https://e-choroba.eu/16-yapc