src/Tools/isac/BaseDefinitions/error-pattern-def.sml
author Walther Neuper <walther.neuper@jku.at>
Fri, 24 Apr 2020 08:51:05 +0200
changeset 59909 821f038df564
parent 59886 src/Tools/isac/BaseDefinitions/error-fill-def.sml@106e7d8723ca
child 59919 3a7fb975af9d
permissions -rw-r--r--
separate struct.Error_Pattern, rename identifiers
walther@59866
     1
(* Title:  BaseDefinitions/error-pattern-def.sml
walther@59858
     2
   Author: Walther Neuper
walther@59858
     3
   (c) due to copyright terms
walther@59909
     4
*)
walther@59909
     5
signature ERROR_PATTERN_DEFINITION =
walther@59909
     6
sig
walther@59909
     7
  eqtype id
walther@59909
     8
  type T = id * term list * thm list
walther@59909
     9
  val s_to_string : T list -> string
walther@59858
    10
walther@59909
    11
  type fill_in_id
walther@59909
    12
  type fill_in
walther@59858
    13
end
walther@59858
    14
walther@59858
    15
(**)
walther@59909
    16
structure Error_Pattern_Def(**): ERROR_PATTERN_DEFINITION(**) =
walther@59858
    17
struct
walther@59858
    18
(**)
walther@59858
    19
walther@59909
    20
type id = Rule_Def.errpatID
walther@59858
    21
walther@59909
    22
type T =
walther@59909
    23
  id          (* one identifier for a list of patterns                    *)
walther@59909
    24
  * term list (* error patterns                                           *)
walther@59858
    25
  * thm list  (* thms related to error patterns; note that respective lhs 
walther@59858
    26
                 do not match (which reflects student's error).
walther@59909
    27
                 fillpatterns are stored with these thms.                 *)
walther@59858
    28
fun errpat2str (id, tms, thms) =
walther@59875
    29
  "(\"" ^ id ^ "\",\n" ^ UnparseC.terms tms ^ ",\n" ^ ThmC_Def.string_of_thms thms
walther@59909
    30
fun s_to_string errpats = (strs2str' o (map errpat2str)) errpats
walther@59858
    31
walther@59858
    32
(* for (at least) 2 kinds of access:
walther@59909
    33
  (1) given an id, find the respective fill_in's (e.g. in fun find_fill_patterns)
walther@59909
    34
  (2) given a thm, find respective fill_in's *)
walther@59909
    35
type fill_in_id = string
walther@59909
    36
type fill_in =
walther@59909
    37
  fill_in_id  (* DESIGN ?TODO: give an order w.r.t difficulty ? *)
walther@59858
    38
  * term      (* the pattern with fill-in gaps                  *)
walther@59909
    39
  * id;       (* which the fill_in would be a help for          
walther@59858
    40
                 DESIGN ?TODO: list for several patterns ?      *)
walther@59858
    41
walther@59858
    42
(**)end(**)