Difference between revisions of "SubL/examples.1"
From Public Domain Knowledge Bank
DavidWhitten (talk | contribs) |
DavidWhitten (talk | contribs) (→constant-internal-id) |
||
Line 1: | Line 1: | ||
=== Information gathering function examples === | === Information gathering function examples === | ||
==== constant-internal-id ==== | ==== constant-internal-id ==== | ||
+ | ===== arg1 datatype is STRUCTURE ===== | ||
+ | CYC(#): (constant-internal-id "hello") | ||
+ | Error: "hello" is not of type STRUCTURE. | ||
+ | CYC(#): (structurep "hello") | ||
+ | Error: STRUCTUREP is not fboundp. | ||
+ | |||
===== (constant-internal-id #$Lenat) ===== | ===== (constant-internal-id #$Lenat) ===== | ||
− | + | CYC(#): (constant-internal-id #$Lenat) | |
− | + | [Time: 0.0 secs] | |
− | + | 1 | |
+ | |||
=== Input / Output function examples === | === Input / Output function examples === | ||
{{:SubL/examples.print}} | {{:SubL/examples.print}} |
Revision as of 03:09, 8 March 2019
Contents
Information gathering function examples
constant-internal-id
arg1 datatype is STRUCTURE
CYC(#): (constant-internal-id "hello") Error: "hello" is not of type STRUCTURE. CYC(#): (structurep "hello") Error: STRUCTUREP is not fboundp.
(constant-internal-id #$Lenat)
CYC(#): (constant-internal-id #$Lenat) [Time: 0.0 secs] 1
Input / Output function examples
print w/ 0 arguments is ERROR
CYC(#): (print) Error: Cannot make an arity 0 function from #<Function PRINT> {req=1 ...}
print w/ 2 arguments
arg2 must be OUTPUT-TEXT-STREAM
CYC(#):(print "hello" #$Lenat) Error: #$Lenat is not of type: OUTPUT-TEXT-STREAM. CYC(#): (print "hello" "world") [Time: 0.006 secs] "hello"
print w/ 3+ arguments is ERROR
CYC(#): (print "hello" "world" #$Lenat) Error: Cannot make an arity 3 function from #<Function PRINT> {req=1 opt=1 allowsrest=false}
print w/ 1 argument
(print "string")
CYC(#): (print "hello") "hello" [Time: 0.002 secs] "hello"
(print 'symbol )
CYC(15): (print 'symb) SYMB [Time: 0.002 secs] SYMB
(print stringp)
CYC(#): (print stringp) Error: STRINGP is not bound.
(print #$Lenat)
CYC(#): (print #$Lenat) #$Lenat [Time: 0.0 secs] #$Lenat
Type testing functions examples
{{:SubL/examples.constantp
functionp
CYC(#): (functionp) Error: Cannot make an arity 0 function from #<Function FUNCTIONP> {req=1 ...} CYC(#): (functionp "a" 'a) Error: Cannot make an arity 2 function from #<Function FUNCTIONP> {req=1 opt=0 allowsrest=false}
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