<commit_before>#include <stdio.h>

#include "lisp.h"

static void print(FILE *stream, Object *obj)
{
    if (obj == NULL)
    {
        St_Error("print: NULL");
    }

    switch (obj->type)
    {
    case TINT:
        fprintf(stream, "%d", obj->int_value);
        break;

    case TCELL:
        fprintf(stream, "(");

        print(stream, obj->car);

        while (ST_PAIRP(obj->cdr))
        {
            obj = obj->cdr;
            fprintf(stream, " ");
            print(stream, obj->car);
        }

        if (!ST_NULLP(obj->cdr))
        {
            fprintf(stream, " . ");
            print(stream, obj->cdr);
        }

        fprintf(stream, ")");

        break;

    case TNIL:
        fprintf(stream, "()");
        break;

    case TTRUE:
        fprintf(stream, "#t");
        break;

    case TFALSE:
        fprintf(stream, "#f");
        break;

    case TSYMBOL:
        fprintf(stream, "%s", obj->symbol_value);
        break;

    case TSYNTAX:
        fprintf(stream, "#<syntax %s>", obj->syntax_name);
        break;

    case TSUBR:
        fprintf(stream, "#<subr %s>", obj->subr_name);
        break;

    case TLAMBDA:
        fprintf(stream, "#<lambda>");
        break;

    default:
        St_Error("unknown type");
    }
}


void St_Print(Object *obj)
{
    print(stdout, obj);
}
<commit_msg>Flush stream each print<commit_after>#include <stdio.h>

#include "lisp.h"

static void print(FILE *stream, Object *obj)
{
    if (obj == NULL)
    {
        St_Error("print: NULL");
    }

    switch (obj->type)
    {
    case TINT:
        fprintf(stream, "%d", obj->int_value);
        break;

    case TCELL:
        fprintf(stream, "(");

        print(stream, obj->car);

        while (ST_PAIRP(obj->cdr))
        {
            obj = obj->cdr;
            fprintf(stream, " ");
            print(stream, obj->car);
        }

        if (!ST_NULLP(obj->cdr))
        {
            fprintf(stream, " . ");
            print(stream, obj->cdr);
        }

        fprintf(stream, ")");

        break;

    case TNIL:
        fprintf(stream, "()");
        break;

    case TTRUE:
        fprintf(stream, "#t");
        break;

    case TFALSE:
        fprintf(stream, "#f");
        break;

    case TSYMBOL:
        fprintf(stream, "%s", obj->symbol_value);
        break;

    case TSYNTAX:
        fprintf(stream, "#<syntax %s>", obj->syntax_name);
        break;

    case TSUBR:
        fprintf(stream, "#<subr %s>", obj->subr_name);
        break;

    case TLAMBDA:
        fprintf(stream, "#<lambda>");
        break;

    default:
        St_Error("unknown type");
    }

    fflush(stream);
}


void St_Print(Object *obj)
{
    print(stdout, obj);
}

{'fraction_non_alphanumeric': 0.15820674323823639, 'fraction_numerical': 0.0, 'mean_word_length': 1.6946107784431137, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 33, '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': '577087', 'n_tokens_mistral': 925, 'n_tokens_neox': 906, 'n_words': 182}