Web 2.0 style assoc syntax. H{ "foo" => 1 "bar" => { 2 3 } }
parent
d88a89a3a0
commit
ad19fd7cbd
|
@ -0,0 +1 @@
|
|||
Joe Groff
|
|
@ -0,0 +1,15 @@
|
|||
! (c)2009 Joe Groff bsd license
|
||||
USING: help.markup help.syntax multiline ;
|
||||
IN: pair-rocket
|
||||
|
||||
HELP: =>
|
||||
{ $syntax "a => b" }
|
||||
{ $description "Constructs a two-element array from the objects immediately before and after the " { $snippet "=>" } ". This syntax can be used inside sequence and assoc literals." }
|
||||
{ $examples
|
||||
{ $unchecked-example <" USING: pair-rocket prettyprint ;
|
||||
|
||||
H{ "foo" => 1 "bar" => 2 } .
|
||||
"> <" H{ { "foo" 1 } { "bar" 2 } } "> }
|
||||
}
|
||||
;
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
USING: kernel pair-rocket tools.test ;
|
||||
IN: pair-rocket.tests
|
||||
|
||||
[ { "a" 1 } ] [ "a" => 1 ] unit-test
|
||||
[ { { "a" } { 1 } } ] [ { "a" } => { 1 } ] unit-test
|
||||
[ { drop 1 } ] [ drop => 1 ] unit-test
|
||||
|
||||
[ H{ { "zippity" 5 } { "doo" 2 } { "dah" 7 } } ]
|
||||
[ H{ "zippity" => 5 "doo" => 2 "dah" => 7 } ] unit-test
|
|
@ -0,0 +1,6 @@
|
|||
! (c)2009 Joe Groff bsd license
|
||||
USING: arrays kernel parser sequences ;
|
||||
IN: pair-rocket
|
||||
|
||||
SYNTAX: => dup pop scan-object 2array parsed ;
|
||||
|
|
@ -0,0 +1 @@
|
|||
H{ "foo" => 1 "bar" => 2 } style literal syntax
|
Loading…
Reference in New Issue