jscl-project / jscl

A Lisp-to-JavaScript compiler bootstrapped from Common Lisp
https://jscl-project.github.io
GNU General Public License v3.0
874 stars 108 forks source link

Some features and pathes #446

Closed vlad-km closed 1 year ago

vlad-km commented 1 year ago
vlad-km commented 1 year ago
CL-USER> (dotimes (i 35) 
...     (let ((base (+ i 2))) 
...       (write 40 :base base) 
...       (if (zerop (mod i 10)) (terpri) (write-char #\space)))) 
... 
101000
1111 220 130 104 55 50 44 40 37 34
31 2c 2a 28 26 24 22 20 1j 1i
1h 1g 1f 1e 1d 1c 1b 1a 19 18
17 16 15 14
CL-USER> (dolist (pb '(2 3 8 10 16)) 
...      (write 10 :base pb :radix t)     (terpri))
#B1010
#3r101
#O12
10
#Xa
NIL
CL-USER> (write 10 :stream *standard-output* :radix t :base 11)
#11ra
CL-USER> (with-output-to-string (s) 
...     (write-string "some text" s) 
...     (terpri s) 
...     (terpri s) 
...     (write-string "more text" s))
"some text\n\nmore text"
CL-USER> (format t "~a" *)
some text

more text
CL-USER> (with-output-to-string (s) 
...     (write-string "some text" s) 
...     (fresh-line s) 
...     (fresh-line s) 
...     (write-string "more text" s))
"some text\nmore text"
CL-USER> (format t "~a" *)
some text
more text
davazp commented 1 year ago

Why the change from (format t to (format *standard-output? Shouldn't it be the same?

If destination is t, the output is sent to standard output.

davazp commented 1 year ago

Looks great, thank you!