diff --git a/extra/webapps/wee-url/wee-url.factor b/extra/webapps/wee-url/wee-url.factor index 1d9b5e211b..ee3cd252bc 100644 --- a/extra/webapps/wee-url/wee-url.factor +++ b/extra/webapps/wee-url/wee-url.factor @@ -1,11 +1,10 @@ ! Copyright (C) 2007 Doug Coleman. ! Copyright (C) 2008 Slava Pestov. ! See http://factorcode.org/license.txt for BSD license. -USING: math.ranges sequences random accessors -kernel namespaces fry db.types db.tuples urls validators -html.components html.forms http http.server.dispatchers furnace -furnace.actions furnace.boilerplate furnace.redirection -furnace.utilities continuations ; +USING: accessors continuations db.tuples db.types fry furnace.actions +furnace.boilerplate furnace.redirection furnace.utilities html.forms +http.server.dispatchers kernel math math.ranges random random.data +sequences urls validators ; IN: webapps.wee-url TUPLE: wee-url < dispatcher ; @@ -17,14 +16,8 @@ short-url "SHORT_URLS" { { "url" "URL" TEXT +not-null+ } } define-persistent -: letter-bank ( -- seq ) - CHAR: a CHAR: z [a,b] - CHAR: A CHAR: Z [a,b] - CHAR: 1 CHAR: 0 [a,b] - 3append ; foldable - : random-url ( -- string ) - 1 6 [a,b] random [ letter-bank random ] "" replicate-as ; + 6 random 1 + random-string ; : retry ( quot: ( -- ? ) n -- ) swap [ drop ] prepose attempt-all ; inline