<commit_before>#|

Implementation of some MacLisp functions.

Copyright (C) 2012 <NAME>
Distributed under the GNU LGPL 2.1; see LICENSE.

|#
(define-library (maclisp)
  (import (scheme base))
  (export
    explode
    exploden
    implode)
  (begin
    (define base 8)

    #|

    Transforms symbol to list of characters.

    Example:
    (explode 'hey) ==> (#\h #\e #\y)

    This function is not completely compatible with MacLisp,
    see http://www.maclisp.info/pitmanual/charac.html#11.3.1

    |#
    (define (explode symbol)
      (map string->symbol
        (map list->string
          (map list
            (string->list
              (symbol->string symbol))))))

    ;; As (explode) but returns numbers.
    ;;
    (define (exploden symbol)
      (map char->integer (string->list (symbol->string symbol))))

    #|

    Concatenates list of symbols to one symbol.

    Examples:
    (implode '(h e y)) ) ==> hey
    (implode (cdr (explode 'hello))) ==> 'ello

    |#
    (define (implode symbols)
      (string->symbol
        (list->string
          (map car
            (map string->list (map symbol->string symbols))))))<commit_msg>Added aset' and using (portable atom)<commit_after>#|

Implementation of *some* MacLisp functions.

They don't behave exactly the same was as in the original MacLisp.

Copyright (C) 2012 <NAME>
Distributed under the GNU LGPL 2.1; see LICENSE.

|#
(define-library (maclisp)
  (import (scheme base)
          (portable atom))
  (export
    aset'
    explode
    exploden
    implode)
  (begin
    (define base 8)

    #|

    Apparently same as set!, but returns the new value.

    |#
    (define-syntax aset'
      (syntax-rules ()
        ((_ a b) (begin
                   (set! a b)
                   a))))

    #|

    Transforms symbol to list of characters.

    Example:
    (explode 'hey) ==> (#\h #\e #\y)

    This function is not completely compatible with MacLisp,
    see http://www.maclisp.info/pitmanual/charac.html#11.3.1

    |#
    (define (explode atom)
      (map string->symbol
        (map list->string
          (map list
            (string->list
              (atom->string atom))))))

    #|

    As (explode) but returns numbers.

    |#
    (define (exploden atom)
      (map char->integer (string->list (atom->string atom))))

    #|

    Concatenates list of symbols to one symbol.

    Examples:
    (implode '(h e y)) ) ==> hey
    (implode (cdr (explode 'hello))) ==> 'ello

    |#
    (define (implode atoms)
      (string->symbol
        (list->string
          (map car
            (map string->list (map atom->string atoms))))))
{'fraction_non_alphanumeric': 0.130451415455241, 'fraction_numerical': 0.008416220351951033, 'mean_word_length': 2.1354916067146283, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 33, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '2814339', 'n_tokens_mistral': 870, 'n_tokens_neox': 822, 'n_words': 254}