more use of H{ } make.

db4
John Benediktsson 2012-07-19 11:24:45 -07:00
parent 559b5bfa5b
commit 90d0951ada
13 changed files with 64 additions and 66 deletions

View File

@ -585,14 +585,14 @@ M: quotation '
PRIVATE> PRIVATE>
: make-image ( arch -- ) : make-image ( arch -- )
[ architecture associate H{
parser-quiet? off { parser-quiet? f }
auto-use? off { auto-use? f }
architecture set } assoc-union! [
"resource:/core/bootstrap/stage1.factor" run-file "resource:/core/bootstrap/stage1.factor" run-file
build-image build-image
write-image write-image
] with-scope ; ] with-variables ;
: make-images ( -- ) : make-images ( -- )
images [ make-image ] each ; images [ make-image ] each ;

View File

@ -102,7 +102,7 @@ M: word set-article-parent swap "help-parent" set-word-prop ;
[ prefix 1array ] dip prefix , ; [ prefix 1array ] dip prefix , ;
: ($navigation-table) ( element -- ) : ($navigation-table) ( element -- )
help-path-style get table-style set [ $table ] with-scope ; help-path-style get table-style [ $table ] with-variable ;
: $navigation-table ( topic -- ) : $navigation-table ( topic -- )
[ [

View File

@ -2,7 +2,7 @@
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: io.pathnames io.files io.encodings.ascii USING: io.pathnames io.files io.encodings.ascii
io.encodings.binary io.encodings.utf8 assocs sequences io.encodings.binary io.encodings.utf8 assocs sequences
splitting kernel namespaces fry memoize ; splitting kernel make fry memoize ;
IN: mime.types IN: mime.types
MEMO: mime-db ( -- seq ) MEMO: mime-db ( -- seq )
@ -18,8 +18,8 @@ MEMO: mime-db ( -- seq )
MEMO: mime-types ( -- assoc ) MEMO: mime-types ( -- assoc )
[ [
mime-db [ unclip '[ [ _ ] dip set ] each ] each mime-db [ unclip '[ [ _ ] dip ,, ] each ] each
] H{ } make-assoc ] H{ } make
nonstandard-mime-types assoc-union ; nonstandard-mime-types assoc-union ;
: mime-type ( filename -- mime-type ) : mime-type ( filename -- mime-type )

View File

@ -1,13 +1,13 @@
USING: arrays generic kernel math models namespaces sequences assocs USING: arrays generic kernel math models namespaces sequences assocs
tools.test models.mapping accessors ; tools.test models.mapping accessors make ;
IN: models.mapping.tests IN: models.mapping.tests
! Test mapping ! Test mapping
[ ] [ [ ] [
[ [
1 <model> "one" set 1 <model> "one" ,,
2 <model> "two" set 2 <model> "two" ,,
] H{ } make-assoc ] H{ } make
<mapping> "m" set <mapping> "m" set
] unit-test ] unit-test

View File

@ -19,25 +19,23 @@ SYMBOL: c-object-pointers?
15 nesting-limit set-global 15 nesting-limit set-global
100 length-limit set-global 100 length-limit set-global
10 number-base set-global 10 number-base set-global
string-limit? on t string-limit? set-global
: with-short-limits ( quot -- ) : with-short-limits ( quot -- )
[ H{
1 line-limit set { line-limit 1 }
15 length-limit set { length-limit 15 }
2 nesting-limit set { nesting-limit 2 }
string-limit? on { string-limit? t }
boa-tuples? on { boa-tuples? t }
c-object-pointers? off { c-object-pointers? f }
call } clone swap with-variables ; inline
] with-scope ; inline
: without-limits ( quot -- ) : without-limits ( quot -- )
[ H{
nesting-limit off { nesting-limit f }
length-limit off { length-limit f }
line-limit off { line-limit f }
string-limit? off { string-limit? f }
c-object-pointers? off { c-object-pointers? f }
call } clone swap with-variables ; inline
] with-scope ; inline

View File

@ -101,11 +101,10 @@ SYMBOL: ->
[ [
"Quotation: " write "Quotation: " write
dup [ second ] [ third ] bi remove-breakpoints dup [ second ] [ third ] bi remove-breakpoints
[ H{
3 nesting-limit set { nesting-limit 3 }
100 length-limit set { length-limit 100 }
pprint } clone [ pprint ] with-variables
] with-scope
] with-cell ] with-cell
] with-row ] with-row
dup frame-word? [ dup frame-word? [

View File

@ -70,7 +70,7 @@ M: base64 item>xml
params <XML <methodResponse><-></methodResponse> XML> ; params <XML <methodResponse><-></methodResponse> XML> ;
: return-fault ( fault-code fault-string -- xml ) : return-fault ( fault-code fault-string -- xml )
[ "faultString" set "faultCode" set ] H{ } make-assoc item>xml [ "faultString" ,, "faultCode" ,, ] H{ } make item>xml
<XML <XML
<methodResponse> <methodResponse>
<fault> <fault>

View File

@ -2,7 +2,7 @@
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: kernel namespaces accessors xml.tokenize xml.data assocs USING: kernel namespaces accessors xml.tokenize xml.data assocs
xml.errors xml.char-classes combinators.short-circuit splitting xml.errors xml.char-classes combinators.short-circuit splitting
fry xml.state sequences combinators ascii math ; fry xml.state sequences combinators ascii math make ;
IN: xml.name IN: xml.name
! XML namespace processing: ns = namespace ! XML namespace processing: ns = namespace
@ -15,13 +15,13 @@ SYMBOL: ns-stack
[ [
[ [
swap dup space>> "xmlns" = swap dup space>> "xmlns" =
[ main>> set ] [ main>> ,, ]
[ [
T{ name f "" "xmlns" f } names-match? T{ name f "" "xmlns" f } names-match?
[ "" set ] [ drop ] if [ "" ,, ] [ drop ] if
] if ] if
] assoc-each ] assoc-each
] { } make-assoc f like ; ] { } make f like ;
: add-ns ( name -- ) : add-ns ( name -- )
dup space>> dup ns-stack get assoc-stack dup space>> dup ns-stack get assoc-stack

View File

@ -76,9 +76,9 @@ TUPLE: material
: read-mtl ( file -- material-dictionary ) : read-mtl ( file -- material-dictionary )
[ [
f current-material set f current-material ,,
H{ } clone material-dictionary set H{ } clone material-dictionary ,,
] H{ } make-assoc ] H{ } make
[ [
ascii file-lines [ line>mtl ] each ascii file-lines [ line>mtl ] each
md md
@ -104,7 +104,7 @@ VERTEX-FORMAT: obj-vertex-format
[ 1 - vt get nth ] bi* 2array flatten [ 1 - vt get nth ] bi* 2array flatten
] } ] }
} case ; } case ;
: quad>aos ( x -- y z ) : quad>aos ( x -- y z )
[ 3 head [ triangle>aos 1array ] map ] [ 3 head [ triangle>aos 1array ] map ]
[ [ 2 swap nth ] [ [ 2 swap nth ]

View File

@ -10,9 +10,9 @@ CONSTANT: maximum-translation-size 5120
: parameters>assoc ( text from to -- assoc ) : parameters>assoc ( text from to -- assoc )
"|" glue [ "|" glue [
[ "q" set ] [ "langpair" set ] bi* [ "q" ,, ] [ "langpair" ,, ] bi*
"1.0" "v" set "1.0" "v" ,,
] { } make-assoc ; ] { } make ;
: assoc>query-response ( assoc -- response ) : assoc>query-response ( assoc -- response )
google-translate-url http-post nip ; google-translate-url http-post nip ;

View File

@ -2,7 +2,7 @@
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: accessors fry http.client io io.encodings.utf8 io.files USING: accessors fry http.client io io.encodings.utf8 io.files
kernel mason.common mason.config mason.email mason.twitter kernel mason.common mason.config mason.email mason.twitter
namespaces prettyprint sequences debugger continuations ; namespaces prettyprint sequences debugger continuations make ;
IN: mason.notify IN: mason.notify
: status-notify? ( -- ? ) : status-notify? ( -- ? )
@ -11,14 +11,14 @@ IN: mason.notify
: status-params ( report arg message -- assoc ) : status-params ( report arg message -- assoc )
[ [
short-host-name "host-name" set short-host-name "host-name" ,,
target-cpu get "target-cpu" set target-cpu get "target-cpu" ,,
target-os get "target-os" set target-os get "target-os" ,,
status-secret get "secret" set status-secret get "secret" ,,
[ "report" set ] [ "report" ,, ]
[ "arg" set ] [ "arg" ,, ]
[ "message" set ] tri* [ "message" ,, ] tri*
] H{ } make-assoc ; ] H{ } make ;
: status-notify ( report arg message -- ) : status-notify ( report arg message -- )
status-notify? [ status-notify? [

View File

@ -34,7 +34,7 @@ ERROR: cl-error err ;
: 2info ( handle1 handle2 name info_quot lift_quot -- value ) : 2info ( handle1 handle2 name info_quot lift_quot -- value )
[ 4dup 2info-data-size 2info-data-bytes ] dip call ; inline [ 4dup 2info-data-size 2info-data-bytes ] dip call ; inline
: info-bool ( handle name quot -- ? ) : info-bool ( handle name quot -- ? )
[ uint deref CL_TRUE = ] info ; inline [ uint deref CL_TRUE = ] info ; inline
@ -414,15 +414,16 @@ M: cl-filter-linear filter-mode-constant drop CL_FILTER_LINEAR ;
GENERIC: bind-kernel-arg ( kernel index data -- ) GENERIC: bind-kernel-arg ( kernel index data -- )
M: cl-buffer bind-kernel-arg bind-kernel-arg-buffer ; M: cl-buffer bind-kernel-arg bind-kernel-arg-buffer ;
M: byte-array bind-kernel-arg bind-kernel-arg-data ; M: byte-array bind-kernel-arg bind-kernel-arg-data ;
PRIVATE> PRIVATE>
: with-cl-state ( context/f device/f queue/f quot -- ) : with-cl-state ( context/f device/f queue/f quot -- )
[ [
[ [
[ cl-current-queue set ] when* [ cl-current-queue ,, ] when*
[ cl-current-device set ] when* [ cl-current-device ,, ] when*
[ cl-current-context set ] when* [ cl-current-context ,, ] when*
] 3curry H{ } make-assoc ] 3curry H{ } make
] dip with-variable ; inline ] dip with-variable ; inline
: cl-platforms ( -- platforms ) : cl-platforms ( -- platforms )

View File

@ -1,7 +1,7 @@
! Copyright (C) 2009, 2010 Joe Groff, Slava Pestov. ! Copyright (C) 2009, 2010 Joe Groff, Slava Pestov.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: accessors assocs combinators hashtables http USING: accessors assocs combinators hashtables http
http.client json.reader kernel macros namespaces sequences http.client json.reader kernel macros make namespaces sequences
io.sockets.secure fry oauth urls ; io.sockets.secure fry oauth urls ;
FROM: assocs => change-at ; FROM: assocs => change-at ;
IN: twitter IN: twitter
@ -131,9 +131,9 @@ PRIVATE>
: update-post-data ( update -- assoc ) : update-post-data ( update -- assoc )
[ [
"status" set "status" ,,
twitter-source get "source" set twitter-source get "source" ,,
] H{ } make-assoc ; ] H{ } make ;
: (tweet) ( string -- json ) : (tweet) ( string -- json )
update-post-data "update" status-url update-post-data "update" status-url