Reference

val

struct scm::val

C++ representation of a Scheme value.

Like Scheme values, this type has reference semantics. Copying a scm::val just copies a pointer or handle to the underlying Scheme object, thus just creating a new alias. Mutations to the referenced Scheme object are visible through all the aliases.

Public Types

using base_t = detail::wrapper

Public Functions

template <typename T, typename = std::enable_if_t< (!std::is_same<std::decay_t<T>, val>{} && !std::is_same<std::decay_t<T>, SCM>{})>>
val(T &&x)

Implicit conversion from a C++ type to a Scheme value.

The C++ object is always copied.

template <typename T, typename = std::enable_if_t< std::is_same<T, decltype(detail::to_cpp<T>(SCM{}))>{}>>
operator T() const

Implicit conversion from a Scheme value to a C++ type.

If the type is a custom type, the conversion may just return a reference to the underlying C++ object.

template <typename T, typename = std::enable_if_t< std::is_same<T&, decltype(detail::to_cpp<T>(SCM{}))>{}>>
operator T&() const
template <typename T, typename = std::enable_if_t< std::is_same<const T&, decltype(detail::to_cpp<T>(SCM{}))>{}>>
operator const T&() const
val operator()() const

Function call operator.

If value holds a Scheme procedure, calls the Scheme procedure with the given arguments. They arguments may be implicitly converted from C++.

val operator()(val a0) const
val operator()(val a0, val a1) const
val operator()(val a0, val a1, val a2) const
val operator()(val a0, val a1, val a2, val a3) const
val operator()(val a0, val a1, val a2, val a3, val a4) const
val operator()(val a0, val a1, val a2, val a3, val a4, val a5) const
val operator()(val a0, val a1, val a2, val a3, val a4, val a5, val a6) const
val operator()(val a0, val a1, val a2, val a3, val a4, val a5, val a6, val a7) const
val operator()(val a0, val a1, val a2, val a3, val a4, val a5, val a6, val a7, val a8) const
template <typename… T, typename = std::enable_if_t<(sizeof…(T) > 9>
val operator()(T… arg) const

list

struct scm::list

C++ representation of a Scheme list.

Like Scheme values, this type has reference semantics. Copying a scm::list just copies a pointer or handle to the underlying Scheme list, thus just creating a new alias. Mutations to the referenced Scheme list are visible through all the aliases.

Subclassed by scm::args

Public Types

using base_t = detail::wrapper
using iterator = list
using value_type = val

Public Functions

list()
list end() const
list begin() const
operator bool()
val operator*() const
list &operator++()
list operator++(int)
struct scm::args

C++ representation of a Scheme list that when used at the end of a function, will capture the rest arguments.

Inherits from scm::list

Public Functions

list()

group

template <typename Tag = void>
detail::definer<Tag> scm::group()

Returns a scm::detail::definer that can be used to add definitions to the current module.

template <typename Tag = void>
detail::group_definer<Tag> scm::group(std::string group_name)

Returns a named scm::detail::group_definer that can be used to add definitions to the current module.

template <typename Tag, int Seq = 0>
struct scm::detail::definer

Public Functions

template <typename Fn>
next_t define(std::string name, Fn fn) &&

Defines a Scheme procedure (name ...) that returns the result of invoking fn(...).

template <typename Tag, int Seq = 0>
struct scm::detail::group_definer

Public Functions

template <typename Fn>
next_t define(std::string name, Fn fn) &&

Defines a Scheme procedure ([group-name]-name ...) that returns the result of invoking fn(...).

type

template <typename T, typename Tag = T>
detail::type_definer<Tag, T> scm::type(std::string type_name)

Returns a new scm::detail::type_definer that registers a type T with the given type_name and can be used to add related definitions to the current module.

template <typename Tag, typename T, int Seq = 0>
struct scm::detail::type_definer

Public Functions

next_t constructor() &&

Define a Scheme procedure ([type-name]) that returns a Scheme value holding a default constructed T instance.

template <typename Fn>
next_t constructor(Fn fn) &&

Define a Scheme procedure ([type-name] ...) that returns a Scheme value holding the result of invoking fn(args...).

next_t maker() &&

Define a Scheme procedure (make-[type-name]) that returns a Scheme value holding a default constructed T instance.

template <typename Fn>
next_t maker(Fn fn) &&

Define a Scheme procedure (make-[type-name] ...) that returns the result of invoking fn(...).

next_t finalizer() &&

Set the finalizer for Scheme wrapped values of T to invoke the destructor of T on the wrapped value.

template <typename Fn>
next_t finalizer(Fn fn) &&

Set the finalizer of T to invoke fn(*this).

template <typename Fn>
next_t define(std::string name, Fn fn) &&

Define a Scheme procedure ([type-name]-[name] ...) that returns the result of invoking fn(...).