# Karel Language Reference ## Primitives - `step :: Karel -> Karel`
Moves Karel one intersection forward. - `turnLeft :: Karel -> Karel`
Pivots Karel 90 degrees left. - `pickBeeper :: Karel -> Karel`
Takes a beeper from the current intersection and puts it in the beeper bag. - `putBeeper :: Karel -> Karel`
Takes a beeper from the beeper bag and puts it at the current intersection. ## Sensors - `frontIsClear :: Karel -> Bool`
Returns `True` if there is no wall directly in front of Karel. Returns `False` if there is a wall. - `beepersPresent :: Karel -> Bool`
Returns `True` if Karel is standing at an intersection that has a beeper, `False` otherwise. - `facing :: Direction -> Karel -> Bool`
Returns `True` if Karel is facing queried direction, `False` otherwise. - `facingNorth :: Karel -> Bool`
Returns `True` if Karel is facing north, `False` otherwise. - `beepersInBag :: Karel -> Bool`
Returns `True` if there is at least one beeper in Karel's beeper bag, `False` if the beeper bag is empty. ## Creating world - `worldWithDimensions :: Vector -> World`
Takes a pair of integers, specifying dimensions of a world `(width, height)` and returns new world. - `setBeepersAt :: Vector -> Int -> World -> World`
Sets beepers at specified position, if beepers = 0 => removes them, negative count or position not in the world results in error. - `addWallAt :: Vector -> Direction -> World -> World`
Adds wall at specified position to specified direction, if position is not in the world, results in error. - `removeWallAt :: Vector -> Direction -> World -> World`
Removes wall at specified position to specified direction, if position is not in the world, results in error. ## Creating Karel - `defaultKarel :: World -> Karel`
Creates Karel instance with a given world. Karel is defaultly placed at (1, 1), facing East with no beepers in his bag. - `initialPosition :: Vector -> Karel -> Karel`
Sets Karel's initial position, if position is out of the world, results in error. - `initialDirection :: Direction -> Karel -> Karel`
Sets Karel's initial direction. - `initialBeepersInBag :: Int -> Karel -> Karel`
Sets Karel's initial beepers in bag, if negative number is given, results in error. # Super Karel Language Reference Super Karel is an extension to the basic Karel the Karel library. Super Karel is "equipped" with additional sensors. ## Sensors - `frontIsBlocked :: Karel -> Bool`
Returns `True` if there is a wall directly in front of Karel, `False` otherwise. - `leftIsClear :: Karel -> Bool`
Returns `True` if there is no wall immediately to Karel's left, `False` if there is. - `leftIsBlocked :: Karel -> Bool`
Returns `True` if there is a wall immediately to Karel's left, `False` otherwise. - `rightIsClear :: Karel -> Bool`
Returns `True` if there is no wall immediately to Karel's right, `False` if there is. - `rightIsBlocked :: Karel -> Bool`
Returns `True` if there is a wall immediately to Karel's right, `False` otherwise. - `no_beepers_present :: Karel -> Bool`
Returns `True` if there is not beeper at the current intersection, `False` if there is a beeper at the current intersection. - `notFacing :: Direction -> Karel -> Bool`
Returns `True` if Karel is not facing queried direction, `False` if he is not. - `notFacingNorth :: Karel -> Bool`
Returns `True` if Karel is not facing north, `False` if he is facing north. - `facingSouth :: Karel -> Bool`
Returns `True` if Karel is facing south, `False` otherwise. - `notFacingSouth :: Karel -> Bool`
Returns `True` if Karel is not facing south, `False` if he is facing south. - `facingEast :: Karel -> Bool`
Returns `True` if Karel is facing east, `False` otherwise. - `notFacingEast :: Karel -> Bool`
Returns `True` if Karel is not facing east, `False` if he is facing east. - `facingWest :: Karel -> Bool`
Returns `True` if Karel is facing west, `False` otherwise. - `notFacingWest :: Karel -> Bool`
Returns `True` if Karel is not facing west, `False` if he is facing west. - `noBeepersInBag :: Karel -> Bool`
Returns `True` if Karel's beeper bag is empty, `False` if there is at least one beeper in the beeper bag.