<commit_before>## $Id: builtins.pir 12709 2006-05-17 01:42:08Z pmichaud $

=head1 NAME

src/builtins/named-unary.pir - Perl6 named unary builtins

=head1 Functions

=over 4

=cut

.namespace [ '' ]


.sub 'defined'
    .param pmc x
    $I0 = defined x
    .return ($I0)
.end


## math operators
## TODO: someday, these may exist in Math::Basic and / or Num namespaces
## until this is clarified, they exist in the root namespace


.sub 'abs'
    .param pmc a
    $P0 = abs a
    .return ($P0)
.end


.sub 'ceiling'
    .param num a
    ceil a
    .return (a)
.end


.sub 'floor'
    .param num a
    floor a
    .return (a)
.end


## TODO: rand srand


.sub 'round'
    .param num a
    a += 0.5
    $N0 = floor a
    .return (a)
.end


.sub 'sign'
    .param pmc a
    $I0 = cmp_num a, 0
    .return ($I0)
.end


.sub 'sqrt'
    .param num a
    a = sqrt a
    .return (a)
.end


.sub 'truncate'
    .param num a
    eq a, 0, return
    lt a, 0, under
    floor a
    goto return
  under:
    ceil a
  return:
    .return (a)
.end


## trancendental math ops
## TODO: these only work with radians atm

.sub 'atan' :multi(PMC)
    .param num a
    $N0 = atan a
    .return ($N0)
.end


.sub 'atan' :multi(PMC, PMC)
    .param num a
    .param num b
    $N0 = atan a, b
    .return (N0)
.end


.sub 'cos'
    .param num a
    $N0 = cos a
    .return ($N0)
.end


.sub 'sin'
    .param num a
    $N0 = sin a
    .return ($N0)
.end<commit_msg>[perl6]: add a few string ops<commit_after>## $Id: builtins.pir 12709 2006-05-17 01:42:08Z pmichaud $

=head1 NAME

src/builtins/named-unary.pir - Perl6 named unary builtins

=head1 Functions

=over 4

=cut

.namespace [ '' ]


.sub 'defined'
    .param pmc x
    $I0 = defined x
    .return ($I0)
.end


## string operators


.sub 'lc'
    .param string a
    downcase a
    .return (a)
.end


.sub 'uc'
    .param string a
    upcase a
    .return (a)
.end


.sub 'ucfirst'
    .param string a
    titlecase a
    .return (a)
.end


## TODO: lcfirst, capitalize, index, pack, pos, quotemeta, rindex, split
## sprintf, substr, unpack, vec, words


## math operators
## TODO: someday, these may exist in Math::Basic and / or Num namespaces
## until this is clarified, they exist in the root namespace


.sub 'abs'
    .param pmc a
    $P0 = abs a
    .return ($P0)
.end


.sub 'ceiling'
    .param num a
    ceil a
    .return (a)
.end


.sub 'floor'
    .param num a
    floor a
    .return (a)
.end


## TODO: rand srand


.sub 'round'
    .param num a
    a += 0.5
    $N0 = floor a
    .return (a)
.end


.sub 'sign'
    .param pmc a
    $I0 = cmp_num a, 0
    .return ($I0)
.end


.sub 'sqrt'
    .param num a
    a = sqrt a
    .return (a)
.end


.sub 'truncate'
    .param num a
    eq a, 0, return
    lt a, 0, under
    floor a
    goto return
  under:
    ceil a
  return:
    .return (a)
.end


## trancendental math ops
## TODO: these only work with radians atm

.sub 'atan' :multi(_)
    .param num a
    $N0 = atan a
    .return ($N0)
.end


.sub 'atan' :multi(_, _)
    .param num a
    .param num b
    $N0 = atan a, b
    .return (N0)
.end


.sub 'cos'
    .param num a
    $N0 = cos a
    .return ($N0)
.end


.sub 'sin'
    .param num a
    $N0 = sin a
    .return ($N0)
.end
{'fraction_non_alphanumeric': 0.12832405689548546, 'fraction_numerical': 0.026901669758812616, 'mean_word_length': 1.9223125564588979, 'pattern_counts': {'":': 0, '<': 3, '<?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': '7292970', 'n_tokens_mistral': 1402, 'n_tokens_neox': 1304, 'n_words': 467}