From d176bde460c5f9f36d154a4e1f062d9e5f603056 Mon Sep 17 00:00:00 2001 From: Attila Magyar Date: Mon, 21 Jun 2021 22:51:53 +0200 Subject: [PATCH] Update README.md --- README.md | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 255c315..fa6af74 100644 --- a/README.md +++ b/README.md @@ -208,11 +208,29 @@ The quotation code is compiled into the enclosing word and bypassed by a jump. A A list is a dynamic, ordered data structed. -`` \ creates a new empty list +`` \ creates a new empty list` -` dup 1 add` \ creates an empty list and adds *1* to it. +` dup 1 add \ creates an empty list and adds *1* to it.` -`[ 1 2 3 ]` \ creates a list with 3 elements. +`[ 1 2 3 ] \ creates a list with 3 elements.` + +`[ 1 2 3 ] peel \ unloads the items from the list to the data stack` + +`1 2 3 4 5 \ loads all items from the stack into a list` + +`[ 1 2 3 ] 0 at \ returns the first item of the list` + +`[ 1 2 3 ] 0 remove-at \ removes the first item from the list` + +`[ 1 'abc' 3 ] 'abc remove \ removes 'abc' from the list` + +`[ 1 'abc' 3 ] index-of \ returns the index of 'abc'` + +`[ 1 2 ] [ 3 4 ] concat \ creates a new list with the first concatenated to the second` + +`[ 1 2 3 4 ] 1 3 sublst \ gets a sublist from the original from 1 (inclusive) to 3 (exclusive)` + +### Implementation notes Lists are java.util.ArrayList instances and garbage collected automatically by the host language.