init.lsp


(context 'MAIN:include)
; http://www.newlisp.org/index.cgi?page=Code_Snippets
(define error "")
(define modules '())
(define (include:include mfile)
  (unless (find mfile modules)
    (when (catch (if (file? mfile) (load mfile) (module mfile)) 'error)
      (push mfile modules -1))))

(context 'MAIN:type-of)
; http://static.artfulcode.net/newlisp/util.lsp.src.html
(define types '("boolean" "boolean" "integer" "float" "string" "symbol" "context"
                "primitive" "primitive" "primitive" "quote" "list" "lambda" "macro"
                "array"))
(define (type-of:type-of x)
  (let (type (types (& 0xf ((dump x) 1))))
    (if (and (= "list" type) (context? (first x)))
          (name (first x))
          type)))

(context MAIN)

(include "macro.lsp")
(include "newlisp-utility.lsp")

No comments yet

コメントを残す