Elements

NAME

Chemistry::Elements - do things with the Periodic Table

SYNOPSIS


use Chemistry::Elements;

put "Name for 37 is ", get_name_by_Z( 37 );
put "Name for Rb is ", get_name_by_symbol( 'Rb' );

put "Symbol for 37 is ", get_symbol_by_Z( 37 );
put "Symbol for Rubidium is ", get_symbol_by_name( 'Rubidium' );
put "Symbol for Rubidium is ", get_symbol_by_name( 'Rubidium',  );

put "Atomic number for Rb is ", get_Z_by_symbol( 'Rb' );
put "Atomic number for Rubidium", get_Z_by_name( 'Rubidium' );

# use a German name
put "Atomic number for Rubidium is ", get_symbol_by_name( 'Schwefel', 'de'  );

# Use some types

my ZInt $Z    = 37; # works
my ZInt $BigZ = 138; # nope, because that's not on the chart (yet)
my $minimum = min_Z(); # Always 1, unless something big changes
my $maximum = max_Z(); # More

my ChemicalSymbol $symbol       = 'Rb'; # okay
my ChemicalSymbol $other_symbol = 'X9'; # not okay, not a known symbol

DESCRIPTION

The Perl version of Chemistry::Elements was my first module, so I'm making it my first Raku module too. It's not complicated.

The module maps between element names (_e.g._ Rubidium), symbol (_e.g._ Ru ), and number (_e.g._ 37). It's multi-language aware although the language switching isn't sophisticated yet.

TO DO

  • Integrate the other languages in the directory.

  • Guess the langauge based on a name or symbol

  • Allow historical symbols that aren't

SEE ALSO

SOURCE AVAILABILITY

This module is in Github:

https://github.com/raku-community-modules/Chemistry-Elements

AUTHORS

  • brian d foy

  • Raku Community

COPYRIGHT AND LICENSE

Copyright Β© 2016-2022, brian d foy <[email protected]>. All rights reserved.

Copyright Β© 2024 Raku Community

This program is free software; you can redistribute it and/or modify it under the Artistic License 2.0.

Chemistry::Elements v0.2

do things with the Periodic Table

Authors

  • brian d foy
  • Raku Community

License

Artistic-2.0

Dependencies

Test Dependencies

Provides

  • Chemistry::Elements

Documentation

The Camelia image is copyright 2009 by Larry Wall. "Raku" is trademark of the Yet Another Society. All rights reserved.