Author: | kobi |
---|---|
Mode: | factor |
Date: | Sun, 5 Sep 2010 18:20:28 |
USING: accessors kernel sequences vectors ; IN: multipart TUPLE: multipart id { seq vector } ; ! (id is the boundary) : <multipart> ( -- 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