L'algo tourne, mais ne rend pas le résultat escompté...

pull/1/head
Jean-Christophe Jameux 4 years ago
parent fd4ae3b1c4
commit 09cfbed439
  1. BIN
      elm-stuff/0.19.1/QCM.elmi
  2. BIN
      elm-stuff/0.19.1/QCM.elmo
  3. BIN
      elm-stuff/0.19.1/d.dat
  4. 32
      src/QCM.elm

Binary file not shown.

Binary file not shown.

Binary file not shown.

@ -83,7 +83,7 @@ view model =
<| input [ placeholder "Format de la question", value model.question, onInput Question ] [] <| input [ placeholder "Format de la question", value model.question, onInput Question ] []
:: button [ onClick GenererQuestion ] [ text "Générer les questions" ] :: button [ onClick GenererQuestion ] [ text "Générer les questions" ]
:: ( p [] <| L.map text model.questions ) :: ( p [] <| L.map text model.questions )
:: [ text :: text
( (
let expressionParseePotentielle = PM.parseMaths "3+(2/3)^-2/3" let expressionParseePotentielle = PM.parseMaths "3+(2/3)^-2/3"
in in
@ -93,7 +93,14 @@ view model =
case Maybe.map F.teX <| PM.evaluer <| expressionParsee of case Maybe.map F.teX <| PM.evaluer <| expressionParsee of
Just a -> a Just a -> a
Nothing -> "Les puissances non-entières ne sont pas acceptées." Nothing -> "Les puissances non-entières ne sont pas acceptées."
) ] )
:: L.map text
( remplacer
[ Aremplacer "a" ["1","2"], Aremplacer "b" ["3","4"] ]
[ Texte "Calculer $", Variable "a" , Texte "+" , Variable "a+b" , Texte "$."]
)
++ L.map text (remplacer [] [Texte "chose"])
++ L.map text (remplacer [] [Texte "chose"])
{- {-
, [ dl05 [0, 4, 2] 5 ] , [ dl05 [0, 4, 2] 5 ]
@ -202,19 +209,25 @@ type alias Aremplacer =
remplacer : List Aremplacer -> List TexteVariable -> List String remplacer : List Aremplacer -> List TexteVariable -> List String
remplacer ars tvs = remplacer ars tvs =
case tvs of case tvs of
[] -> [] [] -> [""]
Texte chaine :: tvss -> L.map S.append chaine <| remplacer ars tvss Texte chaine :: tvss -> L.map (S.append chaine) <| remplacer ars tvss
Variable chaine :: tvss -> mix ([chaine]) (remplacer ars tvss) Variable chaine :: tvss ->
mix
[ remplacerToutDansLesChaines ars [chaine]
, remplacer ars tvss
]
|> L.map S.concat
remplacerToutDansLesChaines List Aremplacer -> List String -> List String remplacerToutDansLesChaines : List Aremplacer -> List String -> List String
remplacerToutDansLesChaines ars chaines = remplacerToutDansLesChaines ars chaines =
case ars of case ars of
[] -> chaines [] -> chaines
ar :: arss -> ar :: arss ->
(L.concat <| L.map (remplacerLaVariableParLesValeursDansLaChaine ar.var ar.val) chaines) L.map (remplacerLaVariableParLesValeursDansLaChaine ar.var ar.vals) chaines
:: |> L.concat
|> remplacerToutDansLesChaines arss
{-- {--
case chaines of case chaines of
chaine :: chainess -> chaine :: chainess ->
@ -224,12 +237,13 @@ remplacerToutDansLesChaines ars chaines =
remplacerDansLeTexteVariable ar t remplacerDansLeTexteVariable ar t
|> |>
--} --}
{--
remplacerDansLeTexteVariable : Aremplacer -> TexteVariable -> List String remplacerDansLeTexteVariable : Aremplacer -> TexteVariable -> List String
remplacerDansLeTexteVariable a t = remplacerDansLeTexteVariable a t =
case t of case t of
Texte tt -> Texte tt Texte tt -> Texte tt
Variable tt -> remplacerLaVariableParLesValeursDansLaChaine a.var a.vals tt Variable tt -> remplacerLaVariableParLesValeursDansLaChaine a.var a.vals tt
--}
remplacerLaVariableParLesValeursDansLaChaine : String -> List String -> String -> List String remplacerLaVariableParLesValeursDansLaChaine : String -> List String -> String -> List String
remplacerLaVariableParLesValeursDansLaChaine var vals chaine = remplacerLaVariableParLesValeursDansLaChaine var vals chaine =

Loading…
Cancel
Save