extra: use ?download-to in a few more places.

db4
John Benediktsson 2014-06-09 09:18:58 -07:00
parent 9ef4a4aab3
commit d901af14c0
5 changed files with 19 additions and 29 deletions

View File

@ -23,7 +23,7 @@ TUPLE: bunny-world < demo-world model-triangles geom draw-seq draw-n ;
M: bunny-world begin-world
GL_DEPTH_TEST glEnable
0.0 0.0 0.375 set-demo-orientation
maybe-download read-model
download-bunny read-model
[ >>model-triangles ] [ <bunny-geom> >>geom ] bi
dup make-draws >>draw-seq
0 >>draw-n
@ -57,4 +57,4 @@ MAIN-WINDOW: bunny-window {
T{ depth-bits { value 16 } }
} }
{ pref-dim { 640 480 } }
} ;
} ;

View File

@ -43,14 +43,10 @@ IN: bunny.model
: model-path ( -- path ) "bun_zipper.ply" cache-file ;
: model-url ( -- url ) "http://duriansoftware.com/joe/media/bun_zipper.ply" ;
CONSTANT: model-url "http://duriansoftware.com/joe/media/bun_zipper.ply"
: maybe-download ( -- path )
model-path dup exists? [
"Downloading bunny from " write
model-url dup print flush
over download-to
] unless ;
: download-bunny ( -- path )
model-url model-path [ ?download-to ] keep ;
:: (draw-triangle) ( ns vs triple -- )
triple [| elt |

View File

@ -148,10 +148,7 @@ UNIFORM-TUPLE: loading-uniforms
CONSTANT: bunny-model-url "http://duriansoftware.com/joe/media/bun_zipper.ply"
: download-bunny ( -- path )
bunny-model-path dup exists? [
bunny-model-url dup print flush
over download-to
] unless ;
bunny-model-url bunny-model-path [ ?download-to ] keep ;
: get-bunny-data ( bunny-state -- )
download-bunny bunny-data

View File

@ -42,10 +42,8 @@ IN: rosettacode.anagrams-deranged
deranged-anagrams [ first length ] sort-with last ;
: default-word-list ( -- path )
"unixdict.txt" temp-file dup exists? [
URL" http://puzzlers.org/pub/wordlists/unixdict.txt"
over download-to
] unless ;
"unixdict.txt" temp-file [ ?download-to ] keep ;
: longest-deranged-anagrams ( -- anagrams )
default-word-list (longest-deranged-anagrams) ;

View File

@ -18,10 +18,9 @@ IN: rosetta-code.ordered-words
! this page.
MEMO: word-list ( -- seq )
"unixdict.txt" temp-file dup exists? [
URL" http://puzzlers.org/pub/wordlists/unixdict.txt"
over download-to
] unless utf8 file-lines ;
"unixdict.txt" temp-file
[ ?download-to ] [ utf8 file-lines ] bi ;
: ordered-word? ( word -- ? )
>lower [ <= ] monotonic? ;