[ nip ] [ drop length ] if ;
: surround-by-brackets ( str delim -- str' )
- [ "[" dup surround ] [ "]" dup surround ] bi surround ;
+ [ "[" 1surround ] [ "]" 1surround ] bi surround ;
: surround-by-equals-brackets ( str n -- str' )
CHAR: = <repetition> surround-by-brackets ;
[ quot>> call( str -- str' ) ] [ set-editor-string ] bi
] [ call-next-method ] if ;
-: cake ( string delim -- string' )
- dup surround ; inline
-
: containerize ( string tag open-delim close-delim -- string' )
- overd [ cake ] 2bi@ surround ;
+ overd [ 1string ] 2bi@ surround ;
: checksum-escape-string ( string checksum -- string' )
[ drop ]
: handle-PWD ( obj -- )
drop
- display-directory "\"" dup surround 257 server-response ;
+ display-directory "\"" 1surround 257 server-response ;
: handle-SYST ( obj -- )
drop
: escape-argument ( str -- newstr )
escape-double-quote
CHAR: \s over member? [
- fix-trailing-backslashes "\"" dup surround
+ fix-trailing-backslashes "\"" 1surround
] when ;
: join-arguments ( args -- cmd-line )
: check-recursion ( obj quot: ( obj -- ) -- )
nesting-limit? [
drop
- [ class-of name>> "~" dup surround ] keep present-text
+ [ class-of name>> "~" 1surround ] keep present-text
] [
over recursion-check get member-eq? [
drop "~circularity~" swap present-text
: surround ( seq1 seq2 seq3 -- newseq ) over surround-as ; inline
+: 1surround-as ( seq1 seq2 exemplar -- newseq ) dupd surround-as ; inline
+
+: 1surround ( seq1 seq2 -- newseq ) over 1surround-as ; inline
+
: glue-as ( seq1 seq2 seq3 exemplar -- newseq ) swapd 3append-as ; inline
: glue ( seq1 seq2 seq3 -- newseq ) pick glue-as ; inline
dup current-char forbid-tab {
{ CHAR: \s [ advance-char ] }
{ f [ drop ] }
- [ "[space]" swap 1string "'" dup surround unexpected ]
+ [ "[space]" swap 1string "'" 1surround unexpected ]
} case drop
] if ;
:: passwd-md5 ( magic salt password -- bytes )
password magic salt 3append
- salt password dup surround md5 checksum-bytes
+ salt password 1surround md5 checksum-bytes
password length
[ 16 / ceiling swap <repetition> concat ] keep
head-slice append
11 final nth 2 to64 3append ;
: parse-shadow-password ( string -- magic salt password )
- "$" split harvest first3 [ "$" dup surround ] 2dip ;
+ "$" split harvest first3 [ "$" 1surround ] 2dip ;
: authenticate-password ( shadow password -- ? )
'[ parse-shadow-password drop _ passwd-md5 ] keep = ;
: trim1 ( seq ch -- newseq )
[ [ ?head-slice drop ] [ ?tail-slice drop ] bi ] keepd like ;
-: single-quote ( str -- newstr ) "'" dup surround ;
+: single-quote ( str -- newstr ) "'" 1surround ;
-: double-quote ( str -- newstr ) "\"" dup surround ;
+: double-quote ( str -- newstr ) "\"" 1surround ;
: quote ( str -- newstr )
CHAR: ' over member?
[ image. ] with-matching-files ;
: ls ( dirpath extension -- )
- [ "\"" dup surround print ] with-matching-files ;
+ [ "\"" 1surround print ] with-matching-files ;
: save-as-reference-image ( path -- )
[ load-image ] [ fig-name ] bi
M: chat-server handle-client-disconnect
[
line-beginning username " has quit "
- client object>> dup [ "\"" dup surround ] when
+ client object>> dup [ "\"" 1surround ] when
] "" append-outputs-as send-everyone ;
M: chat-server handle-already-logged-in
: >value ( obj -- string )
{
- { [ dup squote? ] [ payload>> "'" dup surround ] }
- { [ dup dquote? ] [ payload>> "\"" dup surround ] }
+ { [ dup squote? ] [ payload>> "'" 1surround ] }
+ { [ dup dquote? ] [ payload>> "\"" 1surround ] }
[ ]
} cond ;
! * * * * * * * * * * * * * * * *
: iterate-triangle ( triange spaces -- triangle' )
- [ [ dup surround ] curry map ]
+ [ [ 1surround ] curry map ]
[ drop [ dup " " glue ] map ] 2bi append ;
: (sierpinski) ( triangle spaces n -- triangle' )
: unsurround ( newseq seq2 seq3 -- seq1 )
[ ?head drop ] [ ?tail drop ] bi* ;
+: >string-list ( seq -- seq' )
+ [ "\"" 1surround ] map "," join ;
+
: one? ( ... seq quot: ( ... elt -- ... ? ) -- ... ? )
[ find ] 2keep rot [
[ 1 + ] 2dip find-from drop not
command-line get [
grep-usage
] [
- unclip ".*" dup surround <regexp> swap [
+ unclip ".*" 1surround <regexp> swap [
grep-lines
] [
[ grep-file ] with each