This site is a static rendering of the Trac instance that was used by R7RS-WG1 for its work on R7RS-small (PDF), which was ratified in 2013. For more information, see Home.

Source for wiki CyclesMedernach version 3

author

medernac

comment

typo

ipnr

88.177.167.25

name

CyclesMedernach

readonly

0

text

== Cycle type ==

The idea is to make a cycle type disjoint from the other types, only interface is standardized. Scheme implementations are free to use any underlying structure to achieve it.

=== Constructor and type conversion === 

`(make-cycle `''list''`)`

`(cycle->list `''cycle''`)`

=== Predicate ===

`(cycle? `''obj''`)`

''cycle?'' returns #t if obj is a cycle, and otherwise returns #f.

=== Associated procedures ===

`(cycle-length `''cycle''`)`

`(cycle-front `''cycle''`)`

Returns the element in front of the given cycle.

`(cycle-remove-front `''cycle''`)`

''cycle-remove-front'' returns a newly allocated cycle obtained from ''cycle'' where the front element has been removed.

`(cycle-rotate `''cycle''` `''k''`)`

''cycle-rotate'' returns a cycle obtained from ''cycle'' by a rotation of ''k'', which is an integer.

`(cycle-insert `''cycle''` `''obj''`)`

Returns a newly allocated cycle where ''obj'' is put in front in ''cycle''.

`(cycle-map `''proc''` `''cycle1''` `''cycle2''` ...)`

All cycles must have the same length and ''proc'' must be a procedure taking as many arguments as there are cycles in parameter and returning a single value. ''cycle-map'' applies ''proc'' to the elements of the cycle(s) and returns a newly allocated cycle of the corresponding result.

=== External representations ===

The cycle composed of elements 1, 2 and 3 with 1 in front can be written as following:

  #cycle(1 2 3)

time

2010-10-01 22:39:03

version

3