Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[cl-backend] added simple arithmetic ops
  • Loading branch information
pmurias committed Feb 11, 2011
1 parent 710ffd7 commit e735b87
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion cl-backend/backend.lisp
Expand Up @@ -207,7 +207,7 @@
`(,(method-name (to-string method-name)) (FETCH ,(first args)) ,@(rest args))))


(defun nam-obj_getbool (obj) (if (numberp obj) (not (equal obj 0)) t))
(defun nam-obj_getbool (obj) (if (numberp obj) (not (equal obj 0)) obj))
(nam-op ternary (cond if then) `(if ,cond ,if ,then))

(defun nam-null (type) nil)
Expand Down Expand Up @@ -278,6 +278,19 @@
(defun p6-say (&rest things) (mapcar #'print-thing things) (format t "~%"))
(defun p6-concat (&rest things) (apply 'concatenate 'string (mapcar #'FETCH things)))

; BIF

(defun nam-bif_plus (a b) (+ (FETCH a) (FETCH b)))

(defun nam-bif_minus (a b) (- (FETCH a) (FETCH b)))

(defun nam-bif_mul (a b) (* (FETCH a) (FETCH b)))

(defun nam-bif_numgt (a b) (> (FETCH a) (FETCH b)))

(defun nam-bif_numeq (a b) (= (FETCH a) (FETCH b)))


(defun wrap-for-eval (compiled-unit)
`(let ((|&infix:<~>| #'p6-concat)
(|&say| #'p6-say)
Expand Down

0 comments on commit e735b87

Please sign in to comment.