<commit_before>

IIk = Origin mimic

IIk Exit = Condition mimic
IIk mainContext = Ground mimic
IIk mainContext exit = method(signal!(IIk Exit))
IIk mainContext aliasMethod("exit", "quit")

IIk mainLoop = method(
  "Runs the main loop of IIk, continously reading input from 'System in' until the interpreter is quitted in some of the standard ways",

  out = System out
  err = System err
  in  = System in

  bind(
    rescue(IIk Exit, fn(c, out println("Bye."))),
    loop(
      bind(
        rescue(Condition Error, fn(c, err println("*** - #{c report}"))),
        out print("iik> ")
        out println("+> #{in read evaluateOn(mainContext) inspect}")
        out println))))

System ifMain(IIk mainLoop)<commit_msg>Upgrade the console a bit, to use the debugger instead of rescuing exceptions. This makes for a cleaner API and so on. Also establish the quit and abort restarts<commit_after>

IIk = Origin mimic

IIk Exit = Condition mimic

IIk mainContext = Ground mimic do(
  exit = method(signal!(IIk Exit))
  aliasMethod("exit", "quit"))

IIk out = System out
IIk err = System err
IIk in  = System in

IIk mainLoop = method(
  "Runs the main loop of IIk, continously reading input from 'System in' until the interpreter is quitted in some of the standard ways",


  debugger = Origin mimic
  System currentDebugger = debugger
  debugger invoke = method(
    condition, context, 
    invokeRestart(:abort)
  )

  bind(
    rescue(IIk Exit, fn(c, out println("Bye."))),
    restart(quit, fn()),

    loop(
      bind(
        restart(abort, fn()),

        out print("iik> ")
        out println("+> #{in read evaluateOn(mainContext) inspect}")
        out println))))

System ifMain(IIk mainLoop)
{'fraction_non_alphanumeric': 0.10504694835680752, 'fraction_numerical': 0.0, 'mean_word_length': 3.4633507853403143, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7513965', 'n_tokens_mistral': 542, 'n_tokens_neox': 520, 'n_words': 204}