Example No. 1:
Code: Select all
(define-macro (m lst)
(eval lst))
(m '(+ 4 5)) ;; -> (+ 4 5)
Code: Select all
(eval '(+ 4 5)) ;; -> 9
Code: Select all
(define-macro (m lst)
(eval lst))
(m '(+ 4 5)) ;; -> (+ 4 5)
Code: Select all
(eval '(+ 4 5)) ;; -> 9
Code: Select all
(m '(+ 4 5))
Code: Select all
(eval ''(+ 4 5))
Code: Select all
(define(f lst)
(+ lst 1))
(setq a '(+ 2 3))
(f a)
Code: Select all
(define(f lst)
(letex (x lst) (+ x 1)))
(setq a '(+ 2 3))
;-> (+ 2 3)
(f a)
;-> 6
Code: Select all
(define types '("nil" "true" "int" "float" "string" "symbol" "context"
"primitive" "import" "ffi" "quote" "expression" "lambda" "fexpr" "array"
"dyn_symbol"))
(define (typeof v)
(types (& 0xf ((dump v) 1))))
(define(f lst)
(letex (x lst)
(println (list? lst))
(println (symbol? lst))
(println (list? x))
(println (symbol? x))
(println (dump lst))
(println (dump x))
(println (typeof lst))
(println (typeof x))
(+ x 1)))
(setq a '(+ 2 3))
;-> (+ 2 3)
(f a)
;-> true
;-> nil
;-> nil
;-> nil
;-> (7026864 59 7012912 7030672 7026896)
;-> (7030096 386 7012912 7012912 5)
;-> expression
;-> int
;-> 6