How to resolve the algorithm Null object step by step in the EchoLisp programming language

Published on 12 May 2024 09:40 PM

How to resolve the algorithm Null object step by step in the EchoLisp programming language

Table of Contents

Problem Statement

Null (or nil) is the computer science concept of an undefined or unbound object. Some languages have an explicit way to access the null object, and some don't. Some languages distinguish the null object from undefined values, and some don't.

Show how to access null in your language by checking to see if an object is equivalent to the null object.

This task is not about whether a variable is defined. The task is about "null"-like values in various languages, which may or may not be related to the defined-ness of variables in your language.

Let's start with the solution:

Step by Step solution about How to resolve the algorithm Null object step by step in the EchoLisp programming language

Source code in the echolisp programming language

null → null
() → null
(null? 3) → #f
(!null? 4) → #t
(null? null) → #t

;; careful - null is not false :
(if null 'OUI 'NON) → OUI

;; usual usage : recursion on lists until (null? list)
(define (f list) 
    (when (!null? list) 
    (write (first list)) (f (rest list))))

(f '( a b c))  →  a b c


  

You may also check:How to resolve the algorithm Peano curve step by step in the Raku programming language
You may also check:How to resolve the algorithm Function definition step by step in the 8051 Assembly programming language
You may also check:How to resolve the algorithm Averages/Simple moving average step by step in the Forth programming language
You may also check:How to resolve the algorithm Hello world/Graphical step by step in the Groovy programming language
You may also check:How to resolve the algorithm Colour bars/Display step by step in the Plain English programming language