pair

package
v0.8.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 14, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Released under an MIT license. See LICENSE.

Package pair provides oh's cons cell type.

Index

Constants

This section is empty.

Variables

View Source
var (
	// Null is the empty list. It is also used to mark the end of a list.
	Null cell.I
)

Functions

func Caar

func Caar(c cell.I) cell.I

Caar returns the car of the car of the pair c. A non-pair value where a pair is expected will cause a panic.

func Caddr

func Caddr(c cell.I) cell.I

Caddr returns the car of the cdr of the cdr of the pair c. A non-pair value where a pair is expected will cause a panic.

func Cadr

func Cadr(c cell.I) cell.I

Cadr returns the car of the cdr of the pair c. A non-pair value where a pair is expected will cause a panic.

func Car

func Car(c cell.I) cell.I

Car returns the car/head/first member of the pair c. If c is not a pair, this function will panic.

func Cdar

func Cdar(c cell.I) cell.I

Cdar returns the cdr of the car of the pair c. A non-pair value where a pair is expected will cause a panic.

func Cddr

func Cddr(c cell.I) cell.I

Cddr returns the cdr of the cdr of the pair c. A non-pair value where a pair is expected will cause a panic.

func Cdr

func Cdr(c cell.I) cell.I

Cdr returns the cdr/tail/rest member of the pair c. If c is not a pair, this function will panic.

func Cons

func Cons(h, t cell.I) cell.I

Cons conses h and t together to form a new pair.

func Is

func Is(c cell.I) bool

Is returns true if c is a *T.

func SetCar

func SetCar(c, value cell.I)

SetCar sets the car/head/first of the pair c to value. If c is not a pair, this function will panic.

func SetCdr

func SetCdr(c, value cell.I)

SetCdr sets the cdr/tail/rest of the pair c to value. If c is not a pair, this function will panic.

Types

type T

type T struct {
	// contains filtered or unexported fields
}

T (pair) is a cons cell.

func To

func To(c cell.I) *T

To returns a *T if c is a *T; Otherwise it panics.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL