Factor/GSoC/2010/Destructuring locals bindingsMentorsTechnical outlineFactor has a 1 2 + :> three ! bind 3 to "three" 3 4 [ + ] [ - ] 2bi :> ( seven negone ) ! bind 7 and -1 to "seven" and "negone" It also provides a mechanism for building datastructures from lexical values using literal syntax: 1 2 + :> three
{ three 4 5 } ! evaluates to { 3 4 5 }The locals syntax currently lacks the ability to destructure aggregates. The syntax could be extended to destructure common classes of Factor aggregates, such as sequences, assocs, and tuples: 3 iota :> { zero one two } ! bind zero, one, and two to 0, 1, and 2image new
RGBA >>component-order
unsigned-char >>component-type
:> T{ image { component-order order } { component-type type } }
! bind "order" to RGBA and "type" to unsigned-char
This revision created on Thu, 4 Mar 2010 00:22:52 by jckarter |
|
|
All content is © 2008-2010 by its respective authors. By adding content to this wiki, you agree to release it under the BSD license. |
|