Sandbox: Difference between revisions
(Example of unexpected behaviour by using "Excercises" template) |
mNo edit summary |
||
Line 181: | Line 181: | ||
}} | }} | ||
<!-- DON'T REMOVE PAGE --> | <!-- DON'T REMOVE PAGE --> | ||
---- | |||
<blockquote style="font-family: Georgia, Garamond, Times, serif"> | |||
<b>The Limit Computable or Approximation Model</b> | |||
There exists a sequence of Turing programs {<i>P<sub>t</sub></i> : <i>t</i> ∈ <i>T</i>} so that | |||
<i>P<sub>t</sub></i> computes function <i>g<sub>t</sub></i> at time <i>t</i> ∈ <i>T</i>. There is not | |||
necessarily any connection between different programs and computing may have to | |||
start all over again with a new program as the time changes from <i>t</i> to <i>t</i> + 1. | |||
Suppose a meteorologist receives data every second <i>t</i> ∈ <i>T</i> from weather | |||
stations scattered across the country. The configuration at the meteorologist's | |||
desk may be described using the Shoenfield Limit Lemma by a computable function | |||
where <i>g<sub>t</sub></i> is the computable characteristic function of | |||
<i>B<sub>t</sub></i>, the configuration of the meteorological computation at the end | |||
of time <i>t</i>. The computable function <i>g<sub>t</sub></i> gives an algorithm to | |||
compute the condition <i>B<sub>t</sub></i> at time <i>t</i> but it gives no relationship | |||
between <i>B<sub>t</sub></i> and <i>B</i><sub><i>t</i>+1</sub>. It will not be possible for the | |||
meteorologist to run, let alone write a new program every second. How will the | |||
meteorologist write a program to uniformly compute the index <i>g<sub>t</sub></i> | |||
for <i>t</i> ∈ <i>T</i> ? | |||
<b>The Online Model With an Oracle Machine</b> | |||
By the Shoenfield Limit Lemma there is a computably enumerable set <i>A</i> (or even | |||
a ∆<sup>0</sup><sub>2</sub> set) and oracle machine Φ<sub><i>e</i></sub> such that | |||
<i>B</i> = Φ<sub><i>e</i></sub><sup><i>A</i></sup>. Now the meteorologist can program the | |||
algorithm Φ<sub><i>e</i></sub> into a computer once and for all at the start of the | |||
day. Every second <i>t</i> ∈ <i>T</i> the meteorologist receives from the weather stations | |||
the latest readings <i>A<sub>t</sub></i> which enter directly into that computer by | |||
an network connection. The meteorologist does not (and cannot) change the | |||
program Φ<sub><i>e</i></sub> every second. The algorithm simply receives the | |||
“oracle” information <i>A</i> from the weather-station network as it is continually | |||
updated, and computes the approximation <i>B<sub>t</sub></i>(<i>x</i>) = | |||
Φ<sub><i>e</i></sub><sup><i>A<sub>t</sub></i></sup>(<i>x</i>). The meteorologist's program | |||
then produces the next scheduled weather forecast for the day from the | |||
algorithm's result. It is difficult to see how this meteorologist could have | |||
carried out that activity using a batch processing, automatic machine | |||
model, instead of an online model. | |||
</blockquote> |
Revision as of 07:03, 14 August 2024
Feel free to edit as you wish on this page. It is here for you to experiment with WIKI edit syntax.
fooling around
import Control.Monad.State.Lazy |
import testm |
TADA! this is a link to google, surprisingly
Siers Fri Jun 27 02:36:37 EEST 2014
section
--Lars 11:14, 27 July 2009 (UTC)
Media:Example.oggFile:Example.jpg
Headline text
Italic textBold text
Pavillon | Uge | Uge |
Matrix:
Embedded matrix:
Links
An internal link. To not exists page abcd. To exists page Haskell
External
http://cs.pdx.edu/~dick/HaskellSemantics/jpf05.pdf
http://cs.pdx.edu/~dick/HaskellSemantics/Haskell98.pdf
There is no appearance difference between dead link dead and live link live
Text taken from http://hpaste.org/3881: this wiki's syntax highlight at least does not garble the source, unlike hpaste's highlight.
An external link using text instead of the raw link address.
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 описать диспозиции
Section
Subsection
Subsubsection
huhu
Subsubsubsection
tables
basic table
Header 1 | Header 2 | Header 3 |
---|---|---|
row 1, cell 1 | row 1, cell 2 | row 1, cell 3 |
row 2, cell 1 | row 2, cell 2 | row 2, cell 3 |
Single Quote
https://github.com/ppelleti/haskell-wiki-bugs/issues/6
This seems to be fixed.
myLast :: [a] -> a
myLast [] = error "No end for empty lists!"
myLast [x] = x
myLast (_:xs) = myLast xs
myLast' = foldr1 (const id)
-- Prelude> const 1 2
-- 1
-- Prelude> (flip const) 1 2
-- 2
myLast'' = foldr1 (flip const)
myLast''' = head . reverse
myLast'''' = foldl1 (curry snd)
myLast''''' [] = error "No end for empty lists!"
myLast''''' x = x !! (length x -1)
haskelll code without syntax highlight (no '
problem)
-- import Prelude
import Data.List
import Data.Function
main :: IO ()
main = do
let xs = [(8,2),(3,2),(3,1),(10,2),(10,6)] :: [(Int,Int)]
print xs
let sortXs' = sort xs
print sortXs'
Another syntax highlighting example
import Control.Applicative
import Data.Bits
import Data.IORef
import Data.Word
ioDirA, iPolA, ioCon, gpPuA, gpioA, gpioB, olatA :: Word8
readReg16 :: ReadFunc -> Word8 -> IO Word16
readReg16 rf reg = word8sToWord16 <$> rf reg 2
data RomCode = RomA00 | RomA02
deriving (Eq, Ord, Show, Read, Bounded, Enum)
Exercises |
---|
|
The Limit Computable or Approximation Model
There exists a sequence of Turing programs {Pt : t ∈ T} so that Pt computes function gt at time t ∈ T. There is not necessarily any connection between different programs and computing may have to start all over again with a new program as the time changes from t to t + 1.
Suppose a meteorologist receives data every second t ∈ T from weather stations scattered across the country. The configuration at the meteorologist's desk may be described using the Shoenfield Limit Lemma by a computable function where gt is the computable characteristic function of Bt, the configuration of the meteorological computation at the end of time t. The computable function gt gives an algorithm to compute the condition Bt at time t but it gives no relationship between Bt and Bt+1. It will not be possible for the meteorologist to run, let alone write a new program every second. How will the meteorologist write a program to uniformly compute the index gt for t ∈ T ?
The Online Model With an Oracle Machine
By the Shoenfield Limit Lemma there is a computably enumerable set A (or even a ∆02 set) and oracle machine Φe such that B = ΦeA. Now the meteorologist can program the algorithm Φe into a computer once and for all at the start of the day. Every second t ∈ T the meteorologist receives from the weather stations the latest readings At which enter directly into that computer by an network connection. The meteorologist does not (and cannot) change the program Φe every second. The algorithm simply receives the “oracle” information A from the weather-station network as it is continually updated, and computes the approximation Bt(x) = ΦeAt(x). The meteorologist's program then produces the next scheduled weather forecast for the day from the algorithm's result. It is difficult to see how this meteorologist could have carried out that activity using a batch processing, automatic machine model, instead of an online model.