From 5b50d423fa3decf8fdfa24ad34a4bdceb9cad3a5 Mon Sep 17 00:00:00 2001 From: Jacob Signorovitch Date: Mon, 14 Apr 2025 09:07:28 -0400 Subject: [PATCH] Updated README for new scoping system. --- README.md | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index a9207c0..05f61f8 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,8 @@ SCL aims to be a human-friendly Computer Algebra System (CAS) inspired by [maxima](https://maxima.sourceforge.io/) that feels like writing on paper. In its current state, SCL can be used as a basic 4-function calculator with order of operations and local variables. The codebase is about 1,400 lines of C, -including a parser, interpreter, and runtime. +including a parser, interpreter, and runtime. It uses a linked environment +scoping model. ## Usage @@ -47,6 +48,23 @@ You can also define your own functions and variables: = 6 ``` +As SCL uses a linked environment model for scope, arguments are passed by +reference by default. If you would like to pass by value (i.e., a copy) you may +use the syntax: + +```scl +> f(x) = x = 1 +> n = 4 +> f($n) # Pass a copy of n. += 1 +> n += 4 +> f(n) # Pass a reference to n. += 1 +> n +> 1 +``` + Symbolic algebra is done in the following manner: ```scl