On Sun, May 12, 2019 at 9:23 AM Lassi Kortela <xxxxxx@lassi.io> wrote:
 
It reads up to 1000 bytes from the file into a bytevector and reads the
first Scheme form from that bytevector, interpreting the bytes as an T
ASCII superset. If there are any errors, it simply returns #f.

I did something similar (but in pseudo-code, not code) in my old blog post "Hello!  I am an XML encoding sniffer" at <http://recycledknowledge.blogspot.com/2005/07/hello-i-am-xml-encoding-sniffer.html>.  

As long as you are using a custom reader, however, you might as well make the whole declare-file form a comment so that the regular reader can just start over.  The simplest thing is to prefix it with "#;" but if you care about Common Lisp compatibility you can go with "#||" at the beginning and "||#" at the end.  (The doubled vertical bar is not required by either language, but keeps Emacs happier.)


John Cowan          http://vrici.lojban.org/~cowan        xxxxxx@ccil.org
And through this revolting graveyard of the universe the muffled,
maddening beating of drums, and thin, monotonous whine of blasphemous
flutes from inconceivable, unlighted chambers beyond Time; the
detestable pounding and piping whereunto dance slowly, awkwardly, and
absurdly the gigantic tenebrous ultimate gods --the blind, voiceless,
mindless gargoyles whose soul is Nyarlathotep. (Lovecraft)