>bencode ( obj -- bencode ) - Factor Documentation

>bencode ( obj -- bencode )


Vocabulary
bencode

Inputs
obj an object


Outputs
bencode a string


Word description
Encodes an object using the bencode algorithm.

Definition
IN: bencode

GENERIC: >bencode ( obj -- bencode )


Methods
USING: assocs bencode kernel sequences ;

M: assoc >bencode
[ [ >bencode ] bi@ append ] { } assoc>map
concat "d" "e" surround ;


USING: bencode byte-arrays sequences ;

M: byte-array >bencode "" like >bencode ;


USING: bencode math math.parser sequences ;

M: integer >bencode number>string "i" "e" surround ;


USING: bencode sequences ;

M: sequence >bencode [ >bencode ] map concat "l" "e" surround ;


USING: bencode kernel math.parser sequences strings ;

M: string >bencode [ length number>string ":" ] keep 3append ;

AltStyle によって変換されたページ (->オリジナル) /