Difference between revisions of "Sandbox"
Jump to navigation
Jump to search
MichalPalka (talk | contribs) (section test) |
R Kieburtz (talk | contribs) |
||
Line 14: | Line 14: | ||
Embedded matrix: |
Embedded matrix: |
||
:<math>\left[ \begin{matrix}1 & 2 \\ 3 & \left[ \begin{matrix}5 & 6 \\ 7 & 8\end{matrix}\right] \end{matrix} \right]</math> |
:<math>\left[ \begin{matrix}1 & 2 \\ 3 & \left[ \begin{matrix}5 & 6 \\ 7 & 8\end{matrix}\right] \end{matrix} \right]</math> |
||
+ | |||
+ | http://cs.pdx.edu/~dick/HaskellSemantics/jpf05.pdf |
||
+ | :<\br> |
||
+ | http://cs.pdx.edu/~dick/HaskellSemantics/Haskell98.pdf |
||
Text taken from http://hpaste.org/3881: this wiki's syntax highlight at least does not garble the source, unlike hpaste's highlight. |
Text taken from http://hpaste.org/3881: this wiki's syntax highlight at least does not garble the source, unlike hpaste's highlight. |
Revision as of 17:50, 19 May 2009
Feel free to edit as you wish on this page. It is here for you to experiment with WIKI edit syntax.
section
Pavillon | Uge | Uge |
Matrix:
Embedded matrix:
http://cs.pdx.edu/~dick/HaskellSemantics/jpf05.pdf
- <\br>
http://cs.pdx.edu/~dick/HaskellSemantics/Haskell98.pdf
Text taken from http://hpaste.org/3881: this wiki's syntax highlight at least does not garble the source, unlike hpaste's highlight.
module Main where
import Prelude hiding (putStrLn, print)
import System.IO.UTF8
import Data.List (intersperse, find)
type Персонаж = String
type Персонажи = [Персонаж]
едоки :: Персонажи
едоки = [ "дедка", "бабка", "внучка", "жучка", "кошка", "мышка" ]
подходы :: [ Персонажи ]
подходы = scanl позвать [] едоки
where позвать тянущие подмога = подмога:тянущие
построились :: Персонажи -> [ (Персонаж, Персонаж) ]
построились едоки = zip едоки ("репка":едоки)
диспозиции = map (построились.reverse) подходы
описать [] = "Посадил дед репку ..."
описать диспозиция =
unwords ["Взялись:"
, concat $ intersperse ", " $ map за диспозиция
, ". Тянут-потянут -- " ++ result
]
where
за (кто,кого) = кто ++ " за " ++ винительный_падеж кого
винительный_падеж ы = init ы ++ "у"
result = case find ((=="мышка").fst) диспозиция of
Just _ -> "вытянули репку!"
Nothing -> "вытянуть не могут!"
main = mapM_ putStrLn $ map описать диспозиции