fez-lisp 1.6.27 → 1.6.30

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -28,8 +28,17 @@
28
28
 
29
29
  ```lisp
30
30
  ; Lisp programming language. It's not exactly like other Lisps.
31
+ ; This is a CUSTOM lisp language that does not fully follow the general Lisp conventions
32
+
33
+ ; Plase strictly follow the language rules as described in this document
34
+
31
35
  ; Everything is an expression.
32
36
 
37
+ ; Build-in keywords
38
+ (/ ...) (+ ...) (* ...) (- ...) (= ...) (< ...) (> ...) (>= ...) (<= ...) (& ...) (~ ...) (| ...) (^ ...) (<< ...) (>> ...)
39
+ (mod ...) (let ...) (if ...) (not ...) (and ...) (or ...) (atom? ...) (lambda? ...)
40
+ (length ...) (do ...) (array ...) (set! ...) (pop! ...) (get ...) (lambda ...) (apply ...)
41
+
33
42
  ; Important Note:
34
43
  ; In this programming language, parentheses are used to group expressions and define the structure of code.
35
44
  ; It is essential to keep the number of opening and closing parentheses balanced.
@@ -83,7 +92,7 @@
83
92
  (array:push! xs (length xs) 10) ; add the value 10 at the end of array xs
84
93
  (array:get xs 0) ; get the first element of array xs
85
94
 
86
- ; Note: array:set! and array:pop! are functions that update arrays (array:set! xs idx value, array:pop! xs).
95
+ ; Note: set! and pop! are functions that update arrays (set! xs idx value, pop! xs).
87
96
  ; If you want to update variables (scalars), use the variable helpers: var:def to define, var:set! to update, and var:get to retrieve the value.
88
97
 
89
98
  ; Mathematical operations
@@ -164,7 +173,7 @@
164
173
  ; IMPORTANT: Variable Handling and set! Usage
165
174
  ; ===========================================
166
175
  ;
167
- ; array:set! is ONLY for arrays - it cannot be used to update scalar variables.
176
+ ; set! is ONLY for arrays - it cannot be used to update scalar variables.
168
177
  ; If you want to update variables (scalars), use the appropriate variable helper functions.
169
178
  ;
170
179
  ; There are three types of variable systems in this language:
@@ -226,8 +235,8 @@
226
235
  xs)))
227
236
  (let arr:merge (lambda a b (do
228
237
  (let out (array)) initialize an empty array for output
229
- (arr:for a (lambda x (do (array:set! out (length out) x))))
230
- (arr:for b (lambda x (do (array:set! out (length out) x)))) out)))
238
+ (arr:for a (lambda x (do (set! out (length out) x))))
239
+ (arr:for b (lambda x (do (set! out (length out) x)))) out)))
231
240
  (let arr:reverse (lambda xs (do
232
241
  (let tail-call:arr:reverse (lambda i out (do
233
242
  (if (> (length xs) i)
@@ -256,4 +265,24 @@
256
265
  ; pipe operator with destructuring
257
266
 
258
267
  "Hello World!" ; syntactic suggar for string but it's array of character codes
268
+
269
+ ; syntactic suggar for variables
270
+
271
+ (let xs [])
272
+ (variable i 0) ; define number variables
273
+ (get i) ; getting nubmer variable
274
+ (loop (< (get i) 10) (do
275
+ (array:push! xs (get i))
276
+ (++ i) ; increment number variaable
277
+ ))
278
+
279
+ (boolean x false) ; define boolean variable as false
280
+ (boolean y true) ; define boolean variable as true
281
+ (boole-set x true) ; set boolean variable
282
+ (and (boole:true? x) (boole:true? y)) ; check if boolean variable is true (this is using boole:* from std)
283
+ (variable n 10) ; define number variable
284
+ (++ n) ; increment number variable by 1
285
+ (+= n 10) ; increment number variable by 10
286
+ (get n) ; get number variable
287
+
259
288
  ```