From 9224412274e1e1a31a959083bb257a7d6ab2b113 Mon Sep 17 00:00:00 2001 From: David Thompson Date: Fri, 19 Aug 2016 20:40:12 -0400 Subject: Add Sly manual. --- manuals/sly/Miscellaneous_002dUtilities.html | 147 +++++++++++++++++++++++++++ 1 file changed, 147 insertions(+) create mode 100644 manuals/sly/Miscellaneous_002dUtilities.html (limited to 'manuals/sly/Miscellaneous_002dUtilities.html') diff --git a/manuals/sly/Miscellaneous_002dUtilities.html b/manuals/sly/Miscellaneous_002dUtilities.html new file mode 100644 index 0000000..7d160f4 --- /dev/null +++ b/manuals/sly/Miscellaneous_002dUtilities.html @@ -0,0 +1,147 @@ + + + + + +Sly: Miscellaneous-Utilities + + + + + + + + + + + + + + + + + + + + +
+

+Previous: , Up: Utilities   [Contents][Index]

+
+
+ +

4.6.3 Miscellaneous

+ +
+
(use-modules (sly utils))
+
+ +

Miscellaneous helpful procedures. +

+
+
Scheme Syntax: define-guardian name reaper
+

Define a new guardian called name and call reaper when +an object within the guardian is GC’d. Reaping is ensured to happen +from the same thread that is running the game loop. +

+ +
+
Scheme Procedure: memoize proc
+

Return a memoizing version of proc. +

+ +
+
Scheme Syntax: forever body
+

Evaluate body in an unbounded loop. Useful in coroutines that +have no end. +

+ +
+
Scheme Syntax: trampoline proc-name
+

Create a new procedure that applies the procedure bound to +proc-name with all given arguments. +

+ +
+
Scheme Syntax: chain* args (proc …) . rest
+

Handy macro for flattening nested procedure calls where the output of +an inner call is the last argument to the outer call. +

+
+
(chain* (list '(1 2) '(3 4))
+  (map +)
+  (fold + 0)) ;; => 10
+
+ +
+ +
+
Scheme Syntax: chain arg (proc …) . rest
+

Like chain* but for a single argument. +

+
+
(chain '(1 2 3 4)
+  (map 1+)
+  (fold + 0)) ;; => 14
+
+ +
+ +
+
Scheme Procedure: list->vlist* lst
+

Convert lst and all sub-lists within to vlists. +

+ +
+
Scheme Procedure: list->vlist* lst index […]
+

Return the element at index index … in the nested vlist +structure vlist. +

+ + + + + + -- cgit v1.2.3