diff --git a/basis/concurrency/messaging/messaging-docs.factor b/basis/concurrency/messaging/messaging-docs.factor index 1219982f51..6c9e530d9b 100755 --- a/basis/concurrency/messaging/messaging-docs.factor +++ b/basis/concurrency/messaging/messaging-docs.factor @@ -56,19 +56,19 @@ ARTICLE: { "concurrency" "synchronous-sends" } "Synchronous sends" "USING: concurrency.messaging kernel threads ;" ": pong-server ( -- )" " receive >r \"pong\" r> reply-synchronous ;" - "[ pong-server t ] spawn-server" + "[ pong-server t ] \"pong-server\" spawn-server" "\"ping\" swap send-synchronous ." "\"pong\"" } ; ARTICLE: { "concurrency" "exceptions" } "Linked exceptions" "A thread can handle exceptions using the standard Factor exception handling mechanism. If an exception is uncaught the thread will terminate. For example:" -{ $code "[ 1 0 / \"This will not print\" print ] spawn" } +{ $code "[ 1 0 / \"This will not print\" print ] \"division-by-zero\" spawn" } "Processes can be linked so that a parent thread can receive the exception that caused the child thread to terminate. In this way 'supervisor' threades can be created that are notified when child threades terminate and possibly restart them." { $subsection spawn-linked } "This will create a unidirectional link, such that if an uncaught exception causes the child to terminate, the parent thread can catch it:" { $code "[" -" [ 1 0 / \"This will not print\" print ] spawn-linked drop" +" [ 1 0 / \"This will not print\" print ] \"linked-division\" spawn-linked drop" " receive" "] [ \"Exception caught.\" print ] recover" } "Exceptions are only raised in the parent when the parent does a " { $link receive } " or " { $link receive-if } ". This is because the exception is sent from the child to the parent as a message." ; diff --git a/extra/24-game/tags.txt b/extra/24-game/tags.txt new file mode 100644 index 0000000000..cb5fc203e1 --- /dev/null +++ b/extra/24-game/tags.txt @@ -0,0 +1 @@ +demos diff --git a/extra/bubble-chamber/tags.txt b/extra/bubble-chamber/tags.txt new file mode 100644 index 0000000000..cb5fc203e1 --- /dev/null +++ b/extra/bubble-chamber/tags.txt @@ -0,0 +1 @@ +demos diff --git a/extra/cfdg/models/aqua-star/tags.txt b/extra/cfdg/models/aqua-star/tags.txt new file mode 100644 index 0000000000..cb5fc203e1 --- /dev/null +++ b/extra/cfdg/models/aqua-star/tags.txt @@ -0,0 +1 @@ +demos diff --git a/extra/cfdg/models/chiaroscuro/tags.txt b/extra/cfdg/models/chiaroscuro/tags.txt new file mode 100644 index 0000000000..cb5fc203e1 --- /dev/null +++ b/extra/cfdg/models/chiaroscuro/tags.txt @@ -0,0 +1 @@ +demos diff --git a/extra/cfdg/models/flower6/tags.txt b/extra/cfdg/models/flower6/tags.txt new file mode 100644 index 0000000000..cb5fc203e1 --- /dev/null +++ b/extra/cfdg/models/flower6/tags.txt @@ -0,0 +1 @@ +demos diff --git a/extra/cfdg/models/game1-turn6/tags.txt b/extra/cfdg/models/game1-turn6/tags.txt new file mode 100644 index 0000000000..cb5fc203e1 --- /dev/null +++ b/extra/cfdg/models/game1-turn6/tags.txt @@ -0,0 +1 @@ +demos diff --git a/extra/cfdg/models/lesson/tags.txt b/extra/cfdg/models/lesson/tags.txt new file mode 100644 index 0000000000..cb5fc203e1 --- /dev/null +++ b/extra/cfdg/models/lesson/tags.txt @@ -0,0 +1 @@ +demos diff --git a/extra/cfdg/models/rules08/rules08.factor b/extra/cfdg/models/rules08/rules08.factor new file mode 100644 index 0000000000..55f0ddcfea --- /dev/null +++ b/extra/cfdg/models/rules08/rules08.factor @@ -0,0 +1,63 @@ + +USING: namespaces sequences math random-weighted cfdg ; + +IN: cfdg.models.rules08 + +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +: insct ( -- ) + [ 1.5 5.5 size* -1 brightness triangle ] do + 10 + [ [ [ 1 0.9 size* -0.15 y 0.05 brightness ] times 1 5 size* triangle ] do ] + each ; + +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +DEFER: line + +: ligne ( -- ) + { + { 1 [ 1.15 0.8 size* 4.5 y -0.3 b line ] do } + { 0.5 [ ] } + } + call-random-weighted ; + +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +: line ( -- ) [ insct ligne ] recursive ; + +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +: sole ( -- ) + [ + { + { + 1 [ + [ 1 brightness 0.5 saturation ligne ] do + [ 140 r 1 hue sole ] do + ] + } + { 0.01 [ ] } + } + call-random-weighted + ] + recursive ; + +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +: centre ( -- ) + [ 1 b 5 s circle ] do + [ sole ] do ; + +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +: run ( -- ) + [ -1 b ] >background + { -20 40 -20 40 } viewport set + [ centre ] >start-shape + 0.0001 >threshold + cfdg-window ; + +! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + +MAIN: run \ No newline at end of file diff --git a/extra/cfdg/models/rules08/tags.txt b/extra/cfdg/models/rules08/tags.txt new file mode 100644 index 0000000000..cb5fc203e1 --- /dev/null +++ b/extra/cfdg/models/rules08/tags.txt @@ -0,0 +1 @@ +demos diff --git a/extra/cfdg/models/sierpinski/tags.txt b/extra/cfdg/models/sierpinski/tags.txt new file mode 100644 index 0000000000..cb5fc203e1 --- /dev/null +++ b/extra/cfdg/models/sierpinski/tags.txt @@ -0,0 +1 @@ +demos diff --git a/extra/cfdg/models/snowflake/tags.txt b/extra/cfdg/models/snowflake/tags.txt new file mode 100644 index 0000000000..cb5fc203e1 --- /dev/null +++ b/extra/cfdg/models/snowflake/tags.txt @@ -0,0 +1 @@ +demos diff --git a/extra/lsys/ui/tags.txt b/extra/lsys/ui/tags.txt new file mode 100644 index 0000000000..cb5fc203e1 --- /dev/null +++ b/extra/lsys/ui/tags.txt @@ -0,0 +1 @@ +demos diff --git a/extra/springies/models/2snake/tags.txt b/extra/springies/models/2snake/tags.txt new file mode 100644 index 0000000000..cb5fc203e1 --- /dev/null +++ b/extra/springies/models/2snake/tags.txt @@ -0,0 +1 @@ +demos diff --git a/extra/springies/models/2x2snake/tags.txt b/extra/springies/models/2x2snake/tags.txt new file mode 100644 index 0000000000..cb5fc203e1 --- /dev/null +++ b/extra/springies/models/2x2snake/tags.txt @@ -0,0 +1 @@ +demos diff --git a/extra/springies/models/3snake/tags.txt b/extra/springies/models/3snake/tags.txt new file mode 100644 index 0000000000..cb5fc203e1 --- /dev/null +++ b/extra/springies/models/3snake/tags.txt @@ -0,0 +1 @@ +demos diff --git a/extra/springies/models/ball/tags.txt b/extra/springies/models/ball/tags.txt new file mode 100644 index 0000000000..cb5fc203e1 --- /dev/null +++ b/extra/springies/models/ball/tags.txt @@ -0,0 +1 @@ +demos diff --git a/extra/springies/models/belt-tire/tags.txt b/extra/springies/models/belt-tire/tags.txt new file mode 100644 index 0000000000..cb5fc203e1 --- /dev/null +++ b/extra/springies/models/belt-tire/tags.txt @@ -0,0 +1 @@ +demos diff --git a/extra/springies/models/nifty/tags.txt b/extra/springies/models/nifty/tags.txt new file mode 100644 index 0000000000..cb5fc203e1 --- /dev/null +++ b/extra/springies/models/nifty/tags.txt @@ -0,0 +1 @@ +demos diff --git a/extra/springies/models/urchin/tags.txt b/extra/springies/models/urchin/tags.txt new file mode 100644 index 0000000000..cb5fc203e1 --- /dev/null +++ b/extra/springies/models/urchin/tags.txt @@ -0,0 +1 @@ +demos diff --git a/unmaintained/lint/lint.factor b/unmaintained/lint/lint.factor index dcf52f723a..644346d29e 100644 --- a/unmaintained/lint/lint.factor +++ b/unmaintained/lint/lint.factor @@ -1,8 +1,9 @@ ! Copyright (C) 2007 Doug Coleman. ! See http://factorcode.org/license.txt for BSD license. -USING: alien alien.accessors arrays assocs combinators.lib io kernel -macros math namespaces prettyprint quotations sequences -vectors vocabs words html.elements slots.private tar ; +USING: accessors alien alien.accessors arrays assocs +combinators.lib io kernel macros math namespaces prettyprint +quotations sequences vectors vocabs words html.elements sets +slots.private combinators.short-circuit ; IN: lint SYMBOL: def-hash @@ -18,7 +19,7 @@ SYMBOL: def-hash-keys 2drop ] if ; -: more-defs +: more-defs ( -- ) { { [ swap >r swap r> ] -rot } { [ swap swapd ] -rot } @@ -33,6 +34,7 @@ SYMBOL: def-hash-keys { [ 0 = ] zero? } { [ pop drop ] pop* } { [ [ ] if ] when } + { [ f = not ] >boolean } } [ first2 swap add-word-def ] each ; : accessor-words ( -- seq ) @@ -51,33 +53,32 @@ SYMBOL: def-hash-keys { [ get ] [ t ] [ { } ] [ . ] [ drop f ] [ drop ] [ f ] [ first ] [ second ] [ third ] [ fourth ] - [ ">" write-html ] [ throw ] - [ "/>" write-html ] + [ ">" write-html ] [ "/>" write-html ] } ; H{ } clone def-hash set-global -all-words [ dup word-def add-word-def ] each +all-words [ dup def>> add-word-def ] each more-defs ! Remove empty word defs def-hash get-global [ drop empty? not -] assoc-subset +] assoc-filter ! Remove constants [ 1 ] [ drop dup length 1 = swap first number? and not -] assoc-subset +] assoc-filter ! Remove set-alien-cell, etc. [ - drop [ accessor-words swap seq-diff ] keep [ length ] bi@ = -] assoc-subset + drop [ accessor-words diff ] keep [ length ] bi@ = +] assoc-filter ! Remove trivial defs [ drop trivial-defs member? not -] assoc-subset +] assoc-filter ! Remove n m shift defs [ @@ -85,19 +86,19 @@ def-hash get-global [ dup first2 [ number? ] both? swap third \ shift = and not ] [ drop t ] if -] assoc-subset +] assoc-filter ! Remove [ n slot ] [ drop dup length 2 = [ first2 \ slot = swap number? and not ] [ drop t ] if -] assoc-subset def-hash set-global +] assoc-filter def-hash set-global -: find-duplicates +: find-duplicates ( -- seq ) def-hash get-global [ nip length 1 > - ] assoc-subset ; + ] assoc-filter ; def-hash get-global keys def-hash-keys set-global @@ -107,18 +108,18 @@ M: object lint ( obj -- seq ) drop f ; : subseq/member? ( subseq/member seq -- ? ) - { [ 2dup start ] [ 2dup member? ] } || 2nip ; + { [ start ] [ member? ] } 2|| ; M: callable lint ( quot -- seq ) def-hash-keys get [ swap subseq/member? - ] with subset ; + ] with filter ; M: word lint ( word -- seq ) - word-def dup callable? [ lint ] [ drop f ] if ; + def>> dup callable? [ lint ] [ drop f ] if ; : word-path. ( word -- ) - [ word-vocabulary ":" ] keep unparse 3append write nl ; + [ vocabulary>> ":" ] keep unparse 3append write nl ; : (lint.) ( pair -- ) first2 >r word-path. r> [ @@ -135,7 +136,7 @@ M: word lint ( word -- seq ) GENERIC: run-lint ( obj -- obj ) -: (trim-self) +: (trim-self) ( val key -- obj ? ) def-hash get-global at* [ dupd remove empty? not ] [ @@ -143,13 +144,13 @@ GENERIC: run-lint ( obj -- obj ) ] if ; : trim-self ( seq -- newseq ) - [ [ (trim-self) ] subset ] assoc-map ; + [ [ (trim-self) ] filter ] assoc-map ; : filter-symbols ( alist -- alist ) [ nip first dup def-hash get at [ first ] bi@ literalize = not - ] assoc-subset ; + ] assoc-filter ; M: sequence run-lint ( seq -- seq ) [ @@ -157,7 +158,7 @@ M: sequence run-lint ( seq -- seq ) dup lint ] { } map>assoc trim-self - [ second empty? not ] subset + [ second empty? not ] filter filter-symbols ; M: word run-lint ( word -- seq )