Difference between revisions of "SubL/examples.1"

From Public Domain Knowledge Bank
Jump to: navigation, search
(constantp)
Line 6: Line 6:
 
{{:SubL/examples.numberp}}
 
{{:SubL/examples.numberp}}
 
{{:SubL/examples.stringp}}
 
{{:SubL/examples.stringp}}
==== constantp ====
+
{{:SubL/examples.constantp}}
===== (constantp #$Lenat) =====
+
 
CYC(#): (constantp #$Lenat)
 
[Time: 0.002 secs]
 
T
 
{{:SubL/examples.functionp}}
 
 
==== print ====
 
==== print ====
 
===== (print "hello") =====
 
===== (print "hello") =====

Revision as of 02:36, 8 March 2019

constant-internal-id

(constant-internal-id #$Lenat)
 CYC(#): (constant-internal-id #$Lenat)
 [Time: 0.0 secs]
 1

numberp

(numberp 1)
(numberp 1)
[Time: 0.0 secs]
T
(numberp #$Lenat)
CYC(#): (numberp #$Lenat)
[Time: 0.0 secs]
NIL

stringp

examples of use
CYC(#):  (stringp)
Error: Cannot make an arity 0 function from #<Function STRINGP> {req=1 ...}
CYC(#): (stringp "hello" "world")
Error: Cannot make an arity 2 function from #<Function STRINGP> {req=1 opt=0 allowsrest=false}
(stringp "hello")
CYC(#): (stringp "hello")
T
(stringp 1)
CYC(#): (stringp 1)
[Time: 0.0 secs]
NIL
(stringp NIL)
CYC(#): (stringp NIL)
[Time: 0.0 secs]
NIL
(stringp 'stringp)
CYC(#): (stringp 'stringp)
[Time: 0.0 secs]
NIL
(stringp #$Dog)
CYC(#): (stringp #$Dog)
[Time: 0.0 secs]
NIL

constantp

returns T if arg1 is a constant
returns NIL if arg1 is not a constant
?ignores arg2 ?
ERROR if arg0 or arg3 or more

constantp w/ 0 arg is ERROR

CYC(56): (constantp)
Error: Cannot make an arity 0 function from #<Function CONSTANTP> {req=1 ...}

constantp w/ >2 arg is ERROR

CYC(#): (constantp #$Lenat #$Lenat #$Lenat)
Error: Cannot make an arity 3 function from #<Function CONSTANTP> {req=1 opt=1 allowsrest=false}

constantp w/ 1 arg

(constantp "a")
CYC(54): (constantp "a")
[Time: 0.0 secs]
T
(constantp #$Lenat)
CYC(#): (constantp #$Lenat)
[Time: 0.002 secs]
T
(constantp 'a)
CYC(#): (constantp 'a)
[Time: 0.0 secs]
NIL
(constantp 1)
CYC(7): (constantp 1)
[Time: 0.0 secs]
T

constantp w/ 2 arg

(constantp #$Lenat "a")
CYC(#): (constantp #$Lenat "a")
[Time: 0.001 secs]
T

print

(print "hello")
CYC(#): (print "hello")
"hello" [Time: 0.002 secs]
"hello"
(print stringp)
CYC(#): (print stringp)
Error: STRINGP is not bound.
(print #$Lenat)
CYC(#): (print #$Lenat)

#$Lenat [Time: 0.0 secs]
#$Lenat