Skip to content

Commit 76761b2

Browse files
committed
more minor cleanup.
1 parent 1e8dedb commit 76761b2

File tree

13 files changed

+54
-53
lines changed

13 files changed

+54
-53
lines changed

basis/dlists/dlists.factor

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,9 @@ M: dlist equal?
8787
PRIVATE>
8888

8989
: unlink-node ( dlist-node -- )
90-
dup prev>> over next>> set-prev-when
91-
dup next>> swap prev>> set-next-when ; inline
90+
[ prev>> ] [ next>> ] bi
91+
[ set-prev-when ]
92+
[ swap set-next-when ] 2bi ; inline
9293

9394
M: dlist push-front* ( obj dlist -- dlist-node )
9495
[ front>> f swap <dlist-node> dup dup set-next-prev ] keep

basis/formatting/formatting.factor

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,16 @@ IN: formatting
1414
[ ] [ compose ] reduce ; inline
1515

1616
: fix-sign ( string -- string )
17-
dup CHAR: 0 swap index 0 =
18-
[ dup 0 swap [ [ CHAR: 0 = not ] keep digit? and ] find-from
19-
[ dup 1 - rot dup [ nth ] dip swap
20-
{
21-
{ CHAR: - [ [ 1 - ] dip remove-nth "-" prepend ] }
22-
{ CHAR: + [ [ 1 - ] dip remove-nth "+" prepend ] }
23-
[ drop nip ]
17+
dup first CHAR: 0 = [
18+
dup [ [ CHAR: 0 = not ] [ digit? ] bi and ] find
19+
[
20+
1 - swap 2dup nth {
21+
{ CHAR: - [ remove-nth "-" prepend ] }
22+
{ CHAR: + [ remove-nth "+" prepend ] }
23+
[ drop nip ]
2424
} case
25-
] [ drop ] if
26-
] when ;
25+
] [ drop ] if
26+
] when ;
2727

2828
: >digits ( string -- digits )
2929
[ 0 ] [ string>number ] if-empty ;

basis/heaps/heaps.factor

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ M: heap heap-pop ( heap -- value key )
181181

182182
: heap-pop-all ( heap -- alist )
183183
[ dup heap-empty? not ]
184-
[ dup heap-pop swap 2array ]
184+
[ [ heap-pop ] keep 2array ]
185185
produce nip ;
186186

187187
ERROR: not-a-heap obj ;

basis/help/markup/markup.factor

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ PRIVATE>
267267
] ($subsection) ;
268268

269269
: $vocab-link ( element -- )
270-
check-first dup vocab-name swap ($vocab-link) ;
270+
check-first [ vocab-name ] keep ($vocab-link) ;
271271

272272
: $vocabulary ( element -- )
273273
check-first vocabulary>> [

basis/inverse/inverse.factor

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ DEFER: __
219219
\ first4 [ 4array ] define-inverse
220220

221221
\ prefix \ unclip define-dual
222-
\ suffix [ dup but-last swap last ] define-inverse
222+
\ suffix \ unclip-last define-dual
223223

224224
\ append 1 [ [ ?tail assure ] curry ] define-pop-inverse
225225
\ prepend 1 [ [ ?head assure ] curry ] define-pop-inverse

basis/io/launcher/launcher.factor

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ SYMBOL: +new-session+
5959
+same-group+ >>group ;
6060

6161
: process-started? ( process -- ? )
62-
dup handle>> swap status>> or ;
62+
[ handle>> ] [ status>> ] bi or ;
6363

6464
: process-running? ( process -- ? )
6565
handle>> >boolean ;

basis/math/polynomials/polynomials.factor

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ ALIAS: n*p n*v
3232
2dup [ length ] bi@ + 1 - 2pad-tail ;
3333

3434
: p* ( p q -- r )
35-
2unempty pextend-conv
35+
2unempty pextend-conv
3636
[ drop length [ iota ] keep ]
3737
[ nip <reversed> ]
3838
[ drop ] 2tri

basis/xmode/loader/loader.factor

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ TAG: KEYWORDS parse-rule-tag
7474
! Top-level entry points
7575
: parse-mode-tag ( tag -- rule-sets )
7676
dup "RULES" tags-named [
77-
parse-rules-tag dup name>> swap
77+
parse-rules-tag [ name>> ] keep
7878
] H{ } map>assoc
7979
swap "PROPS" tag-named [
8080
parse-props-tag over values

basis/xmode/marker/marker.factor

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ M: regexp text-matches?
9494

9595
: rule-end-matches? ( rule -- match-count/f )
9696
dup mark-following-rule? [
97-
dup start>> swap can-match-here? 0 and
97+
[ start>> ] keep can-match-here? 0 and
9898
] [
9999
[ end>> dup ] keep can-match-here? [
100100
rest-of-line

basis/xmode/tokens/tokens.factor

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,13 @@ IN: xmode.tokens
77
<<
88
SYMBOL: tokens
99

10-
{ "COMMENT1" "COMMENT2" "COMMENT3" "COMMENT4" "DIGIT" "FUNCTION" "INVALID" "KEYWORD1" "KEYWORD2" "KEYWORD3" "KEYWORD4" "LABEL" "LITERAL1" "LITERAL2" "LITERAL3" "LITERAL4" "MARKUP" "OPERATOR" "END" "NULL" } [
11-
create-in dup define-symbol
12-
dup name>> swap
10+
{
11+
"COMMENT1" "COMMENT2" "COMMENT3" "COMMENT4" "DIGIT"
12+
"FUNCTION" "INVALID" "KEYWORD1" "KEYWORD2" "KEYWORD3"
13+
"KEYWORD4" "LABEL" "LITERAL1" "LITERAL2" "LITERAL3"
14+
"LITERAL4" "MARKUP" "OPERATOR" "END" "NULL"
15+
} [
16+
dup create-in dup define-symbol
1317
] H{ } map>assoc tokens set-global
1418
>>
1519

0 commit comments

Comments
 (0)