Skip to content

Instantly share code, notes, and snippets.

@gtrak
Created March 31, 2014 18:42
Show Gist options
  • Save gtrak/9899238 to your computer and use it in GitHub Desktop.
Save gtrak/9899238 to your computer and use it in GitHub Desktop.
<gtrak> hey, I figured this might be the place to ask, but do bencode and implementations support an empty-list encoding, like 'le'?
<gtrak> because I have one impl that's producing it (clojure), and another that can't read it correctly (emacs elisp), I didn't write either :-)
--> Exancillatus ([email protected]) has joined ##bittorrent
<-- Exancillatus ([email protected]) has quit (Ping timeout: 264 seconds)
<-- badon (~badon@pdpc/supporter/active/badon) has quit (Ping timeout: 252 seconds)
<TheSHAD0W> Empty list should be in the spec.
<TheSHAD0W> You may need to fix that lisp implementation.
<gtrak> yea, cool.
<gtrak> I'm guessing null isn't :-)
<gtrak> but I can use empty-list for the relevant logic
--> Exancillatus ([email protected]) has joined ##bittorrent
<gtrak> the clojure impl encodes nil as empty-list, so that's something.
<gtrak> empty-list is truthy and rarely used in clojure but falsy in elisp/CL, so I assume it's on purpose.
--> badon (~badon@pdpc/supporter/active/badon) has joined ##bittorrent
<TheSHAD0W> No, null is not part of the spec.
<TheSHAD0W> Empty string is also part of the spec I think...
<gtrak> my encoder does it as '0:'
-*- TheSHAD0W nods
<gtrak> (round-trip ["" nil]) => l0:lee => ["" []]
<gtrak> seems to work with dicts too
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment