Rand Stats

Raku::Elements

zef:lizmat

Actions Status Actions Status Actions Status

NAME

Raku::Elements - The Elements of the Raku Programming Language

SYNOPSIS

use Raku::Elements;

DESCRIPTION

The Raku::Elements distribution attempts to provide a programmatical interface to an alternate description of the Raku Programming Language, inspired by the "Periodic Table of the Operators" by Mark Lentczner.

It basically provides an (incomplete) overview of the features of the Raku Programming Language, sorted into groups in a way similar to the "Periodic Table of Elements".

Please note that this is still very much a work in progress: a lot of explanatory texts still need to be added. Pull requests are very welcome!

ELEMENTS

Addenoid Bindoid Buildoid Complementary Declaroid Differentoid Equalish Expansive Feedoid Flippant Hyperoid IOoid Incremental Junctive Mathematicals Metaoid Methodic Multiplicoid Orderoid Quantoid Rangoid Reductoid Replicant Rolific Sequoid Shortoid Stuboid Talkoid Termic Throwoid Timeoid Topicoid

Addenoid

The Addenoid group contains all infix operators that could be considered doing addition or substraction functions.

+ numeric add

- numeric subtract

~ string concatenation

+& integer AND

+| integer OR

+^ integer XOR

~& string AND

~| string OR

~^ string XOR

?& boolean AND

?| boolean OR

?^ boolean XOR

Bindoid

= bind right value in left container

:= bind right value to left lexpad entry

Buildoid

=> Pair constructor, named argument specification

, List constructor

[ ] Array constructor

{ } Hash constructor

:{ } Object Hash constructor

' ' literal string constructor

" " literal string constructor with interpolation

< > literal word list constructor

<< >> literal word list constructor with interpolation

$( ) turn argument(s) into an item

item turn argument(s) into an item

@( ) turn argument(s) into a list

list turn argument(s) into a list

%( ) turn argument(s) into a hash

hash turn argument(s) into a hash

Complementary

+ numerify

+^ numeric complement

- numeric negation

^ numeric from zero upto

~ stringify

? boolify

so low precedence boolify

! boolean negation

not low precedence boolean negation

// is defined

| flatten args, slip iterable

The meaning of prefix | was expanded in 6.c to be beyond the use within signatures, to mean converting any iterable to a Slip (a special type of list that will always be iterated).

atomic integer access

Declaroid

my define something in MY:: scope

our define something in OUR:: scope

anon define something without storing it in a scope

Differentoid

before generic less

< numerically less

lt alphabetically less

<= numerically less or equal

le alphabetically less or equal

!= numeric inequality

ne string inequality

>= numerically more or equal

ge alphabetically more or equal

> numerically more

gt alphabetically more

after generic more

!(elem) is not element in

!(cont) does not contain element

!(<) is not a strict quanthash subset

!(<=) is not a quanthash subset

!(==) quanthash inequality

!(>=) is not a quanthash superset

!(>) is not a strict quanthash superset

Equalish

~~ smart match

eqv canonical equivalence

eq string equality

== numeric equality

=~= numeric almost equal

=== value identity

=:= value identity without decontainerization

(elem) is element in

(cont) contains element

(<) is strict quanthash subset

(<=) is quanthash subset

(==) quanthash equality

(>=) is quanthash superset

(>) is strict quanthash superset

Expansive

i the imaginary unit

integer literal exponentiation

So $a² is the same as $a ** 2, etc. Any of ⁰¹²³⁴⁵⁶⁷⁸⁹⁺¯¯ may be used.

Feedoid

==> feed left to right

<== feed right to left

Flippant

?? !! ternary logic

ff flip-flop inclusive

^ff flip-flop excluding start

ff^ flip-flop excluding end

^ff^ flip-flop exclusive

fff sed-like flip-flop inclusive

^fff sed-like flip-flop excluding start

fff^ sed-like flip-flop excluding end

^fff^ sed-like flip-flop exclusive

Hyperoid

>>op<< produce operator results for equal lists

>>op>> produce operator results, left side leading

<<op<< produce operator results, right side leading

<<op>> produce operator results, longest side leading

[Zop produce operator result, shortest side leading](Default for op is ,)

[Xop produce operator result for combinations](Default for op is ,)

IOoid

get Read a line from $*STDIN / $*ARGFILES

getc Read a character from $*STDIN / $*ARGFILES

read Read bytes from IO::Handle

write Write bytes to IO::Handle

slurp Read entire contents of IO::Path / IO::Handle

spurt Replace content of IO::Path / IO::Handle with argument

Incremental

The atomic versions of -- and ++ were implemented for 6.d. They can only be applied to atomic integers.

++ pre-increment by 1

⚛++ atomic pre-increment by 1

-- pre-decrement by 1

⚛-- atomic pre-decrement by 1

++ post-increment by 1

⚛++ atomic post-increment by 1

-- post-decrement by 1

⚛-- atomic post-decrement by 1

Junctive

& junctive all

| junctive any

^ junctive one

all junctive all

any junctive any

one junctive one

none junctive none

Mathematicals

pi The number π (3.1415...)

tau The number τ (6.2831...)

e Euler's number (2.7182...)

i The imaginary unit (sqrt(-1))

Inf Infinity

Metaoid

op= store result of operator on left/right on left side

Rop produce result of operator with arguments reversed

!op negate result of iffy operator on arguments

Methodic

Dotted postfix operators must be followed by a method name or a subroutine name prefixed with & (possibly fully qualified), a postfix operator, a prefix operator within :<>, or one of the postcircumfixes ( ) [ ] { } < > « ».

.method method call

. method dotty infix method call

.^method meta-method call

.?method call method if any

.*method call all methods if any

.+method call all methods

!method private method call

.=method incovant mutating method call

Multiplicoid

div integer divide

mod integer modulus

gcd greatest common divisor

lcm lowest common multiple

* multiply

/ divide

** exponentiation

% modulus

%% is divisible

+< integer shift left

+> integer shift right

Orderoid

Return an Order enum

cmp equivalence order comparison

<=> numerical order comparison

leg string order comparison

Quantoid

empty Set

(|) quanthash union

(+) quanthash addition

(.) quanthash multiplication

(-) quanthash difference

(^) quanthash symmetric difference

Rangoid

.. range inclusive

^.. range excluding start

..^ range excluding end

^..^ range exclusive

minmax range including min and max value

Reductoid

minmax reduce values to Range of min and max value

min reduce values to smallest value

max reduce values to largest value

[op] reduce using given infix operator

[\op] produce steps of reduction using given infix operator

Replicant

x string repetition

xx item repetition

Rolific

does mutating role mixin

but cloning role mixin

Sequoid

... smart sequence inclusive

^... smart sequence excluding start

...^ smart sequence excluding end

^...^ smart sequence exclusive

Shortoid

&& high precedence logical AND

and low precedence logical AND

|| high precedence logical OR

or low precedence logical OR

^^ high precedence logical XOR

xor low precedence logical XOR

// high precedence is defined OR

notandthen Empty if first defined, else last

Stuboid

??? warn about stub code executed

... fail with stub code executed error

!!! die with stub code executed error

Talkoid

print stringify argument(s), write to $*STDOUT

say create gist of argument(s), add newline, write to $*STDOUT

put stringify argument(s), add newline, write to $*STDOUT

note create gist of argument(s), add newline, write to $*STDERR

Termic

self invocant in method

rand pseudo-random Num in range

Throwoid

die halt execution, or be caught by CATCH

warn show error message, or be caught by CONTROL

fail return from Routine with Failure, or be caught by CATCH

return return from Routine with given value, or be caught by CONTROL

next proceed with next iteration, or be caught by CONTROL

redo restart current iteration, or be caught by CONTROL

last stop iterating, or be caught by CONTROL

proceed continue with next when/default, or be caught by CONTROL

succeed continue after last when/default, or be caught by CONTROL

done call "done" callback on taps, or be caught by CONTROL

emit emit given value to active supply, or be caught by CONTROL

Timeoid

now Instant of current time

time POSIX time in seconds

nano POSIX time in nano seconds

Topicoid

given topicalize argument for scope

when if smartmatched topicalize argument for scope

andthen topicalize left for right thunk

orelse low precedence if defined OR, topicalizing left for right thunk

CLASSES

Raku::Elements

The programmatical interface to the elements of the Raku Programming Language.

elements

A Map with the elements of the Raku Programming Language. The key represents either the name of an Raku::Element, or one of its alternates. The value is a List of one or more Raku::Element objects that share the same name (but may have different tags).

groups

A Map with Raku::Group object, keyed to their name.

Raku::Group

The information about an element group.

name

The name of the element group.

description

The description of the element group (if any)

elements

A list of Raku::Element objects belonging to this group.

Raku::Element

name

The name of the element. This may be non-alphabetic, specifically in the case of operators such as +.

alternates

Alternate names of the element, for instance an Unicode version versus an ASCII version of an operator, such as as al alternate name for (elem). Usually empty.

tags

A list of tags that apply to this element, e.g. infix for an infix operator. Has at least one element.

tagline

The tagline of the element: a one-line description.

url

A URL for more information about this element.

description

A more general description of the element. Optional.

AUTHOR

Elizabeth Mattijsen liz@raku.rocks

Source can be located at: https://github.com/lizmat/Raku-Elements . Comments and Pull Requests are welcome.

If you like this module, or what I’m doing more generally, committing to a small sponsorship would mean a great deal to me!

RESOURCE FILES

This distribution keeps all of the text files as resources, to be read when they are needed (as opposed to keeping them all in the binary).

The resources directory contains a groups directory that contains all of the information for each group in a separat file.

Group file format

The format of the group file is very simple line based.

All entries are separated by an empty line. The first line contains the names of the element separated by the string | (space, pipe, space). There must be at least one name. The first name becomes the name of the element, the others become aliases.

The second line contains theo tags as space separated words. There must be at least a single tag.

The third line contains the tagline of the element.

The fourth line (if not empty) contains the URL for more information,

Any other lines until an empty line, contains the description of the element.

If the first line is empty, then the rest of the file contains the description of the group (so you can recognize the description as the text after the first 2 empty lines). If there are no 2 empty lines, then there is no description for the group.

COPYRIGHT AND LICENSE

Copyright 2025 Elizabeth Mattijsen

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