Data commit

This commit is contained in:
Ingy döt Net 2023-07-01 11:58:00 -04:00
parent 7387c8f97b
commit cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions

View file

@ -0,0 +1,5 @@
---
category:
- Simple
from: http://rosettacode.org/wiki/Null_object
note: Basic language learning

View file

@ -0,0 +1,12 @@
'''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.
;Task:
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.''
<br><br>

View file

@ -0,0 +1,8 @@
F f([Int]? &a)
I a != N
a.append(1)
f(N)
[Int] arr
f(&arr)
print(arr)

View file

@ -0,0 +1,8 @@
lda pointer ;a zero-page address that holds the low byte of a pointer variable.
CMP #$FF
BNE .continue
lda pointer+1
CMP #$FF
BNE .continue
RTS ;return without doing anything
.continue

View file

@ -0,0 +1 @@
null? if "item was null" . then

View file

@ -0,0 +1,46 @@
/* ARM assembly AARCH64 Raspberry PI 3B */
/* program nullobj64.s */
/*******************************************/
/* Constantes file */
/*******************************************/
/* for this file see task include a file in language AArch64 assembly*/
.include "../includeConstantesARM64.inc"
/*******************************************/
/* Initialized data */
/*******************************************/
.data
szCarriageReturn: .asciz "\n"
szMessResult: .asciz "Value is null.\n" // message result
qPtrObjet: .quad 0 // objet pointer
/*******************************************/
/* UnInitialized data */
/*******************************************/
.bss
/*******************************************/
/* code section */
/*******************************************/
.text
.global main
main: // entry of program
ldr x0,qAdrqPtrObjet // load pointer address
ldr x0,[x0] // load pointer value
cbnz x0,100f // is null ?
ldr x0,qAdrszMessResult // yes -> display message
bl affichageMess
100: // standard end of the program
mov x0,0 // return code
mov x8,EXIT // request to exit program
svc 0 // perform the system call
qAdrszMessResult: .quad szMessResult
qAdrszCarriageReturn: .quad szCarriageReturn
qAdrqPtrObjet: .quad qPtrObjet
/********************************************************/
/* File Include fonctions */
/********************************************************/
/* for this file see task include a file in language AArch64 assembly */
.include "../includeARM64.inc"

View file

@ -0,0 +1,19 @@
REF STRING no result = NIL;
STRING result := "";
IF no result :=: NIL THEN print(("no result :=: NIL", new line)) FI;
IF result :/=: NIL THEN print(("result :/=: NIL", new line)) FI;
IF no result IS NIL THEN print(("no result IS NIL", new line)) FI;
IF result ISNT NIL THEN print(("result ISNT NIL", new line)) FI;
COMMENT using the UNESCO/IFIP/WG2.1 ALGOL 68 character set
result := °;
IF REF STRING(result) :≠: ° THEN print(("result ≠ °", new line)) FI;
END COMMENT
# Note the following gotcha: #
REF STRING var := NIL;
IF var ISNT NIL THEN print(("The address of var ISNT NIL",new line)) FI;
IF var IS REF STRING(NIL) THEN print(("The address of var IS REF STRING(NIL)",new line)) FI

View file

@ -0,0 +1,10 @@
begin
% declare a record type - will be accessed via references %
record R( integer f1, f2, f3 );
% declare a reference to a R instance %
reference(R) refR;
% assign null to the reference %
refR := null;
% test for a null reference - will write "refR is null" %
if refR = null then write( "refR is null" ) else write( "not null" );
end.

View file

@ -0,0 +1,8 @@
⍝⍝ GNU APL
]help
niladic function: Z (Zilde)
Zilde is the empty numeric vector (aka. 0)
Not a function but rather an alias for the empty
vector:
0
1

View file

@ -0,0 +1,60 @@
/* ARM assembly Raspberry PI */
/* program nullobj.s */
/* Constantes */
.equ STDIN, 0 @ Linux input console
.equ STDOUT, 1 @ Linux output console
.equ EXIT, 1 @ Linux syscall
.equ READ, 3 @ Linux syscall
.equ WRITE, 4 @ Linux syscall
/* Initialized data */
.data
szCarriageReturn: .asciz "\n"
szMessResult: .asciz "Value is null.\n" @ message result
iPtrObjet: .int 0 @ objet pointer
/* UnInitialized data */
.bss
/* code section */
.text
.global main
main: @ entry of program
ldr r0,iAdriPtrObjet @ load pointer address
ldr r0,[r0] @ load pointer value
cmp r0,#0 @ is null ?
ldreq r0,iAdrszMessResult @ yes -> display message
bleq affichageMess
100: @ standard end of the program
mov r0, #0 @ return code
pop {fp,lr} @ restaur 2 registers
mov r7, #EXIT @ request to exit program
svc 0 @ perform the system call
iAdrszMessResult: .int szMessResult
iAdrszCarriageReturn: .int szCarriageReturn
iAdriPtrObjet: .int iPtrObjet
/******************************************************************/
/* display text with size calculation */
/******************************************************************/
/* r0 contains the address of the message */
affichageMess:
push {r0,r1,r2,r7,lr} @ save registres
mov r2,#0 @ counter length
1: @ loop length calculation
ldrb r1,[r0,r2] @ read octet start position + index
cmp r1,#0 @ if 0 its over
addne r2,r2,#1 @ else add 1 in the length
bne 1b @ and loop
@ so here r2 contains the length of the message
mov r1,r0 @ address message in r1
mov r0,#STDOUT @ code to write to the standard output Linux
mov r7, #WRITE @ code call system "write"
svc #0 @ call systeme
pop {r0,r1,r2,r7,lr} @ restaur des 2 registres */
bx lr @ return

View file

@ -0,0 +1,7 @@
#!/usr/bin/awk -f
BEGIN {
b=0;
print "<"b,length(b)">"
print "<"u,length(u)">"
print "<"u+0,length(u+0)">";
}

View file

@ -0,0 +1,20 @@
TYPE Object=[
BYTE byteData
INT intData
CARD cardData]
PROC IsNull(Object POINTER ptr)
IF ptr=0 THEN
PrintE("Object is null")
ELSE
PrintE("Object is not null")
FI
RETURN
PROC Main()
Object a
Object POINTER ptr1=a,ptr2=0
IsNull(ptr1)
IsNull(ptr2)
RETURN

View file

@ -0,0 +1,2 @@
if (object == null)
trace("object is null");

View file

@ -0,0 +1,5 @@
with Ada.Text_Io;
if Object = null then
Ada.Text_Io.Put_line("object is null");
end if;

View file

@ -0,0 +1,5 @@
DEF x : PTR TO object
-> ...
IF object <> NIL
-> ...
ENDIF

View file

@ -0,0 +1,7 @@
if x is missing value then
display dialog "x is missing value"
end if
if x is null then
display dialog "x is null"
end if

View file

@ -0,0 +1,5 @@
TRUE = 1 : FALSE = 0
NULL = TRUE
IF NULL THEN PRINT "NULL"
NULL = FALSE
IF NOT NULL THEN PRINT "NOT NULL"

View file

@ -0,0 +1,3 @@
v: null
if v=null -> print "got NULL!"

View file

@ -0,0 +1,2 @@
If (object == null)
MsgBox, object is null

View file

@ -0,0 +1,2 @@
Local $object = Null
If $object = Null Then MsgBox(0, "NULL", "Object is null")

View file

@ -0,0 +1,3 @@
If P=0
Disp "NULL PTR",i
End

View file

@ -0,0 +1,13 @@
PROCtestobjects
END
DEF PROCtestobjects
PRIVATE a(), b(), s{}, t{}
DIM a(123)
DIM s{a%, b#, c$}
IF !^a() <= 1 PRINT "a() is null" ELSE PRINT "a() is not null"
IF !^b() <= 1 PRINT "b() is null" ELSE PRINT "b() is not null"
IF !^s{} <= 1 PRINT "s{} is null" ELSE PRINT "s{} is not null"
IF !^t{} <= 1 PRINT "t{} is null" ELSE PRINT "t{} is not null"
ENDPROC

View file

@ -0,0 +1 @@
{ nil { nil? } { "Whew!\n" } { "Something is terribly wrong!\n" } ifte << }

View file

@ -0,0 +1,3 @@
a:?x*a*?z {assigns 1 to x and to z}
a:?x+a+?z {assigns 0 to x and to z}
a:?x a ?z {assigns "" (or (), which is equivalent) to x and to z}

View file

@ -0,0 +1,5 @@
#include <iostream>
#include <cstdlib>
if (object == 0) {
std::cout << "object is null";
}

View file

@ -0,0 +1,12 @@
#include <iostream>
#include <optional>
std::optional<int> maybeInt()
int main()
{
std::optional<int> maybe = maybeInt();
if(!maybe)
std::cout << "object is null\n";
}

View file

@ -0,0 +1,9 @@
int *p = nullptr;
...
if (p == nullptr){
// do some thing
}
//or just
if (p){
// do some thing
}

View file

@ -0,0 +1,2 @@
if (foo == null)
Console.WriteLine("foo is null");

View file

@ -0,0 +1,2 @@
int? x = 12;
x = null;

View file

@ -0,0 +1,8 @@
Console.WriteLine(name ?? "Name not specified");
//Without the null coalescing operator, this would instead be written as:
//if(name == null){
// Console.WriteLine("Name not specified");
//}else{
// Console.WriteLine(name);
//}

View file

@ -0,0 +1,11 @@
#include <stdio.h>
int main()
{
char *object = 0;
if (object == NULL) {
puts("object is null");
}
return 0;
}

View file

@ -0,0 +1,43 @@
identification division.
program-id. null-objects.
remarks. test with cobc -x -j null-objects.cob
data division.
working-storage section.
01 thing-not-thing usage pointer.
*> call a subprogram
*> with one null pointer
*> an omitted parameter
*> and expect void return (callee returning omitted)
*> and do not touch default return-code (returning nothing)
procedure division.
call "test-null" using thing-not-thing omitted returning nothing
goback.
end program null-objects.
*> Test for pointer to null (still a real thing that takes space)
*> and an omitted parameter, (call frame has placeholder)
*> and finally, return void, (omitted)
identification division.
program-id. test-null.
data division.
linkage section.
01 thing-one usage pointer.
01 thing-two pic x.
procedure division using
thing-one
optional thing-two
returning omitted.
if thing-one equal null then
display "thing-one pointer to null" upon syserr
end-if
if thing-two omitted then
display "no thing-two was passed" upon syserr
end-if
goback.
end program test-null.

View file

@ -0,0 +1,3 @@
class C { };
var c:C; // is nil
writeln(if c == nil then "nil" else "something");

View file

@ -0,0 +1,2 @@
(let [x nil]
(println "Object is" (if (nil? x) "nil" "not nil")))

View file

@ -0,0 +1 @@
(find (ns-interns *ns*) 'foo)

View file

@ -0,0 +1 @@
(ns-unmap *ns* 'foo)

View file

@ -0,0 +1 @@
(if (condition) (do-this))

View file

@ -0,0 +1,5 @@
(defmethod car* ((arg cons))
(car arg))
(defmethod car* ((arg null))
nil)

View file

@ -0,0 +1,2 @@
(defmethod car* ((arg t)) ;; can just be written (defmethod car* (arg) ...)
(error "CAR*: ~s is neither a cons nor nil" arg))

View file

@ -0,0 +1,17 @@
MODULE ObjectNil;
IMPORT StdLog;
TYPE
Object = POINTER TO ObjectDesc;
ObjectDesc = RECORD
END;
VAR
x: Object; (* default initialization to NIL *)
PROCEDURE DoIt*;
BEGIN
IF x = NIL THEN
StdLog.String("x is NIL");StdLog.Ln
END
END DoIt;
END ObjectNil.

View file

@ -0,0 +1,14 @@
foo : Int32 | Nil = 5 # this variable's type can be Int32 or Nil
bar : Int32? = nil # equivalent type to above, but shorter syntax
baz : Int32 = 5 # this variable can never be nil
foo.not_nil! # nothing happens, since 5 is not nil
puts "Is foo nil? #{foo.nil?}"
foo = nil
puts "Now is foo nil? #{foo.nil?}"
puts "Does bar equal nil? #{bar == nil}"
puts "Is bar equivalent to nil? #{bar === nil}"
bar.not_nil! # bar is nil, so an exception is thrown

View file

@ -0,0 +1,12 @@
import std.stdio;
class K {}
void main() {
K k;
if (k is null)
writeln("k is null");
k = new K;
if (k !is null)
writeln("Now k is not null");
}

View file

@ -0,0 +1,6 @@
// the following are equivalent
if lObject = nil then
...
if not Assigned(lObject) then
...

View file

@ -0,0 +1,4 @@
var x = nil
if x == nil {
//Do something
}

View file

@ -0,0 +1 @@
object == null

View file

@ -0,0 +1,13 @@
^|
| EMal has the Variable type (and its keyword var) that is the nullable universal supertype.
| EMal has the Void type (and its keyword void) that holds only one value: null.
| EMal has not nullable types (logic, int, real, text, blob), but null equality is always allowed.
|^
var a # defaults to null
int b # defaults to 0
void c # only one allowed value: null
writeLine("nullable var equals to not nullable int: " + (a == b)) # allowed, false
^| if the data type of a is void we are sure that a is null |^
writeLine("type of a equals to Void data type: " + (generic!a == void)) # true
writeLine("integer value " + b + " equals to null: " + (b == null)) # allowed, always false
writeLine("a void value equals to null: " + (c == null)) # always true

View file

@ -0,0 +1,15 @@
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

View file

@ -0,0 +1,25 @@
module NullObject {
void run() {
@Inject Console console;
console.print($"Null value={Null}, Null.toString()={Null.toString()}");
// String s = Null; // <-- compiler error: cannot assign Null to a String type
String? s = Null; // "String?" is shorthand for the union "Nullable|String"
String s2 = "test";
console.print($"{s=}, {s2=}, {s==s2=}");
// Int len = s.size; // <-- compiler error: String? does not have a "size" property
Int len = s?.size : 0;
console.print($"{len=}");
if (String test ?= s) {
// "s" is still Null in this test, we never get here
} else {
s = "a non-null value";
}
// if (String test ?= s){} // <-- compiler error: The expression type is not nullable
s2 = s; // at this point, s is known to be a non-null String
console.print($"{s=}, {s2=}, {s==s2=}");
}
}

View file

@ -0,0 +1,22 @@
class
APPLICATION
inherit
ARGUMENTS
create
make
feature {NONE} -- Initialization
make
local
i: INTEGER
s: detachable STRING
do
if i = Void then
print("i = Void")
end
if s = Void then
print("s = Void")
end
end
end

View file

@ -0,0 +1,4 @@
iex(1)> nil == :nil
true
iex(2)> is_nil(nil)
true

View file

@ -0,0 +1,2 @@
iex(3)> if nil, do: "not execute"
nil

View file

@ -0,0 +1,8 @@
let sl : string list = [null; "abc"]
let f s =
match s with
| null -> "It is null!"
| _ -> "It's non-null: " + s
for s in sl do printfn "%s" (f s)

View file

@ -0,0 +1 @@
: is-f? ( obj -- ? ) f = ;

View file

@ -0,0 +1,7 @@
fansh> x := null
fansh> x == null
true
fansh> x = 1
1
fansh> x == null
false

View file

@ -0,0 +1,20 @@
'FB 1.05.0 Win64
' FreeBASIC does not have a NULL keyword but it's possible to create one using a macro
#Define NULL CPtr(Any Ptr, 0) '' Any Ptr is implicitly convertible to pointers of other types
Type Dog
name As String
age As Integer
End Type
Dim d As Dog Ptr = New Dog
d->Name = "Rover"
d->Age = 5
Print d->Name, d->Age
Delete d
d = NULL '' guard against 'd' being used accidentally in future
' in practice many FB developers would simply have written: d = 0 above
Sleep

View file

@ -0,0 +1,8 @@
// Object dimensioned, but not assigned
CFStringRef object
if ( object == NULL )
print "object is NULL"
end if
HandleEvents

View file

@ -0,0 +1,21 @@
package main
import "fmt"
var (
s []int // slice type
p *int // pointer type
f func() // function type
i interface{} // interface type
m map[int]int // map type
c chan int // channel type
)
func main() {
fmt.Println(s == nil)
fmt.Println(p == nil)
fmt.Println(f == nil)
fmt.Println(i == nil)
fmt.Println(m == nil)
fmt.Println(c == nil)
}

View file

@ -0,0 +1,3 @@
undefined -- undefined value provided by the standard library
error "oops" -- another undefined value
head [] -- undefined, you can't take the head of an empty list

View file

@ -0,0 +1 @@
data Maybe a = Nothing | Just a

View file

@ -0,0 +1,3 @@
case thing of
Nothing -> "It's Nothing. Or null, whatever."
Just v -> "It's not Nothing; it is " ++ show v ++ "."

View file

@ -0,0 +1,4 @@
add_two_maybe_numbers x y do
a <- x
b <- y
return (a+b)

View file

@ -0,0 +1,4 @@
*Main> add_two_maybe_numbers (Just 2) (Just 3)
Just 5
*Main> add_two_maybe_numbers (Just 2) Nothing
Nothing

View file

@ -0,0 +1,10 @@
procedure main()
nulltest("a",a) # unassigned variables are null by default
nulltest("b",b := &null) # explicit assignment is possible
nulltest("c",c := "anything")
nulltest("c",c := &null) # varibables can't be undefined
end
procedure nulltest(name,var)
return write(name, if /var then " is" else " is not"," null.")
end

View file

@ -0,0 +1 @@
if(object == nil, "object is nil" println)

View file

@ -0,0 +1 @@
isUndefined=: _1 = nc@boxxopen

View file

@ -0,0 +1,5 @@
isUndefined 'foo'
1
foo=:9
isUndefined 'foo'
0

View file

@ -0,0 +1,12 @@
1 1 0 1#3 4 _ 5 NB. use bitmask to select numbers
3 4 5
I.1 1 0 1 NB. get indices for bitmask
0 1 3
0 1 3 { 3 4 _ 5 NB. use indices to select numbers
3 4 5
1 1 0 1 #inv 3 4 5 NB. use bitmask to restore original positions
3 4 0 5
1 1 0 1 #!._ inv 3 4 5 NB. specify different fill element
3 4 _ 5
3 4 5 (0 1 3}) _ _ _ _ NB. use indices to restore original positions
3 4 _ 5

View file

@ -0,0 +1,4 @@
// here "object" is a reference
if (object == null) {
System.out.println("object is null");
}

View file

@ -0,0 +1,6 @@
if (object === null) {
alert("object is null");
// The object is nothing
}
typeof null === "object"; // This stands since the beginning of JavaScript

View file

@ -0,0 +1,11 @@
null|type # => "null"
null == false # => false
null == null # => true
empty|type # => # i.e. nothing (as in, nada)
empty == empty # => # niente
empty == "black hole" # => # Ничего

View file

@ -0,0 +1,7 @@
/* null non value */
if (thing == null) { puts("thing tests as null"); }
if (thing === undefined) { puts("thing strictly tests as undefined"); }
puts(typeof thing);
puts(typeof null);
puts(typeof undefined);

View file

@ -0,0 +1,6 @@
(1;;2) ~ (1 ; _n ; 2) / ~ is ''identical to'' or ''match'' .
1
_n ~' ( 1 ; ; 2 ) / ''match each''
0 1 0
additional properties : _n@i and _n?i are i; _n`v is _n

View file

@ -0,0 +1,2 @@
%t nan !t
$t nan == ?

View file

@ -0,0 +1,9 @@
// version 1.1.0
fun main(args: Array<String>) {
val i: Int = 3 // non-nullable Int type - can't be assigned null
println(i)
val j: Int? = null // nullable Int type - can be assigned null
println(j)
println(null is Nothing?) // test that null is indeed of type Nothing?
}

View file

@ -0,0 +1,9 @@
val .x, .y = true, null
writeln .x == null
writeln .y == null
writeln .x ==? null
writeln .y ==? null
# null not a "truthy" result
writeln if(null: 0; 1)

View file

@ -0,0 +1,18 @@
local(x = string, y = null)
#x->isA(::null)
// 0 (false)
#y->isA(::null)
// 1 (true)
#x == null
// false
#y == null
//true
#x->type == 'null'
// false
#y->type == 'null'
//true

View file

@ -0,0 +1,6 @@
foo := Nil.
if { foo nil?. } then {
putln: "Foo is nil".
} else {
putln: "Foo is not nil".
}.

View file

@ -0,0 +1 @@
Nil to (Array). ;; []

View file

@ -0,0 +1,2 @@
func := {}.
func. ;; Nil

View file

@ -0,0 +1,21 @@
enum class Option[A] {
Some(A)
None
}
# Only variables of class Option can be assigned to None.
# Type: Option[integer]
var v = Some(10)
# Valid: v is an Option, and any Option can be assigned to None
v = None
# Invalid! v is an Option[integer], not just a plain integer.
v = 10
# Type: integer
var w = 10
# Invalid! Likewise, w is an integer, not an Option.
w = None

View file

@ -0,0 +1,12 @@
put _global.doesNotExist
-- <Void>
put voidP(_global.doesNotExist)
-- 1
x = VOID
put x
-- <Void>
put voidP(x)
-- 1

View file

@ -0,0 +1,6 @@
to test :thing
if empty? :thing [print [list or word is empty]]
end
print empty? [] ; true
print empty? "|| ; true

View file

@ -0,0 +1,2 @@
isnil = (object == nil)
print(isnil)

View file

@ -0,0 +1,12 @@
Module CheckWord {
Declare Alfa "WORD.APPLICATION"
Declare Alfa Nothing
Print Type$(Alfa)="Nothing"
Try ok {
Declare Alfa "WORD.APPLICATION"
\\ we can't declare again Alfa
}
If Not Ok Then Print Error$ ' return Bad Object declaration
}
CheckWord

View file

@ -0,0 +1,54 @@
Module CheckContainers {
\\ Arrays (A() and B() are value types)
Dim A(10)=1, B()
\\ B() get a copy of A(), is not a reference type
B()=A()
\\ we make a pointer to Array
B=A()
\\ now B is a reference type object
Print Len(B)=10 ' ten items
B+=10
Print A(3)=11, A(7)=11
\\ we can change pointer using a pointer to an empty array
B=(,)
\\ we can erase A() and B()
Dim A(0), B(0)
Print Len(A())=0, Len(B())=0
Print Len(B)=0
B=(123,)
\\ B() is a value type so get a copy
B()=B
Print Len(B)=1, B(0)=123
\\ Using Clear we pass a new empty array
Clear B
Print Type$(B)="mArray"
Print Len(B)=1, B(0)=123
\\ Inventrories. Keys must be unique (for normal inventories)
Inventory M=1,2,3,4:=400,5
Print M
Clear M
Inventory M=1,2,3,4,5
Print M
\\ Inventory Queue can have same keys.
Inventory Queue N=1,1,2:="old",2:="ok",3
If Exist(N,2) Then Print Eval$(N)="ok", Eval(N!)=3 ' 4th item
Clear N
Print Len(N)=0, Type$(N)="Inventory"
\\ Stack Object
Z=Stack:=1,2,3
Stack Z {
While not empty {Print Number}
}
Print Len(Z)=0
Z=Stack((Stack:=1,2,3,4),Stack:=20,30,40 )
Print Len(Z)=7
Print Z ' 1 2 3 4 20 30 49
Z=Stack ' This is an empty stacl
Print Len(Z)=0
Print Type$(Z)="mStiva"
}
CheckContainers

View file

@ -0,0 +1,29 @@
class something {
}
class alfa as something {
x=10, y=20
}
a->alfa()
Print a is type alfa = true
Print a is type something = true
a->0&
Print a is type null = true
\\ beta is a named object, is static
group beta {
type: something, alfa
x=10, y=20
}
Print beta is type alfa = true
Print beta is type something = true
\\ now a is a pointer as a weak reference to beta
a->beta
print a is type alfa = true
print a is type something = true
a=pointer() ' same as a->0&
Print a is type null = true
\\ now a is a pointer of a copy of beta
a->(beta)
print a is type alfa = true
print a is type something = true
a=pointer() ' same as a->0&
Print a is type null = true

View file

@ -0,0 +1,8 @@
a = []; b='';
isempty(a)
isempty(b)
if (a)
1,
else,
0
end;

View file

@ -0,0 +1 @@
if obj == undefined then print "Obj is undefined"

View file

@ -0,0 +1,18 @@
CACHE>WRITE $DATA(VARI)
0
CACHE>SET VARI="HELLO" WRITE $DATA(VARI)
1
CACHE>NEW VARI WRITE $DATA(VARI) ;Change to a new scope
0
CACHE 1S1>SET VARI(1,2)="DOWN" WRITE $DATA(VARI)
10
CACHE 1S1>WRITE $DATA(VARI(1))
10
CACHE 1S1>WRITE $D(VARI(1,2))
1
CACHE 1S1>SET VARI(1)="UP" WRITE $DATA(VARI(1))
11
<CACHE 1S1>QUIT ;Leave the scope
<CACHE>W $DATA(VARI)," ",VARI
1 HELLO

View file

@ -0,0 +1,7 @@
a := NULL;
a :=
is (NULL = ());
true
if a = NULL then
print (NULL);
end if;

View file

@ -0,0 +1,12 @@
b := Array([1, 2, 3, Integer(undefined), 5]);
b := [ 1 2 3 undefined 5 ]
numelems(b);
5
b := Array([1, 2, 3, Float(undefined), 5]);
b := [ 1 2 3 Float(undefined) 5 ]
numelems(b);
5
b := Array([1, 2, 3, NULL, 5]);
b := [ 1 2 3 5 ]
numelems(b);
4

View file

@ -0,0 +1 @@
x=Null;

View file

@ -0,0 +1,3 @@
x =.
x = (1 + 2;)
FullForm[x]

View file

@ -0,0 +1 @@
SameQ[x,Null]

View file

@ -0,0 +1 @@
x===Null

View file

@ -0,0 +1,4 @@
x =.;
ValueQ[x]
x = 3;
ValueQ[x]

View file

@ -0,0 +1,2 @@
False
True

View file

@ -0,0 +1 @@
null null? puts!

View file

@ -0,0 +1 @@
VAR foo := NIL

View file

@ -0,0 +1 @@
VAR foo: REF INTEGER := NIL;

Some files were not shown because too many files have changed in this diff Show more