<commit_before>package org.moe.runtime.nativeobjects

import org.moe.runtime._

import scala.util.{Try, Success, Failure}

class MoeStrObject(
    v: String, klass : Option[MoeClass] = None
  ) extends MoeNativeObject[String](v, klass) {

  // runtime methods

  def increment (r: MoeRuntime): Unit = setNativeValue(MoeUtil.magicalStringIncrement(getNativeValue))

  def concat (r: MoeRuntime, other: MoeObject): MoeObject =
    r.NativeObjects.getStr(getNativeValue + other.unboxToString.get)

  def repeat (r: MoeRuntime, other: MoeObject): MoeObject = {
    val str = getNativeValue
    val n   = other.unboxToInt.get
    r.NativeObjects.getStr(List.fill(n)(str).reduce((x, y) => x + y))
  }

  // MoeObject overrides

  override def isFalse: Boolean = getNativeValue match {
    case "" | "0" => true
    case _        => false
  }
  override def toString = "\"" + getNativeValue + "\""

  // unboxing

  override def unboxToString: Try[String] = Success(getNativeValue)
  override def unboxToInt: Try[Int] = Try(getNativeValue.toInt)
  override def unboxToDouble: Try[Double] = Try(getNativeValue.toDouble)

}<commit_msg>mkString is simpler to make string from list.<commit_after>package org.moe.runtime.nativeobjects

import org.moe.runtime._

import scala.util.{Try, Success, Failure}

class MoeStrObject(
    v: String, klass : Option[MoeClass] = None
  ) extends MoeNativeObject[String](v, klass) {

  // runtime methods

  def increment (r: MoeRuntime): Unit = setNativeValue(MoeUtil.magicalStringIncrement(getNativeValue))

  def concat (r: MoeRuntime, other: MoeObject): MoeObject =
    r.NativeObjects.getStr(getNativeValue + other.unboxToString.get)

  def repeat (r: MoeRuntime, other: MoeObject): MoeObject = {
    val str = getNativeValue
    val n   = other.unboxToInt.get
    r.NativeObjects.getStr(List.fill(n)(str).mkString)
  }

  // MoeObject overrides

  override def isFalse: Boolean = getNativeValue match {
    case "" | "0" => true
    case _        => false
  }
  override def toString = "\"" + getNativeValue + "\""

  // unboxing

  override def unboxToString: Try[String] = Success(getNativeValue)
  override def unboxToInt: Try[Int] = Try(getNativeValue.toInt)
  override def unboxToDouble: Try[Double] = Try(getNativeValue.toDouble)

}
{'fraction_non_alphanumeric': 0.11591009255178493, 'fraction_numerical': 0.0008814455707360071, 'mean_word_length': 4.022123893805309, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 8, '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': '3314925', 'n_tokens_mistral': 759, 'n_tokens_neox': 745, 'n_words': 174}