klisp

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

keywords.k (2136B)


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