The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

Name

SPVM::Comparator::Long - Interface Type for long Comparation Callback

Usage

  use Comparator::Long;
  
  my $comparator = (Comparator::Long)method : int ($a : long, $b : long); {
    return $a <=> $b;
  };
  
  my $result = $comparator->(3, 5);

Description

Comparator::Long is the interface type for the long comparation callback.

Interface Methods

required method : int ($a : long, $b : long);

This method must receive two values that types are long and return the following value.

If the first argument is greater than the second argument, returns 1. If the first argument is lower than the second argument, returns -1. If the first argument is equal to the second argument, returns 0.

Copyright & License

Copyright (c) 2023 Yuki Kimoto

MIT License