<commit_before>#
# [linsert]
#

.namespace [ "Tcl" ]

.sub "&linsert"
  
  .local pmc argv
  argv = foldup

  # XXX need error handling.

  .local pmc the_list
  the_list = shift argv
 
  .local pmc position
  position = shift argv

  .local pmc list_index
  list_index = find_global "_Tcl", "_list_index"

  ($I0,$P0,$I2) = list_index(the_list,position)
  if $I0 != TCL_OK goto error
  #linsert treats "end" differently
  if $I2 == 0 goto next
  inc $P0

next: 
  .local int the_index
  the_index = $P0

  # XXX workaround, splice doesn't work on TclList <-> TclList.
  # Until that's fixed, splice Arrays, then post-covert to a TclList<commit_msg>Convert strings to lists in linsert<commit_after>#
# [linsert]
#

.namespace [ "Tcl" ]

.sub "&linsert"
  
  .local pmc argv
  argv = foldup

  # XXX need error handling.

  .local pmc __list
  __list = find_global "_Tcl", "__list"
  
  .local pmc the_list
  the_list = shift argv
  the_list = __list(the_list)
 
  .local pmc position
  position = shift argv

  .local pmc list_index
  list_index = find_global "_Tcl", "_list_index"

  ($I0,$P0,$I2) = list_index(the_list,position)
  if $I0 != TCL_OK goto error
  #linsert treats "end" differently
  if $I2 == 0 goto next
  inc $P0

next: 
  .local int the_index
  the_index = $P0

  # XXX workaround, splice doesn't work on TclList <-> TclList.
  # Until that's fixed, splice Arrays, then post-covert to a TclList
{'fraction_non_alphanumeric': 0.10474168435951875, 'fraction_numerical': 0.01132342533616419, 'mean_word_length': 3.27190332326284, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, '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': '4317549', 'n_tokens_mistral': 555, 'n_tokens_neox': 527, 'n_words': 165}