OSDN Git Service

dup
authorsforman <sforman@hushmail.com>
Fri, 11 Aug 2023 04:47:54 +0000 (21:47 -0700)
committersforman <sforman@hushmail.com>
Fri, 11 Aug 2023 04:47:54 +0000 (21:47 -0700)
implementations/scheme-chicken/joy.scm

index 68097a0..2ae03de 100644 (file)
   (cond
     ((is-it? "+") (values (joy-add stack) expression dict))
     ((is-it? "-") (values (joy-sub stack) expression dict))
+    ((is-it? "dup") (values (joy-dup stack) expression dict))
     (else (values (cons symbol stack) expression dict))))
 
 (define (joy-add stack) (cons (+ (cadr stack) (car stack)) (cddr stack)))
 (define (joy-sub stack) (cons (- (cadr stack) (car stack)) (cddr stack)))
+(define (joy-dup stack) (cons (car stack) stack))
 
 
 (define (string-replace str from to)