USING: accessors kernel sequences vectors ; IN: multipart TUPLE: multipart id { seq vector } ; ! (id is the boundary) : ( -- multi ) multipart new ; TUPLE: binary-part id data mimetype ; TUPLE: text-part id data encoding ; : add ( object multipart -- ) tuck id>> >>id ! assign the parent's id to the object swap seq>> push ; ! add the object to the multipart parent. : expand ( multipart -- seq ) seq>> [ dup multipart? [ expand ] when ] map ; inline recursive