From 14d1da94bb5f04211190667852a964405b83b0f1 Mon Sep 17 00:00:00 2001 From: Samuel Tardieu Date: Wed, 17 Mar 2010 10:50:45 +0100 Subject: [PATCH 1/4] Use sets --- extra/astar/astar.factor | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/extra/astar/astar.factor b/extra/astar/astar.factor index 45f8aaa86e..85b3108217 100644 --- a/extra/astar/astar.factor +++ b/extra/astar/astar.factor @@ -1,6 +1,6 @@ ! Copyright (C) 2010 Samuel Tardieu. ! See http://factorcode.org/license.txt for BSD license. -USING: accessors assocs heaps kernel math sequences sets shuffle ; +USING: accessors assocs hash-sets heaps kernel math sequences sets shuffle ; IN: astar ! This implements the A* algorithm. See http://en.wikipedia.org/wiki/A* @@ -24,10 +24,10 @@ TUPLE: (astar) astar goal origin in-open-set open-set ; (add-to-open-set) ; : ?add-to-open-set ( node astar -- ) - 2dup astar>> in-closed-set>> key? [ 2drop ] [ add-to-open-set ] if ; + 2dup astar>> in-closed-set>> in? [ 2drop ] [ add-to-open-set ] if ; : move-to-closed-set ( node astar -- ) - [ astar>> in-closed-set>> conjoin ] [ in-open-set>> delete-at ] 2bi ; + [ astar>> in-closed-set>> adjoin ] [ in-open-set>> delete-at ] 2bi ; : get-first ( astar -- node ) [ open-set>> heap-pop drop dup ] [ move-to-closed-set ] bi ; @@ -58,7 +58,7 @@ TUPLE: (astar) astar goal origin in-open-set open-set ; : (init) ( from to astar -- ) swap >>goal H{ } clone over astar>> (>>g) - H{ } clone over astar>> (>>in-closed-set) + { } over astar>> (>>in-closed-set) H{ } clone >>origin H{ } clone >>in-open-set >>open-set @@ -78,4 +78,4 @@ PRIVATE> astar-simple new swap >>heuristic swap >>cost swap >>neighbours ; : considered ( astar -- considered ) - in-closed-set>> keys ; + in-closed-set>> members ; From 1e4e66d6a2b1154ebbab62bbeaf7b64dd91025fd Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Tue, 23 Mar 2010 04:17:39 -0400 Subject: [PATCH 2/4] vm: another fix --- vm/mach_signal.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vm/mach_signal.cpp b/vm/mach_signal.cpp index 5a96bdaf3f..6295381b1c 100644 --- a/vm/mach_signal.cpp +++ b/vm/mach_signal.cpp @@ -104,7 +104,7 @@ catch_exception_raise (mach_port_t exception_port, mach_msg_type_number_t code_count) { /* 10.6 likes to report exceptions from child processes too. Ignore those */ - if(task != mach_task_self()) return KERN_SUCCESS; + if(task != mach_task_self()) return KERN_FAILURE; /* Get fault information and the faulting thread's register contents.. From f62d414bd15c8d128ce9414e28046e91069ca1c2 Mon Sep 17 00:00:00 2001 From: Samuel Tardieu Date: Tue, 23 Mar 2010 09:30:48 +0100 Subject: [PATCH 3/4] Add some documentation precisions for astar --- extra/astar/astar-docs.factor | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/extra/astar/astar-docs.factor b/extra/astar/astar-docs.factor index d19166c1bf..7c474bdb57 100644 --- a/extra/astar/astar-docs.factor +++ b/extra/astar/astar-docs.factor @@ -62,8 +62,7 @@ HELP: find-path ", or f if no such path exists" } } { $description "Find a path between " { $snippet "start" } " and " { $snippet "target" } - " using the A* algorithm. The " { $snippet "astar" } " tuple must have been previously " - " built using " { $link } "." + " using the A* algorithm." } ; HELP: considered @@ -77,6 +76,7 @@ HELP: considered ARTICLE: "astar" "A* algorithm" "The " { $vocab-link "astar" } " vocabulary implements a graph search algorithm for finding the least-cost path from one node to another." $nl +"The " { $link astar } " tuple may be derived from and its " { $link cost } ", " { $link heuristic } ", and " { $link neighbours } " methods overwritten, or the " { $link } " word can be used to build such an object from quotations." $nl "Make an A* object:" { $subsections } "Find a path between nodes:" From 522f28d5a584415d3583e456a0e877b3afbcfa3c Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Tue, 23 Mar 2010 05:07:44 -0400 Subject: [PATCH 4/4] webapps.planet: wrap feed updating within a with-logging form so that errors fetch-feed don't break everything. Previously if there was an error fetching a feed, the update task would just stop --- extra/webapps/planet/planet.factor | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/extra/webapps/planet/planet.factor b/extra/webapps/planet/planet.factor index eb51acbe1a..a003c8b618 100644 --- a/extra/webapps/planet/planet.factor +++ b/extra/webapps/planet/planet.factor @@ -1,4 +1,4 @@ -! Copyright (C) 2008 Slava Pestov. +! Copyright (C) 2008, 2010 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. USING: kernel accessors sequences sorting math math.order calendar alarms logging concurrency.combinators namespaces @@ -194,4 +194,7 @@ posting "POSTINGS" { planet "planet-common" } >>template ; : start-update-task ( db -- ) - '[ _ [ update-cached-postings ] with-db ] 10 minutes every drop ; + '[ + "webapps.planet" + [ _ [ update-cached-postings ] with-db ] with-logging + ] 10 minutes every drop ;