2017-08-27

(sph module)

guile module system or r6rs-library related procedures

part of sph-lib

bindings

library description

# syntax

module-compose :: dest source ...

define a new module dest with all exported bindings of the specified sources.

example: (module-compose (my-module) (rnrs base) (rnrs sorting))

import name

(sph module)

exports

environment*

procedure

signature

name ... ->

(symbol ...) ... -> environment/module

description

similar to "environment" from (rnrs eval).

this can be used to load modules that use syntax to create their module definition.

the modules contents are first evaluated in the top-level environment - before the environment object is created.

the syntax used for creating the module definition must be available in the current top-level environment.

only the ".scm" filename-extension is supported when resolving file paths from module names for loading

import-unexported

syntax

signature

module-name binding-name

load-with-environment

procedure

signature

path env ->

string module ->

description

load filename and evaluate its contents with the given eval environment which may be a module, a r6rs library or a environment

module-compose

syntax

signature

dest-name r6rs-import-spec ...

module-current-bindings

syntax

module-dependencies

procedure

signature

module ->

module -> (module ...)

module-exports

procedure

signature

module ->

module -> (symbol ...)

description

list of exported binding names

module-file->name

procedure

signature

a ->

string -> (symbol ...)/false

description

read file at the given path and, check the first expression for an r6rs or r7rs library definition

and extract the module name

module-file?

procedure

signature

path ->

string -> boolean

description

true if file contains as the first expression an r6rs or r7rs library definition

module-find

procedure

signature

path #:max-depth #:load-path #:guile-modules #:ignore-content #:file-content-match #:ignore-load-path #:enter? ->

string module-find-one-arguments ... -> ((module-name . path) ...)

description

get all names for modules under or at path using module-find-one

module-find-by-name

procedure

signature

name search-type load-paths ->

(symbol ...) symbol:exact/prefix/prefix-not-exact (string ...) -> ((symbol ...):module-name ...)

description

find module names by module name part

module-find-one

procedure

signature

path #:load-path #:ignore-content #:ignore-load-path #:guile-modules #:file-content-match ->

string [#:load-path (string ...) #:guile-modules boolean #:ignore-content boolean] -> false/(symbol ...):module-name

description

setting the right load-path is important because the module name is derived from it.

a file is considered a valid module if:

it exists and is a regular file

the file name extension is ".scm"

the file contains as the first expression an r6rs library or r7rs define-library form

if "guile-modules" is true: the file contains a define-module form

it is in a load path and the module name matches the path under a load path (using %load-paths)

module-fold

procedure

signature

proc init module ->

description

procedure:{name any:value any:init} any (symbol ...) -> any

fold over the exported, bound variables for the given module-name

module-match-guile-definition

procedure

signature

a ->

any -> false/list:module-name

description

matches a guile "define-module" form and returns the module name

module-match-rnrs-definition

procedure

signature

a ->

any -> false/list:module-name

description

matches a r6rs or r7rs library definition and returns the module name

module-name->load-path-and-path

procedure

signature

a filename-extension load-path c ->

(symbol ...) string (string ...) procedure:{string:load-path string:full-path -> any} -> any

description

finds the load path under which a possibly partial (prefix) module name is saved.

if no filename-extension is given it will usually only match directories

module-re-export-modules

syntax

signature

r6rs-import-spec ...

path->load-path

procedure

signature

path [load-path] ->

string -> false/path

description

returns the first found load-path where path can be found.

works for full and relative paths

sph-module-description

variable

symbol-list->path

procedure

signature

a [filename-extension] ->

(symbol ...) string -> string

description

creates a filesystem path string from a module name. module existence is not checked.

filename-extension can be false so that for example directory paths can be created


tags: programming guile documentation library scheme sph-lib environment