Safe Haskell | None |
---|---|
Language | Haskell98 |
Lessons.Logic
Description
Export only those functions useful for functional logic
Synopsis
- (+) :: Number -> Number -> Number
- (-) :: Number -> Number -> Number
- (*) :: Number -> Number -> Number
- (/) :: Number -> Number -> Number
- (==) :: a -> a -> Truth
- max :: (Number, Number) -> Number
- negate :: Number -> Number
- fromInteger :: Integer -> Number
- fromRational :: Rational -> Number
- fromString :: String -> Text
- drawingOf :: Picture -> Effect
- lettering :: Text -> Picture
- printed :: Number -> Text
- solidCircle :: Number -> Picture
- solidRectangle :: (Number, Number) -> Picture
- solidPolygon :: [Point] -> Picture
- up :: (Picture, Number) -> Picture
- translated :: (Picture, (Number, Number)) -> Picture
- rotated :: (Picture, Number) -> Picture
- dilated :: (Picture, Number) -> Picture
- scaled :: (Picture, Number, Number) -> Picture
- colored :: (Picture, Color) -> Picture
- combined :: [Picture] -> Picture
- blank :: Picture
- joined :: [Text] -> Text
- error :: Text -> a
- data Number
Documentation
(/) :: Number -> Number -> Number infixl 7 #
Divides two numbers. The second number should not be zero.
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)
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.
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)
.
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.
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 # | |
Eq Number # | |
Floating Number # | |
Fractional Number # | |
Defined in Internal.Num | |
Num Number # | |
Ord Number # | |
Real Number # | |
Defined in Internal.Num Methods toRational :: Number -> Rational | |
RealFloat Number # | |
Defined in Internal.Num Methods floatRadix :: Number -> Integer floatDigits :: Number -> Int floatRange :: Number -> (Int, Int) decodeFloat :: Number -> (Integer, Int) encodeFloat :: Integer -> Int -> Number significand :: Number -> Number scaleFloat :: Int -> Number -> Number isInfinite :: Number -> Bool isDenormalized :: Number -> Bool isNegativeZero :: Number -> Bool | |
RealFrac Number # | |
Show Number # | |