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
parent
f099cd5b4c
commit
baac978767
|
@ -84,8 +84,8 @@ VALUE: mapping
|
|||
|
||||
"vocab:io/encodings/gb18030/gb-18030-2000.xml"
|
||||
ascii <file-reader> xml>gb-data
|
||||
[ ranges-u>gb to: u>gb ] [ ranges-gb>u to: gb>u ] bi
|
||||
>biassoc to: mapping
|
||||
[ ranges-u>gb \ u>gb set-value ] [ ranges-gb>u \ gb>u set-value ] bi
|
||||
>biassoc \ mapping set-value
|
||||
|
||||
: lookup-range ( char -- byte-array )
|
||||
dup u>gb interval-at [
|
||||
|
|
|
@ -13,12 +13,12 @@ VALUE: jis201
|
|||
VALUE: jis208
|
||||
VALUE: jis212
|
||||
|
||||
"vocab:io/encodings/iso2022/201.txt" flat-file>biassoc to: jis201
|
||||
"vocab:io/encodings/iso2022/208.txt" flat-file>biassoc to: jis208
|
||||
"vocab:io/encodings/iso2022/212.txt" flat-file>biassoc to: jis212
|
||||
"vocab:io/encodings/iso2022/201.txt" flat-file>biassoc \ jis201 set-value
|
||||
"vocab:io/encodings/iso2022/208.txt" flat-file>biassoc \ jis208 set-value
|
||||
"vocab:io/encodings/iso2022/212.txt" flat-file>biassoc \ jis212 set-value
|
||||
|
||||
VALUE: ascii
|
||||
128 iota unique >biassoc to: ascii
|
||||
128 iota unique >biassoc \ ascii set-value
|
||||
|
||||
TUPLE: iso2022-state type ;
|
||||
|
||||
|
|
|
@ -36,10 +36,10 @@ TUPLE: jis assoc ;
|
|||
flat-file>biassoc [ nip ] assoc-filter jis boa ;
|
||||
|
||||
"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"
|
||||
make-jis to: shift-jis-table
|
||||
make-jis \ shift-jis-table set-value
|
||||
|
||||
: small? ( char -- ? )
|
||||
! ASCII range or single-byte halfwidth katakana
|
||||
|
|
|
@ -6,8 +6,8 @@ VALUE: x
|
|||
VALUE: y
|
||||
|
||||
: deploy-test-6 ( -- )
|
||||
1 to: x
|
||||
2 to: y
|
||||
1 \ x set-value
|
||||
2 \ y set-value
|
||||
x y + 3 assert= ;
|
||||
|
||||
MAIN: deploy-test-6
|
||||
|
|
|
@ -134,14 +134,14 @@ PRIVATE>
|
|||
|
||||
graphemes init-table table
|
||||
[ make-grapheme-table finish-table ] with-variable
|
||||
to: grapheme-table
|
||||
\ grapheme-table set-value
|
||||
|
||||
! Word breaks
|
||||
|
||||
VALUE: word-break-table
|
||||
|
||||
"vocab:unicode/data/WordBreakProperty.txt" load-interval-file
|
||||
to: word-break-table
|
||||
\ word-break-table set-value
|
||||
|
||||
CONSTANT: wOther 0
|
||||
CONSTANT: wCR 1
|
||||
|
@ -198,7 +198,7 @@ VALUE: word-table
|
|||
|
||||
words init-table table
|
||||
[ make-word-table finish-word-table ] with-variable
|
||||
to: word-table
|
||||
\ word-table set-value
|
||||
|
||||
: word-table-nth ( class1 class2 -- ? )
|
||||
word-table nth nth ;
|
||||
|
|
|
@ -25,7 +25,7 @@ TUPLE: weight primary secondary tertiary ignorable? ;
|
|||
: parse-ducet ( file -- ducet )
|
||||
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
|
||||
: help-one ( assoc key -- )
|
||||
|
|
|
@ -198,14 +198,14 @@ C: <code-point> code-point
|
|||
[ [ set-code-point ] each ] H{ } make-assoc ;
|
||||
|
||||
load-data {
|
||||
[ process-names to: name-map ]
|
||||
[ 13 swap process-data to: simple-lower ]
|
||||
[ 12 swap process-data to: simple-upper ]
|
||||
[ 14 swap process-data simple-upper assoc-union to: simple-title ]
|
||||
[ process-combining to: class-map ]
|
||||
[ process-canonical to: canonical-map to: combine-map ]
|
||||
[ process-compatibility to: compatibility-map ]
|
||||
[ process-category to: category-map ]
|
||||
[ process-names \ name-map set-value ]
|
||||
[ 13 swap process-data \ simple-lower set-value ]
|
||||
[ 12 swap process-data \ simple-upper set-value ]
|
||||
[ 14 swap process-data simple-upper assoc-union \ simple-title set-value ]
|
||||
[ process-combining \ class-map set-value ]
|
||||
[ process-canonical \ canonical-map set-value \ combine-map set-value ]
|
||||
[ process-compatibility \ compatibility-map set-value ]
|
||||
[ process-category \ category-map set-value ]
|
||||
} cleave
|
||||
|
||||
: postprocess-class ( -- )
|
||||
|
@ -215,9 +215,9 @@ load-data {
|
|||
|
||||
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-hook set-global
|
||||
|
|
|
@ -8,7 +8,7 @@ IN: unicode.script
|
|||
VALUE: script-table
|
||||
|
||||
"vocab:unicode/script/Scripts.txt" load-interval-file
|
||||
to: script-table
|
||||
\ script-table set-value
|
||||
|
||||
PRIVATE>
|
||||
|
||||
|
|
|
@ -8,7 +8,6 @@ ARTICLE: "values" "Global values"
|
|||
{ $subsections
|
||||
get-value
|
||||
set-value
|
||||
POSTPONE: to:
|
||||
change-value
|
||||
} ;
|
||||
|
||||
|
@ -17,13 +16,13 @@ ABOUT: "values"
|
|||
HELP: VALUE:
|
||||
{ $syntax "VALUE: word" }
|
||||
{ $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
|
||||
{ $example
|
||||
"USING: values math prettyprint ;"
|
||||
"IN: scratchpad"
|
||||
"VALUE: x"
|
||||
"2 2 + to: x"
|
||||
"2 2 + \ x set-value"
|
||||
"x ."
|
||||
"4"
|
||||
}
|
||||
|
@ -37,17 +36,6 @@ HELP: set-value
|
|||
{ $values { "value" "a new value" } { "word" "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
|
||||
{ $values { "word" "a value word" } { "quot" { $quotation "( oldvalue -- newvalue )" } } }
|
||||
{ $description "Changes the value using the given quotation." } ;
|
||||
|
|
|
@ -3,7 +3,7 @@ IN: values.tests
|
|||
|
||||
VALUE: foo
|
||||
[ f ] [ foo ] unit-test
|
||||
[ ] [ 3 to: foo ] unit-test
|
||||
[ ] [ 3 \ foo set-value ] unit-test
|
||||
[ 3 ] [ foo ] unit-test
|
||||
[ ] [ \ foo [ 1 + ] change-value ] unit-test
|
||||
[ 4 ] [ foo ] unit-test
|
||||
|
|
|
@ -43,10 +43,6 @@ M: value-word definition drop f ;
|
|||
: set-value ( value word -- )
|
||||
def>> first obj<< ;
|
||||
|
||||
SYNTAX: to:
|
||||
scan-word literalize suffix!
|
||||
\ set-value suffix! ;
|
||||
|
||||
: get-value ( word -- value )
|
||||
def>> first obj>> ;
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ VALUE: html-entities
|
|||
read-entities-file
|
||||
] map first3 assoc-union assoc-union ;
|
||||
|
||||
get-html to: html-entities
|
||||
get-html \ html-entities set-value
|
||||
|
||||
: with-html-entities ( quot -- )
|
||||
html-entities swap with-entities ; inline
|
||||
|
|
|
@ -61,8 +61,8 @@ VALUE: selected-file
|
|||
VALUE: translation-step
|
||||
VALUE: rotation-step
|
||||
|
||||
3 to: translation-step
|
||||
5 to: rotation-step
|
||||
3 \ translation-step set-value
|
||||
5 \ rotation-step set-value
|
||||
|
||||
VAR: selected-file-model
|
||||
VAR: observer3d
|
||||
|
|
|
@ -48,10 +48,10 @@ VALUE: VERY-SMALL-NUM
|
|||
VALUE: ZERO-VALUE
|
||||
VALUE: MAX-FACE-PER-CORNER
|
||||
|
||||
t to: remove-hidden-solids?
|
||||
0.0000001 to: VERY-SMALL-NUM
|
||||
0.0000001 to: ZERO-VALUE
|
||||
4 to: MAX-FACE-PER-CORNER
|
||||
t \ remove-hidden-solids? set-value
|
||||
0.0000001 \ VERY-SMALL-NUM set-value
|
||||
0.0000001 \ ZERO-VALUE set-value
|
||||
4 \ MAX-FACE-PER-CORNER set-value
|
||||
! -------------------------------------------------------------
|
||||
! sequence complement
|
||||
|
||||
|
|
Loading…
Reference in New Issue