Removing "to:" syntax from values.

Squashed commit of the following:

commit 18fef6bfa59f71dcb63b439f631c735848a9bbbb
Author: John Benediktsson <mrjbq7@gmail.com>
Date:   Mon Sep 26 11:02:26 2011 -0700

    vocabs.metadata: revert mistaken change.

commit 496b103b54034ea953882a039c08847d0eda0bb4
Author: John Benediktsson <mrjbq7@gmail.com>
Date:   Sun Sep 25 19:03:54 2011 -0700

    values: Removing "to:" syntax.
db4
John Benediktsson 2011-09-26 11:08:26 -07:00
parent f099cd5b4c
commit baac978767
14 changed files with 35 additions and 51 deletions

View File

@ -84,8 +84,8 @@ VALUE: mapping
"vocab:io/encodings/gb18030/gb-18030-2000.xml" "vocab:io/encodings/gb18030/gb-18030-2000.xml"
ascii <file-reader> xml>gb-data ascii <file-reader> xml>gb-data
[ ranges-u>gb to: u>gb ] [ ranges-gb>u to: gb>u ] bi [ ranges-u>gb \ u>gb set-value ] [ ranges-gb>u \ gb>u set-value ] bi
>biassoc to: mapping >biassoc \ mapping set-value
: lookup-range ( char -- byte-array ) : lookup-range ( char -- byte-array )
dup u>gb interval-at [ dup u>gb interval-at [

View File

@ -13,12 +13,12 @@ VALUE: jis201
VALUE: jis208 VALUE: jis208
VALUE: jis212 VALUE: jis212
"vocab:io/encodings/iso2022/201.txt" flat-file>biassoc to: jis201 "vocab:io/encodings/iso2022/201.txt" flat-file>biassoc \ jis201 set-value
"vocab:io/encodings/iso2022/208.txt" flat-file>biassoc to: jis208 "vocab:io/encodings/iso2022/208.txt" flat-file>biassoc \ jis208 set-value
"vocab:io/encodings/iso2022/212.txt" flat-file>biassoc to: jis212 "vocab:io/encodings/iso2022/212.txt" flat-file>biassoc \ jis212 set-value
VALUE: ascii VALUE: ascii
128 iota unique >biassoc to: ascii 128 iota unique >biassoc \ ascii set-value
TUPLE: iso2022-state type ; TUPLE: iso2022-state type ;

View File

@ -36,10 +36,10 @@ TUPLE: jis assoc ;
flat-file>biassoc [ nip ] assoc-filter jis boa ; flat-file>biassoc [ nip ] assoc-filter jis boa ;
"vocab:io/encodings/shift-jis/CP932.txt" "vocab:io/encodings/shift-jis/CP932.txt"
make-jis to: windows-31j-table make-jis \ windows-31j-table set-value
"vocab:io/encodings/shift-jis/sjis-0208-1997-std.txt" "vocab:io/encodings/shift-jis/sjis-0208-1997-std.txt"
make-jis to: shift-jis-table make-jis \ shift-jis-table set-value
: small? ( char -- ? ) : small? ( char -- ? )
! ASCII range or single-byte halfwidth katakana ! ASCII range or single-byte halfwidth katakana

View File

@ -6,8 +6,8 @@ VALUE: x
VALUE: y VALUE: y
: deploy-test-6 ( -- ) : deploy-test-6 ( -- )
1 to: x 1 \ x set-value
2 to: y 2 \ y set-value
x y + 3 assert= ; x y + 3 assert= ;
MAIN: deploy-test-6 MAIN: deploy-test-6

View File

@ -134,14 +134,14 @@ PRIVATE>
graphemes init-table table graphemes init-table table
[ make-grapheme-table finish-table ] with-variable [ make-grapheme-table finish-table ] with-variable
to: grapheme-table \ grapheme-table set-value
! Word breaks ! Word breaks
VALUE: word-break-table VALUE: word-break-table
"vocab:unicode/data/WordBreakProperty.txt" load-interval-file "vocab:unicode/data/WordBreakProperty.txt" load-interval-file
to: word-break-table \ word-break-table set-value
CONSTANT: wOther 0 CONSTANT: wOther 0
CONSTANT: wCR 1 CONSTANT: wCR 1
@ -198,7 +198,7 @@ VALUE: word-table
words init-table table words init-table table
[ make-word-table finish-word-table ] with-variable [ make-word-table finish-word-table ] with-variable
to: word-table \ word-table set-value
: word-table-nth ( class1 class2 -- ? ) : word-table-nth ( class1 class2 -- ? )
word-table nth nth ; word-table nth nth ;

View File

@ -25,7 +25,7 @@ TUPLE: weight primary secondary tertiary ignorable? ;
: parse-ducet ( file -- ducet ) : parse-ducet ( file -- ducet )
data [ [ parse-keys ] [ parse-weight ] bi* ] H{ } assoc-map-as ; data [ [ parse-keys ] [ parse-weight ] bi* ] H{ } assoc-map-as ;
"vocab:unicode/collation/allkeys.txt" parse-ducet to: ducet "vocab:unicode/collation/allkeys.txt" parse-ducet \ ducet set-value
! Fix up table for long contractions ! Fix up table for long contractions
: help-one ( assoc key -- ) : help-one ( assoc key -- )

View File

@ -198,14 +198,14 @@ C: <code-point> code-point
[ [ set-code-point ] each ] H{ } make-assoc ; [ [ set-code-point ] each ] H{ } make-assoc ;
load-data { load-data {
[ process-names to: name-map ] [ process-names \ name-map set-value ]
[ 13 swap process-data to: simple-lower ] [ 13 swap process-data \ simple-lower set-value ]
[ 12 swap process-data to: simple-upper ] [ 12 swap process-data \ simple-upper set-value ]
[ 14 swap process-data simple-upper assoc-union to: simple-title ] [ 14 swap process-data simple-upper assoc-union \ simple-title set-value ]
[ process-combining to: class-map ] [ process-combining \ class-map set-value ]
[ process-canonical to: canonical-map to: combine-map ] [ process-canonical \ canonical-map set-value \ combine-map set-value ]
[ process-compatibility to: compatibility-map ] [ process-compatibility \ compatibility-map set-value ]
[ process-category to: category-map ] [ process-category \ category-map set-value ]
} cleave } cleave
: postprocess-class ( -- ) : postprocess-class ( -- )
@ -215,9 +215,9 @@ load-data {
postprocess-class postprocess-class
load-special-casing to: special-casing load-special-casing \ special-casing set-value
load-properties to: properties load-properties \ properties set-value
[ name>char [ "Invalid character" throw ] unless* ] [ name>char [ "Invalid character" throw ] unless* ]
name>char-hook set-global name>char-hook set-global

View File

@ -8,7 +8,7 @@ IN: unicode.script
VALUE: script-table VALUE: script-table
"vocab:unicode/script/Scripts.txt" load-interval-file "vocab:unicode/script/Scripts.txt" load-interval-file
to: script-table \ script-table set-value
PRIVATE> PRIVATE>

View File

@ -8,7 +8,6 @@ ARTICLE: "values" "Global values"
{ $subsections { $subsections
get-value get-value
set-value set-value
POSTPONE: to:
change-value change-value
} ; } ;
@ -17,13 +16,13 @@ ABOUT: "values"
HELP: VALUE: HELP: VALUE:
{ $syntax "VALUE: word" } { $syntax "VALUE: word" }
{ $values { "word" "a word to be created" } } { $values { "word" "a word to be created" } }
{ $description "Creates a value on the given word, initializing it to hold " { $snippet "f" } ". To get the value, just run the word. To set it, use " { $link POSTPONE: to: } "." } { $description "Creates a value on the given word, initializing it to hold " { $snippet "f" } ". To get the value, just run the word. To set it, use " { $link set-value } "." }
{ $examples { $examples
{ $example { $example
"USING: values math prettyprint ;" "USING: values math prettyprint ;"
"IN: scratchpad" "IN: scratchpad"
"VALUE: x" "VALUE: x"
"2 2 + to: x" "2 2 + \ x set-value"
"x ." "x ."
"4" "4"
} }
@ -37,17 +36,6 @@ HELP: set-value
{ $values { "value" "a new value" } { "word" "a value word" } } { $values { "value" "a new value" } { "word" "a value word" } }
{ $description "Sets a value word." } ; { $description "Sets a value word." } ;
HELP: to:
{ $syntax "... to: value" }
{ $values { "word" "a value word" } }
{ $description "Sets a value word." }
{ $notes
"Note that"
{ $code "foo to: value" }
"is just sugar for"
{ $code "foo \\ value set-value" }
} ;
HELP: change-value HELP: change-value
{ $values { "word" "a value word" } { "quot" { $quotation "( oldvalue -- newvalue )" } } } { $values { "word" "a value word" } { "quot" { $quotation "( oldvalue -- newvalue )" } } }
{ $description "Changes the value using the given quotation." } ; { $description "Changes the value using the given quotation." } ;

View File

@ -3,7 +3,7 @@ IN: values.tests
VALUE: foo VALUE: foo
[ f ] [ foo ] unit-test [ f ] [ foo ] unit-test
[ ] [ 3 to: foo ] unit-test [ ] [ 3 \ foo set-value ] unit-test
[ 3 ] [ foo ] unit-test [ 3 ] [ foo ] unit-test
[ ] [ \ foo [ 1 + ] change-value ] unit-test [ ] [ \ foo [ 1 + ] change-value ] unit-test
[ 4 ] [ foo ] unit-test [ 4 ] [ foo ] unit-test

View File

@ -43,10 +43,6 @@ M: value-word definition drop f ;
: set-value ( value word -- ) : set-value ( value word -- )
def>> first obj<< ; def>> first obj<< ;
SYNTAX: to:
scan-word literalize suffix!
\ set-value suffix! ;
: get-value ( word -- value ) : get-value ( word -- value )
def>> first obj>> ; def>> first obj>> ;

View File

@ -15,7 +15,7 @@ VALUE: html-entities
read-entities-file read-entities-file
] map first3 assoc-union assoc-union ; ] map first3 assoc-union assoc-union ;
get-html to: html-entities get-html \ html-entities set-value
: with-html-entities ( quot -- ) : with-html-entities ( quot -- )
html-entities swap with-entities ; inline html-entities swap with-entities ; inline

View File

@ -61,8 +61,8 @@ VALUE: selected-file
VALUE: translation-step VALUE: translation-step
VALUE: rotation-step VALUE: rotation-step
3 to: translation-step 3 \ translation-step set-value
5 to: rotation-step 5 \ rotation-step set-value
VAR: selected-file-model VAR: selected-file-model
VAR: observer3d VAR: observer3d

View File

@ -48,10 +48,10 @@ VALUE: VERY-SMALL-NUM
VALUE: ZERO-VALUE VALUE: ZERO-VALUE
VALUE: MAX-FACE-PER-CORNER VALUE: MAX-FACE-PER-CORNER
t to: remove-hidden-solids? t \ remove-hidden-solids? set-value
0.0000001 to: VERY-SMALL-NUM 0.0000001 \ VERY-SMALL-NUM set-value
0.0000001 to: ZERO-VALUE 0.0000001 \ ZERO-VALUE set-value
4 to: MAX-FACE-PER-CORNER 4 \ MAX-FACE-PER-CORNER set-value
! ------------------------------------------------------------- ! -------------------------------------------------------------
! sequence complement ! sequence complement