pack: cleanup, write macros in more intuitive style that works now

db4
Slava Pestov 2009-02-06 10:22:22 -06:00
parent d1486589ef
commit 31f976e0e9
1 changed files with 2 additions and 4 deletions

View File

@ -113,9 +113,7 @@ CONSTANT: packed-length-table
MACRO: pack ( str -- quot )
[ pack-table at '[ _ execute ] ] { } map-as
'[ _ spread ]
'[ _ input<sequence ]
'[ _ B{ } append-outputs-as ] ;
'[ [ [ _ spread ] input<sequence ] B{ } append-outputs-as ] ;
PRIVATE>
@ -143,7 +141,7 @@ MACRO: unpack ( str -- quot )
[ [ ch>packed-length ] { } map-as start/end ]
[ [ unpack-table at '[ @ ] ] { } map-as ] bi
[ '[ [ _ _ ] dip <slice> @ ] ] 3map
'[ _ cleave ] '[ _ output>array ] ;
'[ [ _ cleave ] output>array ] ;
PRIVATE>