<commit_before>%%%
%%% Authors:
%%%   <NAME> <<EMAIL>>
%%%
%%% Copyright:
%%%   <NAME>, 1997
%%%
%%% Last change:
%%%   $Date$ by $Author$
%%%   $Revision$
%%%
%%% This file is part of Mozart, an implementation
%%% of Oz 3
%%%    http://www.mozart-oz.org
%%%
%%% See the file "LICENSE" or
%%%    http://www.mozart-oz.org/LICENSE.html
%%% for information on usage and redistribution
%%% of this file, and for a DISCLAIMER OF ALL
%%% WARRANTIES.
%%%


local

   local
      fun {Flatten I V Ss}
         if I>0 then VI=V.I in
            {Flatten I-1 V if {IsTuple VI} andthen {Label VI}=='#' then
                              {Flatten {Width VI} VI Ss}
                           else
                              {ToString VI}|Ss
                           end}
         else Ss
         end
      end
      fun {App Is Sr}
         case Is of nil then {AllToString Sr}
         [] I|Ir then I|{App Ir Sr}
         end
      end
      fun {AllToString Ss}
         case Ss of nil then nil
         [] S|Sr then {App S Sr}
         end
      end
      fun {SignOzToOS Is}
         case Is of nil then nil
         [] I|Ir then
            case I of &~ then &- else I end|{SignOzToOS Ir}
         end
      end
   in
      fun {ToString V}
         case {Value.type V}
         of int then
            if V<0 then &-|{Int.toString {Abs V}}
            else {Int.toString V}
            end
         [] float then
            {SignOzToOS {Float.toString V}}
         [] atom then
            case V
            of '#' then nil
            [] nil then nil
            else {Atom.toString V}
            end
         [] byteString then
            {Boot_ByteString.toString V}
         [] tuple then
            case {Label V}
            of '#' then {AllToString {Flatten {Width V} V nil}}
            [] '|' then V
            end
         end
      end
   end

   local
      proc {ChangeSignAll I V S NewV}
         if I>0 then
            NewV.I={ChangeSign V.I S}
            {ChangeSignAll I-1 V S NewV}
         end<commit_msg>VirtualString.toString now gives a nice type error.    Due to popular request.<commit_after>%%%
%%% Authors:
%%%   <NAME> <<EMAIL>>
%%%
%%% Copyright:
%%%   <NAME>, 1997
%%%
%%% Last change:
%%%   $Date$ by $Author$
%%%   $Revision$
%%%
%%% This file is part of Mozart, an implementation
%%% of Oz 3
%%%    http://www.mozart-oz.org
%%%
%%% See the file "LICENSE" or
%%%    http://www.mozart-oz.org/LICENSE.html
%%% for information on usage and redistribution
%%% of this file, and for a DISCLAIMER OF ALL
%%% WARRANTIES.
%%%


local

   local
      fun {Flatten I V Ss}
         if I>0 then VI=V.I in
            {Flatten I-1 V if {IsTuple VI} andthen {Label VI}=='#' then
                              {Flatten {Width VI} VI Ss}
                           else
                              {ToString VI}|Ss
                           end}
         else Ss
         end
      end
      fun {App Is Sr}
         case Is of nil then {AllToString Sr}
         [] I|Ir then I|{App Ir Sr}
         end
      end
      fun {AllToString Ss}
         case Ss of nil then nil
         [] S|Sr then {App S Sr}
         end
      end
      fun {SignOzToOS Is}
         case Is of nil then nil
         [] I|Ir then
            case I of &~ then &- else I end|{SignOzToOS Ir}
         end
      end
   in
      proc {ToString V ?Res}
         Res = case {Value.type V}
               of int then
                  if V<0 then &-|{Int.toString {Abs V}}
                  else {Int.toString V}
                  end
               [] float then
                  {SignOzToOS {Float.toString V}}
               [] atom then
                  case V
                  of '#' then nil
                  [] nil then nil
                  else {Atom.toString V}
                  end
               [] byteString then
                  {Boot_ByteString.toString V}
               [] tuple then
                  case {Label V}
                  of '#' then {AllToString {Flatten {Width V} V nil}}
                  [] '|' then V
                  else
                     {Exception.raiseError
                      kernel(type 'VirtualString.toString'
                             [V Res] virtualString 1 nil)} unit
                  end
               else
                  {Exception.raiseError
                   kernel(type 'VirtualString.toString'
                          [V Res] virtualString 1 nil)} unit
               end
      end
   end

   local
      proc {ChangeSignAll I V S NewV}
         if I>0 then
            NewV.I={ChangeSign V.I S}
            {ChangeSignAll I-1 V S NewV}
         end
{'fraction_non_alphanumeric': 0.1022260644045818, 'fraction_numerical': 0.004754700669980549, 'mean_word_length': 1.1871455576559546, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, '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': '2244015', 'n_tokens_mistral': 1389, 'n_tokens_neox': 1329, 'n_words': 467}