<commit_before>module Keisan
  module AST
    class ConstantLiteral < Literal
      def self.from_value(value)
        case value
        when Numeric
          AST::Number.new(value)
        when ::String
          AST::String.new(value)
        when TrueClass, FalseClass
          AST::Boolean.new(value)
        when NilClass
          AST::Null.new
        else
          raise TypeError.new("#{value}'s type is invalid, #{value.class}")
        end
      end

      def coerce(other)
        [self.class.from_value(other), self]
      end

      def to_s
        value.to_s
      end
    end
  end
end<commit_msg>Do not change order when coercing<commit_after>module Keisan
  module AST
    class ConstantLiteral < Literal
      def self.from_value(value)
        case value
        when Numeric
          AST::Number.new(value)
        when ::String
          AST::String.new(value)
        when TrueClass, FalseClass
          AST::Boolean.new(value)
        when NilClass
          AST::Null.new
        else
          raise TypeError.new("#{value}'s type is invalid, #{value.class}")
        end
      end

      def coerce(other)
        [self, self.class.from_value(other)]
      end

      def to_s
        value.to_s
      end
    end
  end
end
{'fraction_non_alphanumeric': 0.08267090620031796, 'fraction_numerical': 0.0, 'mean_word_length': 1.7369565217391305, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, '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': '2472009', 'n_tokens_mistral': 382, 'n_tokens_neox': 364, 'n_words': 94}