From 0d30b293fc01f1449216b2bdee9b0b3c84148bba Mon Sep 17 00:00:00 2001 From: Yuichi Nishiwaki Date: Sun, 15 Jun 2014 01:48:28 +0900 Subject: [PATCH] add dictionary documentation --- docs/lang.rst | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/docs/lang.rst b/docs/lang.rst index 9d6c6786..220addb2 100644 --- a/docs/lang.rst +++ b/docs/lang.rst @@ -55,6 +55,37 @@ Libraries Delimited control operators. +- ``(picrin dictionary)`` + + Symbol to Object table. Internally it is implemented on hash-table. + + Note that dictionary is not a weak map; if you are going to make a highly memory-consuming program with dictionaries, you should know that dictionaries keep their bound objects and never let them free until you explicitly deletes bindings. + + - ``(dictionary)`` + + Returns a newly allocated empty dictionary. In the future, it is planned to extend this function to take optional arguments for initial key/values. + + - ``(dictionary? obj)`` + + Returns ``#t`` if obj is a dictionary. + + - ``(dictionary-ref dict key)`` + + Look up dictionary dict for a value associated with symbol key. If no object is associated with key, it will raise an error. + + - ``(dictionary-set! dict key obj)`` + + If there is no value already associated with key, this function newly creates a binding of key with obj. Otherwise, updates the existing binding with given obj. + + - ``(dictionary-delete dict key)`` + + Deletes the binding associated with key from dict. If no binding on dict is associated with key, an error will be raised. + + + - ``(dictionary-size dict)`` + + Returns the number of registered elements in dict. + - ``(picrin user)`` When you start the REPL, you are dropped into here.