Code: Select all
(define-macro (this:this) (push (context) (args)))
>(this forum topic should explain itself)
(this forum topic should explain itself)
Code: Select all
(define-macro (this:this) (push (context) (args)))
>(this forum topic should explain itself)
(this forum topic should explain itself)
Code: Select all
(define (return:return) (clean nil? (args)))
> (return any number from 10 upto 100 from this line)
(10 100)
Code: Select all
> (define (it:it) (silent (define (isn) (set 't "Yes it is!"))))
>(it is nice weather?)
> (isn't it?)
"Yes it is!"
Code: Select all
mike is tall
john is tall
peter is old
john is old
what is john ; => john is tall and old
john is smart
what is john ; => john is tall, old and smart
who is smart ; => john is smart
who is old ; => peter and john are old
mike is old
who is old ; => peter, john and mike are old
Code: Select all
(define (show l)
(map (fn (f)
(println (format {%s is %s} (map string (select (facts f) '(0 2)))))) l))
(define-macro (is a b)
(cond
((= a 'who) (show (ref-all (list '? b) facts match)))
((= a 'what) (show (ref-all (list b '?) facts match)))
(true (push (list (sym a) (sym b)) facts))))
(command-event (fn (s)
(if (find "is " s)
(string {(is } (replace {is } s {}) {)})
s)))
Code: Select all
> mike is tall
> john is tall
> peter is old
> john is old
> what is john
john is old
john is tall
> john is smart
> what is john
john is smart
john is old
john is tall
> who is smart
john is smart
> who is old
john is old
peter is old
> mike is old
> who is old
mike is old
john is old
peter is old
>