Contents

Concatenative language

  • ACL
  • Ait
  • Breeze
  • Cat
  • colorForth
  • CoSy
  • Deque
  • Elymas
  • Enchilada
  • ETAC
  • Factor
  • Forth
  • Freelang
  • Gershwin
  • Joy
  • Kitten
  • Lviv
  • min
  • mjoy
  • Mlatu
  • Om
  • Onyx
  • Plorth
  • Popr
  • PostScript
  • Quackery
  • r3
  • Raven
  • Retro
  • Staapl
  • Stabel
  • Trith
  • Worst
  • xs
  • XY
  • 5th
  • 8th

Other languages

  • APL
  • C++
  • Erlang
  • FP trivia
  • Haskell
  • Io
  • Java
  • JavaScript
  • Lisp
  • ML
  • Oberon
  • RPL
  • Self
  • Slate
  • Smalltalk

Computer Science

  • Type systems
  • Language paradigms
  • Compilers
  • Interpreters
  • Garbage collection

Meta

  • Search
  • Farkup wiki format
  • People
  • Etiquette
  • Sandbox
Front Page All Articles Recent Changes Random Article

Factor/To do/Locals

Locals are a leaky abstraction. The leaks should be fixed as much as possible. [factor{! Fry and locals

 quot } 1&& ; inline
: funny-macro-test ( n -- ? ) [ odd? ] (funny-macro-test) ;

\ funny-macro-test must-infer
[ t ] [ 3 funny-macro-test ] unit-test
[ f ] [ 2 funny-macro-test ] unit-test

! Smart combinators and wlet

:: wlet-&&-test ( a -- ? )
    [wlet | is-integer? [ a integer? ]
            is-even? [ a even? ]
            >10? [ a 10 > ] |
        { [ is-integer? ] [ is-even? ] [ >10? ] } &&
    ] ;

[ f ] [ 1.5 wlet-&&-test ] unit-test
[ f ] [ 3 wlet-&&-test ] unit-test
[ f ] [ 8 wlet-&&-test ] unit-test
[ t ] [ 12 wlet-&&-test ] unit-test

Locals also don't work with [factor{undo}]. On the left hand side, they should bind locals.

This revision created on Sun, 2 Nov 2008 10:27:42 by littledan

Latest Revisions Edit

All content is © 2008-2022 by its respective authors. By adding content to this wiki, you agree to release it under the BSD license.