] if-zero ; inline
: continue-field ( delimiter stream field-seps seq -- sep/f field )
- swap rot stream-read-until [ "\"" glue ] dip
+ spin stream-read-until [ "\"" glue ] dip
swap ?trim nipd ; inline
: field ( delimiter stream field-seps quote-seps -- sep/f field )
M: persistent-hash values >alist values ;
: >persistent-hash ( assoc -- phash )
- T{ persistent-hash } swap [ swap rot new-at ] assoc-each ;
+ T{ persistent-hash } swap [ spin new-at ] assoc-each ;
M: persistent-hash equal?
over persistent-hash? [ assoc= ] [ 2drop f ] if ;
: deep-at ( keys assoc -- value )
swap [
over ?at [ nip ] [
- H{ } clone [ swap rot check-no-key set-at ] keep
+ H{ } clone [ spin check-no-key set-at ] keep
] if
] each ;
M: entry update-toml
[ key>> unclip-last [ over deep-at ] dip ] [ value>> ] bi
- swap rot check-no-key set-at ;
+ spin check-no-key set-at ;
M: table update-toml
[ name>> unclip-last [ over deep-at ] dip ]
- [ entries>> [ H{ } clone ] dip [ update-toml ] each swap rot ]
+ [ entries>> [ H{ } clone ] dip [ update-toml ] each spin ]
[ array?>> [ push-at ] [ check-no-key set-at ] if ] tri ;
PEG: parse-toml ( string -- ast ) toml-parser ;
[
[ (sequence-read-length) ]
[ [ dup pick + ] change-i underlying>> ] bi
- ] dip [ -roll swap rot dupd + seq-copy-loop drop ] 3curry keep ; inline
+ ] dip [ -roll spin dupd + seq-copy-loop drop ] 3curry keep ; inline
: (sequence-read-unsafe) ( n buf stream -- count )
[ integer>fixnum ]
: seq-set-length ( seq n -- seq ) [ swap set-length ] keepd ; inline
: nth-of ( seq n -- elt ) swap nth ; inline
-: set-nth-of ( seq n elt -- seq ) swap rot [ set-nth ] keep ; inline
+: set-nth-of ( seq n elt -- seq ) spin [ set-nth ] keep ; inline
M: sequence seq-lengthen 2dup lengthd < [ seq-set-length ] [ drop ] if ; inline
M: sequence seq-shorten 2dup lengthd > [ seq-set-length ] [ drop ] if ; inline
FUNCTION: cpVect cpPolyShapeGetVert ( cpShape* shape, int idx )
TYPED: cpPolyShapeValueOnAxis ( poly: cpPolyShape n: cpVect d -- min-dist )
- swap rot [ numVerts>> ] [ tVerts>> swap cpVect <c-direct-array> ] bi swap
+ spin [ numVerts>> ] [ tVerts>> swap cpVect <c-direct-array> ] bi swap
[ cpvdot ] curry [ min ] reduce swap - ; inline
TYPED: cpPolyShapeContainsVert ( poly: cpPolyShape v: cpVect -- ? )
{ 3drop [ drop drop drop ] }
{ pop* [ pop drop ] }
{ when [ [ ] if ] }
+ { spin [ swap rot ] }
{ >boolean [ f = not ] }
}
[ DBKEYS dup ] keep '[ dup _ at 2array ] map! drop ;
M: TYPE set-at
- handle>> swap rot [ object>bytes dup length ] bi@ DBPUT drop ;
+ handle>> spin [ object>bytes dup length ] bi@ DBPUT drop ;
M: TYPE delete-at
handle>> swap object>bytes dup length DBOUT drop ;