! Copyright (C) 2013 Dondy. ! See http://factorcode.org/license.txt for BSD license. USING: kernel math math.functions locals vectors sequences prettyprint ; IN: foobar :: zig ( p1 p2 -- p3 ) p1 first :> x1 p1 last :> y1 p2 first :> x2 p2 last :> y2 V{ } x1 x2 + y1 y2 - + 2 / suffix x2 x1 - y1 y2 + + 2 / suffix ; :: zag ( p1 p2 -- p3 ) p1 first :> x1 p1 last :> y1 p2 first :> x2 p2 last :> y2 V{ } x1 x2 + y1 y2 + - 2 / suffix x1 x2 - y1 y2 + + 2 / suffix ; :: dragon ( p1 p2 p3 n -- p1 p2 ) n 0 = [ V{ p1 p2 } append ] [ V{ } p1 p1 p2 zig p2 n 1 - dragon suffix p2 p2 p3 zag p3 n 1 - dragon suffix append ] if ; : foobar ( -- ) V{ } [let V{ 100 100 } :> p1 V{ 356 100 } :> p2 p1 p1 p2 zig p2 15 dragon ] . ; MAIN: foobar ! throws the following error ! The word main cannot be executed because it failed to compile ! ! Stack effect declaration is wrong ! inferred ( -- x x ) ! declared ( -- ) ! ! Type :help for debugging help. ! :errors - show 2 compiler errors