Skip to content

Instantly share code, notes, and snippets.

@scvalencia
Last active July 21, 2017 04:33
Show Gist options
  • Save scvalencia/0f5f9bd00ac2d2651fbb09c544faac0b to your computer and use it in GitHub Desktop.
Save scvalencia/0f5f9bd00ac2d2651fbb09c544faac0b to your computer and use it in GitHub Desktop.
;; primitive-procedures con los nuevos bindings
;; AQUÍ PUEDEN INTRODUCIR LAS FUNCIONES QUE SU LENGUJE VA A CONOCER!
(define primitive-procedures (list
(list 'car car)
(list 'second cdr)
(list 'cons cons)
(list 'null? null?)
(list '+ +)
(list '* *)
(list '= =)
(list '- -)))
;; El valor de the-global-environment antes de iniciar una sesión es:
;; > the-global-environment
;; (((true false car second cons null? + * = -)
;; #t
;; #f
;; (primitive #<procedure:mcar>)
;; (primitive #<procedure:mcdr>)
;; (primitive #<procedure:mcons>)
;; (primitive #<procedure:null?>)
;; (primitive #<procedure:+>)
;; (primitive #<procedure:*>)
;; (primitive #<procedure:=>)
;; (primitive #<procedure:->)))
;; Iniciemos la sesión de MC-eval.
;;; M-Eval:
(define two 2)
;;; M-Eval value:
ok
;;; M-Eval:
(define id (lambda (x) x))
;;; M-Eval value:
ok
;;; M-Eval:
(define (square x) (* x x))
;;; M-Eval value:
ok
;;; M-Eval:
(id 5)
;;; M-Eval value:
5
;;; M-Eval:
(square 2)
;;; M-Eval value:
4
;; El nuevo valor de the-global-environment es:
;; > the-global-environment
;; (((square id two true false car second cons null? + * = -)
;; (procedure (x) ((* x x)) #0#)
;; (procedure (x) (x) #0#)
;; 2
;; #t
;; #f
;; (primitive #<procedure:mcar>)
;; (primitive #<procedure:mcdr>)
;; (primitive #<procedure:mcons>)
;; (primitive #<procedure:null?>)
;; (primitive #<procedure:+>)
;; (primitive #<procedure:*>)
;; (primitive #<procedure:=>)
;; (primitive #<procedure:->)))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment