Odd word problem/TrivialCharacterStreamSupportForJ: Difference between revisions

use a verb to initialize 'instream' and start with 'outstream' initialized
mNo edit summary
(use a verb to initialize 'instream' and start with 'outstream' initialized)
Line 1:
[[../#J|J]] lacks a character stream implementation, so this is a minimal sketch of "get a character" and "put a character" code.
 
Note that the =. definitions provided here are for illustration purposes only (and, in fact, they will be discarded after loading the code from file), and are meant to be replaced by similar code at stream initialization time. Note that this implementation allows only one input stream and one output stream per locale.
 
<lang j>setstreamsbegin_instream=: 3 :0 NB. convenience wrapper
instream=: y
last=: _1
outstream=: ''
)
 
 
instream=. 'example text'
last=. _1
getch=: 3 :0
Line 19 ⟶ 14:
outstream=.: ''
outch=: 3 :0
6,951

edits