codeworld-base-0.2.0.0: Replacement base module for CodeWorld

Safe HaskellNone
LanguageHaskell98

Lessons.Logic

Description

Export only those functions useful for functional logic

Synopsis

Documentation

(+) :: Number -> Number -> Number infixl 6 #

Adds two numbers.

(-) :: Number -> Number -> Number infixl 6 #

Subtracts two numbers.

(*) :: Number -> Number -> Number infixl 7 #

Multiplies two numbers.

(/) :: Number -> Number -> Number infixl 7 #

Divides two numbers. The second number should not be zero.

(==) :: a -> a -> Truth infix 4 #

Compares values to see if they are equal.

max :: (Number, Number) -> Number #

Gives the larger of two numbers.

fromInteger :: Integer -> Number #

fromRational :: Rational -> Number #

fromString :: String -> Text #

drawingOf :: Picture -> Effect #

A program that displays a drawing of a single picture.

This is the simplest way to define a program in CodeWorld. The argument is a Picture.

For example:

program = drawingOf(codeWorldLogo)

lettering :: Text -> Picture #

A rendering of text characters.

solidCircle :: Number -> Picture #

A solid circle, with this radius

solidRectangle :: (Number, Number) -> Picture #

A solid rectangle, with this width and height

solidPolygon :: [Point] -> Picture #

A solid polygon with these points as vertices

up :: (Picture, Number) -> Picture #

A copy of the given picture that is shown the given number of units up from the original one.

translated :: (Picture, (Number, Number)) -> Picture #

A copy of the given Picture translated by the given horizontal and vertical displacements.

rotated :: (Picture, Number) -> Picture #

A picture rotated by this angle.

dilated :: (Picture, Number) -> Picture #

A picture with both dimensions scaled by the given factor. Factors greater than 1 make the picture bigger and less than 1 make it smaller.

Negative factors reflect the picture across the origin, which is the same as rotating it by 180 degrees.

scaled :: (Picture, Number, Number) -> Picture #

A picture scaled by these factors in the x and y directions. Factors greater than 1 stretch the picture larger in that direction, and less than 1 squish it smaller in that direction.

Negative factors also reflect the picture across that axis. For example, to mirror a picture over the x-axis: scaled(p, -1, 1).

colored :: (Picture, Color) -> Picture #

A picture drawn entirely in this color.

combined :: [Picture] -> Picture #

A picture made by combining the given list of pictures, so that the elements of the list are laid out from front to back. In other words, the first element of the list will be shown over the rest, and the last element of the list will be shown under all the previous ones. If the elements overlap, different orderings of the list will produce different results when drawn.

blank :: Picture #

A blank picture

joined :: [Text] -> Text #

error :: Text -> a #

Fails with an error message.

data Number #

The type for numbers.

Numbers can be positive or negative, whole or fractional. For example, 5, 3.2, and -10 are all values of the type Number.

Instances
Enum Number # 
Instance details

Defined in Internal.Num

Eq Number # 
Instance details

Defined in Internal.Num

Methods

(==) :: Number -> Number -> Bool

(/=) :: Number -> Number -> Bool

Floating Number # 
Instance details

Defined in Internal.Num

Fractional Number # 
Instance details

Defined in Internal.Num

Methods

(/) :: Number -> Number -> Number

recip :: Number -> Number

fromRational :: Rational -> Number

Num Number # 
Instance details

Defined in Internal.Num

Ord Number # 
Instance details

Defined in Internal.Num

Methods

compare :: Number -> Number -> Ordering

(<) :: Number -> Number -> Bool

(<=) :: Number -> Number -> Bool

(>) :: Number -> Number -> Bool

(>=) :: Number -> Number -> Bool

max :: Number -> Number -> Number

min :: Number -> Number -> Number

Real Number # 
Instance details

Defined in Internal.Num

Methods

toRational :: Number -> Rational

RealFloat Number # 
Instance details

Defined in Internal.Num

Methods

floatRadix :: Number -> Integer

floatDigits :: Number -> Int

floatRange :: Number -> (Int, Int)

decodeFloat :: Number -> (Integer, Int)

encodeFloat :: Integer -> Int -> Number

exponent :: Number -> Int

significand :: Number -> Number

scaleFloat :: Int -> Number -> Number

isNaN :: Number -> Bool

isInfinite :: Number -> Bool

isDenormalized :: Number -> Bool

isNegativeZero :: Number -> Bool

isIEEE :: Number -> Bool

atan2 :: Number -> Number -> Number

RealFrac Number # 
Instance details

Defined in Internal.Num

Methods

properFraction :: Integral b => Number -> (b, Number)

truncate :: Integral b => Number -> b

round :: Integral b => Number -> b

ceiling :: Integral b => Number -> b

floor :: Integral b => Number -> b

Show Number # 
Instance details

Defined in Internal.Num

Methods

showsPrec :: Int -> Number -> ShowS

show :: Number -> String

showList :: [Number] -> ShowS