Skip to content

Latest commit

 

History

History
110 lines (73 loc) · 1.48 KB

email.adoc

File metadata and controls

110 lines (73 loc) · 1.48 KB

Email! datatype

1. Abstract

Email! values allow for directly expressing email addresses, e.g. foo@bar.net

Email! is a member of the following typesets: any-string!, series!

2. Creation

Email values can be created using literal syntax, or at runtime using a make constructor or a to conversion.

3. Literal syntax

One or more characters, followed by the @ symbol, followed by zero or more additional characters.

Examples

foo@bar.net
gregg@red-lang.org
g@

Invalid characters

% ( ) : "

4. Runtime creation

  • Make

    >> f: make email! "foo"
    == foo
    
    >> type? f
    == email!
  • To

    >> b: to email! 'bar
    == bar
    
    >> type? b
    == email!

5. Path accessors

Path accessors provide a convenient way for getting or setting the user name or host name of an email value.

5.1. /user

>> e: me@me.net
== me@me.net

>> e/user
== "me"

>> e/user: "you"
== "you"

>> e
== you@me.net

5.2. /host

>> e/host
== "me.net"

>> e/host: "red-lang.org"
== "red-lang.org"

>> e
== you@red-lang.org

6. Comparisons

All comparators can be applied on email!: =, ==, <>, >, <, >=, <=, =?. In addition, min, and max are also supported.

7. Testing values

Use email? to check if a value is of the email! datatype.

>> email? foo@bar.net
== true

Use type? to return the datatype of a given value.

>> type? foo@bar.net
== email!

8. Predefined words

8.1. Functions

email?, suffix?, to-email