# Paste: Le compte est bon

Author: Jon literate-haskell Sat, 20 Jun 2009 16:53:14
Plain Text |
```> import List

La fonction qui dit comment étendre une liste de nombre.
On a le droit d'effectuer une opération sur deux nombres différents en les retirant de la liste
> f x = [ delete (a,str1) (delete (b,str2) ((a+b,"("++str1++"+"++str2++")"):x)) | (a,str1) <- x, (b,str2) <-x, not ((a,str1) == (b,str2))] ++
>       [ delete (a,str1) (delete (b,str2) ((a-b,"("++str1++"-"++str2++")"):x)) | (a,str1) <- x, (b,str2) <-x, not ((a,str1) == (b,str2))] ++
>       [ delete (a,str1) (delete (b,str2) ((a*b,"("++str1++"*"++str2++")"):x)) | (a,str1) <- x, (b,str2) <-x, not ((a,str1) == (b,str2))] ++
>       [ delete (a,str1) (delete (b,str2) ((a/b,"("++str1++"/"++str2++")"):x)) | (a,str1) <- x, (b,str2) <-x, not ((a,str1) == (b,str2))]

Des fonctions qui doivent surement déjà exister ?
> member x [] = Nothing
> member x ((y,expr):ys) | x == y = Just (y,expr)
>                        | otherwise = member x ys
> member2 x [] = Nothing
> member2 x (list:lists) = case (member x list) of
>                                Nothing -> member2 x lists
>                                Just a  -> Just a

La fonction principale
> myfind a lists  = case (member2 a lists) of
>                         Just a -> do
>                                       putStrLn "Trouvé : "
>                                       putStrLn (show a)
>                         Nothing -> do
>                                       putStrLn "j'itère .."
>                                       myfind a ( lists >>= f ) ```

## New Annotation

Summary: actionscriptada95antlrapacheconfapdlapplescriptaspaspect-jassembly-m68kassembly-macro32assembly-parrotassembly-r2000assembly-x86awkbbatchbbjbcelbeanshellbibtexcc#c++chillcilclipscobolcoldfusioncsscsvcudacvs-commitddjangodoxygendsssleiffelembperlerlangfactorfhtmlforthfortranfoxprofreemarkergettextgnuplotgroovyhaskellhexhlslhtaccesshtmli4gliconidlinforminiinno-setupinterlisiojavajavaccjavascriptjcljhtmljmkjsplatexlilypondlispliterate-haskelllotosluamailmakefilemaplemlmodula3moinmqscmyghtymysqlnetrexxnqcnsis2objective-cobjectrexxoccamomnimarkpascalpatchperlphppikepl-sqlpl1pop11postscriptpovraypowerdynamoprogressprologpropertiespspptlpvwavepyrexpythonrcprdrebolredcoderelax-ng-compactrenderman-ribrestrfcrhtmlrpm-specrtfrubyrviews#s+sasschemesdl/prsgmlshellscriptshtmlslatesmalltalksmi-mibsql-loadersqrsquidconfsvn-commitswigtcltemplate-toolkittextexinfotexttpltransact-sqltwikityposcriptuscriptvbscriptvelocityverilogvhdlxmlxqxslzpt