klisp

an open source interpreter for the Kernel Programming Language.
git clone http://git.hanabi.in/repos/klisp.git
Log | Files | Refs | README

symbols.k (1847B)


      1 ;; check.k & test-helpers.k should be loaded
      2 
      3 ;;;
      4 ;;; Basic Functionality
      5 ;;;
      6 
      7 ;; symbol?
      8 ($check-predicate (applicative? symbol?))
      9 
     10 ($let (($qs ($vau (s) #ignore s)))
     11   ($let ((s1 ($qs s1))
     12          (s2 ($qs s2))
     13          (s3 ($qs s3)))
     14     ($check-predicate (symbol?))
     15     ($check-predicate (symbol? s1))
     16     ($check-predicate (symbol? s1 s2 s3))
     17     ($check-predicate (symbol? s1 . #0=(s2 . #0#)))))
     18 
     19 ($check-not-predicate (symbol? ()))
     20 ($check-not-predicate (symbol? (cons () ())))
     21 ($check-not-predicate (symbol? #ignore))
     22 ($check-not-predicate (symbol? (make-environment)))
     23 ($check-not-predicate (symbol? #inert))
     24 ($check-not-predicate (symbol? wrap))
     25 ($check-not-predicate (symbol? (call/cc ($lambda (c) c))))
     26 ($check-not-predicate (symbol? ($let (((enc . #ignore) 
     27                                        (make-encapsulation-type)))
     28                                  (enc #inert))))
     29 ($check-not-predicate (symbol? (memoize #inert)))
     30 ($check-not-predicate (symbol? 1))
     31 ($check-not-predicate (symbol? 1.0))
     32 ($check-not-predicate (symbol? #e+infinity))
     33 ($check-not-predicate (symbol? #i+infinity))
     34 ($check-not-predicate (symbol? #undefined))
     35 ($check-not-predicate (symbol? #real))
     36 ($check-not-predicate (symbol? "string"))
     37 ($check-not-predicate (symbol? #\a))
     38 ($check-not-predicate (symbol? (get-current-input-port))) 
     39 
     40 ;; symbol->string
     41 ($check-predicate (applicative? symbol->string))
     42 ($check equal? (symbol->string ((unwrap list) . symbol)) "symbol")
     43 
     44 ;; string->symbol
     45 ($check-predicate (applicative? string->symbol))
     46 ($check equal? (string->symbol "symbol") ((unwrap list) . symbol))
     47 ($check equal? (symbol->string (string->symbol "symbol")) "symbol")
     48 
     49 ;;;
     50 ;;; Eq?-ness & Equal?-ness
     51 ;;;
     52 ($check-predicate (eq? ((unwrap list) . symbol) ((unwrap list) . symbol)))
     53 ($check-predicate (equal? ((unwrap list) . symbol) ((unwrap list) . symbol)))