The Stack Overflow podcast is back! Listen to an interview with our new CEO.
3 replaced http://stackoverflow.com/ with https://stackoverflow.com/
source | link

None that I know of. There is however many Lisps that can save it's imagesave it's image so that you can start up with all definitions. You won't be able to actually see the definitions though.

I would have kept my definitions in a file (or in the IDE like in DrRacket) and started the repl with loading that file. When changing definition you copy/past it back to your definition file when you're satisfied.

Alternatively, you could make a small REPL:

;; These are outside in case we break out of the REPL
(define env '())
(define (print-env)
  (newline)
  (for-each (lambda (x) (display (cdr x)) (newline)) env)
  (newline))

(define (repl)
  (define (define? expr)
    (and (pair? expr)
         (or (eq? 'define (car expr))
             (eq? 'set! (car expr)))))

  (define (define-name expr)
    (if (pair? (cadr expr))
        (caadr expr)
        (cadr expr)))

  (define (extend-env name expr)
    (let ((found (assq name env)))
      (if found
          (set-cdr! (car found) expr)
          (set! env (cons (cons name expr) env)))))

  (let ((expr (read)))
    (if (define? expr)
        (let ((name (define-name expr)))
          (eval expr (interaction-environment))
          (extend-env name expr)
          (repl))
        (let ()
              (display (eval expr (interaction-environment)))
              (newline)
              (repl)))))

(display "Outer REPL: If an error occurs, rerun with (repl)\nIn both REPL and outside yo may print definitions by calling (print-env)\n")
(repl)

This one is very crude. At the very first error it will exit the loop. In andoutside repl however, you may print the definitions by running (print-env).

None that I know of. There is however many Lisps that can save it's image so that you can start up with all definitions. You won't be able to actually see the definitions though.

I would have kept my definitions in a file (or in the IDE like in DrRacket) and started the repl with loading that file. When changing definition you copy/past it back to your definition file when you're satisfied.

Alternatively, you could make a small REPL:

;; These are outside in case we break out of the REPL
(define env '())
(define (print-env)
  (newline)
  (for-each (lambda (x) (display (cdr x)) (newline)) env)
  (newline))

(define (repl)
  (define (define? expr)
    (and (pair? expr)
         (or (eq? 'define (car expr))
             (eq? 'set! (car expr)))))

  (define (define-name expr)
    (if (pair? (cadr expr))
        (caadr expr)
        (cadr expr)))

  (define (extend-env name expr)
    (let ((found (assq name env)))
      (if found
          (set-cdr! (car found) expr)
          (set! env (cons (cons name expr) env)))))

  (let ((expr (read)))
    (if (define? expr)
        (let ((name (define-name expr)))
          (eval expr (interaction-environment))
          (extend-env name expr)
          (repl))
        (let ()
              (display (eval expr (interaction-environment)))
              (newline)
              (repl)))))

(display "Outer REPL: If an error occurs, rerun with (repl)\nIn both REPL and outside yo may print definitions by calling (print-env)\n")
(repl)

This one is very crude. At the very first error it will exit the loop. In andoutside repl however, you may print the definitions by running (print-env).

None that I know of. There is however many Lisps that can save it's image so that you can start up with all definitions. You won't be able to actually see the definitions though.

I would have kept my definitions in a file (or in the IDE like in DrRacket) and started the repl with loading that file. When changing definition you copy/past it back to your definition file when you're satisfied.

Alternatively, you could make a small REPL:

;; These are outside in case we break out of the REPL
(define env '())
(define (print-env)
  (newline)
  (for-each (lambda (x) (display (cdr x)) (newline)) env)
  (newline))

(define (repl)
  (define (define? expr)
    (and (pair? expr)
         (or (eq? 'define (car expr))
             (eq? 'set! (car expr)))))

  (define (define-name expr)
    (if (pair? (cadr expr))
        (caadr expr)
        (cadr expr)))

  (define (extend-env name expr)
    (let ((found (assq name env)))
      (if found
          (set-cdr! (car found) expr)
          (set! env (cons (cons name expr) env)))))

  (let ((expr (read)))
    (if (define? expr)
        (let ((name (define-name expr)))
          (eval expr (interaction-environment))
          (extend-env name expr)
          (repl))
        (let ()
              (display (eval expr (interaction-environment)))
              (newline)
              (repl)))))

(display "Outer REPL: If an error occurs, rerun with (repl)\nIn both REPL and outside yo may print definitions by calling (print-env)\n")
(repl)

This one is very crude. At the very first error it will exit the loop. In andoutside repl however, you may print the definitions by running (print-env).

2 Added a REPL
source | link

None that I know of. There is however many Lisps that can save it's image so that you can start up with all definitions. You won't be able to actually see the definitions though.

I would have kept my definitions in a file (or in the IDE like in DrRacket) and started the repl with loading that file. When changing definition you copy/past it back to your definition file when you're satisfied.

Alternatively, you could make a small REPL:

;; These are outside in case we break out of the REPL
(define env '())
(define (print-env)
  (newline)
  (for-each (lambda (x) (display (cdr x)) (newline)) env)
  (newline))

(define (repl)
  (define (define? expr)
    (and (pair? expr)
         (or (eq? 'define (car expr))
             (eq? 'set! (car expr)))))

  (define (define-name expr)
    (if (pair? (cadr expr))
        (caadr expr)
        (cadr expr)))

  (define (extend-env name expr)
    (let ((found (assq name env)))
      (if found
          (set-cdr! (car found) expr)
          (set! env (cons (cons name expr) env)))))

  (let ((expr (read)))
    (if (define? expr)
        (let ((name (define-name expr)))
          (eval expr (interaction-environment))
          (extend-env name expr)
          (repl))
        (let ()
              (display (eval expr (interaction-environment)))
              (newline)
              (repl)))))

(display "Outer REPL: If an error occurs, rerun with (repl)\nIn both REPL and outside yo may print definitions by calling (print-env)\n")
(repl)

This one is very crude. At the very first error it will exit the loop. In andoutside repl however, you may print the definitions by running (print-env).

None that I know of. There is however many Lisps that can save it's image so that you can start up with all definitions. You won't be able to actually see the definitions though.

I would have kept my definitions in a file (or in the IDE like in DrRacket) and started the repl with loading that file. When changing definition you copy/past it back to your definition file when you're satisfied.

None that I know of. There is however many Lisps that can save it's image so that you can start up with all definitions. You won't be able to actually see the definitions though.

I would have kept my definitions in a file (or in the IDE like in DrRacket) and started the repl with loading that file. When changing definition you copy/past it back to your definition file when you're satisfied.

Alternatively, you could make a small REPL:

;; These are outside in case we break out of the REPL
(define env '())
(define (print-env)
  (newline)
  (for-each (lambda (x) (display (cdr x)) (newline)) env)
  (newline))

(define (repl)
  (define (define? expr)
    (and (pair? expr)
         (or (eq? 'define (car expr))
             (eq? 'set! (car expr)))))

  (define (define-name expr)
    (if (pair? (cadr expr))
        (caadr expr)
        (cadr expr)))

  (define (extend-env name expr)
    (let ((found (assq name env)))
      (if found
          (set-cdr! (car found) expr)
          (set! env (cons (cons name expr) env)))))

  (let ((expr (read)))
    (if (define? expr)
        (let ((name (define-name expr)))
          (eval expr (interaction-environment))
          (extend-env name expr)
          (repl))
        (let ()
              (display (eval expr (interaction-environment)))
              (newline)
              (repl)))))

(display "Outer REPL: If an error occurs, rerun with (repl)\nIn both REPL and outside yo may print definitions by calling (print-env)\n")
(repl)

This one is very crude. At the very first error it will exit the loop. In andoutside repl however, you may print the definitions by running (print-env).

1
source | link

None that I know of. There is however many Lisps that can save it's image so that you can start up with all definitions. You won't be able to actually see the definitions though.

I would have kept my definitions in a file (or in the IDE like in DrRacket) and started the repl with loading that file. When changing definition you copy/past it back to your definition file when you're satisfied.