Arc Forumnew | comments | leaders | submitlogin
3 points by parenthesis 6277 days ago | link | parent

Here's a quick hack for what you want:

Put this in ac.scm:

  (xdef 'print (lambda args
                 (if (pair? args)
                     (print (ac-denil (car args)) 
                              (if (pair? (cdr args)) 
                                  (cadr args)
                                  (current-output-port))))
                 (flush-output)
                 'nil))
And these in arc.arc:

  (def rpr args
    (map1 print args)
    (car args))

  (def rprn args
    (do1 (apply rpr args)
         (writec #\newline
                 (if (isa (car args) 'output) (car args) (stdout)))))
Then:

  > (rprn (list 'a 2 "c"))
  (a 2 "c") ; prints this
  (a 2 "c") ; returns this
Edit: The above are just very slightly modified versions of the code used to implement pr and prn, the difference is that Scheme's print is used instead of display, to give READable output.


3 points by pg 6277 days ago | link

As offby1 pointed out (http://arclanguage.org/item?id=1997) there is already a fn for this: write.

-----