Re: Bits from a stream



Otherwise, your READ-BIT function is wrong. You've not proved it,
it's clear, but did you even try it?
That's weird. I've tried it. It seems to work....
F:\LispTest>type foo.txt
7n
F:\LispTest>clisp
[1]> (load "bitstream.lisp")
;; Loading file bitstream.lisp ...
;; Loaded file bitstream.lisp
T
[2]> (setf f (open "foo.txt" :direction :input :element-type
'unsigned-byte))
#<INPUT BUFFERED FILE-STREAM (UNSIGNED-BYTE 8) #P"foo.txt">
[3]> (read-bit f)
1
[4]> (read-bit f)
1
[5]> (read-bit f)
1
[6]> (read-bit f)
0
[7]> (read-bit f)
1
[8]> (read-bit f)
1
[9]> (read-bit f)
0
[10]> (read-bit f)
0
[11]> (read-bit f)
0
[12]> (read-bit f)
1
[13]> (read-bit f)
1
[14]> (read-bit f)
1
[15]> (read-bit f)
0
[16]> (read-bit f)
1
[17]> (read-bit f)
1
[18]> (read-bit f)
0

7=>37h, 00110111
n=>6eh, 01101110

stream read (in sequence):
1 1 1 0 _ 1 1 0 0 _ 0 1 1 1 _ 0 1 1 0
which was exactly what I was expecting...

Hmm, lemme change test benches... (btw I've now followed your
recommendation and changed 'eq to '=)

.



Relevant Pages

  • Re: Lispbox-0.7
    ... WARNING in START in lines 960..1151: ...
    (comp.lang.lisp)
  • Newbie and clocc
    ... CL-USER> ... EVAL: undefined function MGG-INTEREST ...
    (comp.lang.lisp)
  • pg.lisp compile error on clisp
    ... ;; Loading file defpackage.lisp ... ... ;; Loaded file defpackage.lisp ... *** - invalid byte #xF8 in CHARSET:ASCII conversion ...
    (comp.lang.lisp)