]> gitweb.factorcode.org Git - factor.git/commitdiff
factor: update download to return path and using lists
authorDoug Coleman <doug.coleman@gmail.com>
Sun, 24 Mar 2024 21:21:30 +0000 (16:21 -0500)
committerDoug Coleman <doug.coleman@gmail.com>
Sun, 24 Mar 2024 22:36:58 +0000 (17:36 -0500)
fix dead url for unixdict.txt

17 files changed:
basis/bootstrap/image/download/download.factor
basis/math/primes/factors/factors.factor
basis/unicode/breaks/breaks-tests.factor
basis/unicode/collation/collation-tests.factor
basis/unicode/collation/collation.factor
basis/unicode/normalize/normalize-tests.factor
basis/unicode/normalize/normalize.factor
extra/build-from-source/build-from-source.factor
extra/bunny/model/model.factor
extra/gpu/demos/bunny/bunny.factor
extra/macho/macho-tests.factor
extra/project-euler/098/098.factor
extra/rosetta-code/anagrams-deranged/anagrams-deranged.factor
extra/rosetta-code/ordered-words/ordered-words.factor
extra/spelling/spelling.factor
extra/tldr/tldr.factor
extra/zealot/factor/factor.factor

index 739b968f356fe240fe3ff9b825bec498cc368e7d..6f440b973225c07d1c20bf5d9f2eb021ae62d69e 100644 (file)
@@ -1,7 +1,8 @@
 ! Copyright (C) 2008, 2010 Slava Pestov.
 ! See https://factorcode.org/license.txt for BSD license.
 USING: assocs bootstrap.image checksums checksums.md5
-http.client io.files kernel math.parser splitting urls ;
+http.client http.download io.files kernel math.parser splitting
+urls ;
 IN: bootstrap.image.download
 
 CONSTANT: download-url URL" https://downloads.factorcode.org/images/master/"
@@ -26,9 +27,8 @@ CONSTANT: download-url URL" https://downloads.factorcode.org/images/master/"
     need-new-image? [ "Boot image corrupt" throw ] when ;
 
 : download-image ( image -- )
-    [ download-url swap >url derive-url download ]
-    [ verify-image ]
-    bi ;
+    [ download-url ] dip >url derive-url
+    download verify-image ;
 
 : maybe-download-image ( image -- ? )
     dup need-new-image? [ download-image t ] [ drop f ] if ;
index 20a485e46fc10ab79c43db098676ea84e407f000..a0626143db578ed0f1dde1c6c8103ebe792e3504 100644 (file)
@@ -2,8 +2,8 @@
 ! See https://factorcode.org/license.txt for BSD license.
 USING: arrays combinators command-line io kernel math
 math.functions math.parser math.primes.pollard-rho-brent
-ranges math.statistics namespaces sequences
-sequences.product sets sorting splitting ;
+math.statistics namespaces ranges sequences sequences.product
+sets sorting splitting ;
 IN: math.primes.factors
 
 : factors ( n -- seq ) pollard-rho-brent-factors ; flushable
index c0954f35450c870a5b6fb7b6b0fb6fa1e5a1122e..2fef15c601d223d29e2762c192c65a67f4746bbb 100644 (file)
@@ -1,6 +1,6 @@
-USING: tools.test unicode sequences math http.client kernel
-splitting unicode.categories io.pathnames io.encodings.utf8
-io.files io.files.temp strings quotations math.parser locals ;
+USING: http.download io.encodings.utf8 io.files io.files.temp
+kernel math.parser quotations sequences splitting strings
+tools.test unicode ;
 IN: unicode.breaks.tests
 
 { "\u001112\u001161\u0011abA\u000300a\r\r\n" }
@@ -21,11 +21,11 @@ IN: unicode.breaks.tests
 
 : grapheme-break-test ( -- filename )
     "https://downloads.factorcode.org/misc/UCD/15.1.0/auxiliary/GraphemeBreakTest.txt"
-    "GraphemeBreakTest-15.1.0.txt" cache-file [ ?download-to ] keep ;
+    "GraphemeBreakTest-15.1.0.txt" cache-file download-to ;
 
 : word-break-test ( -- filename )
     "https://downloads.factorcode.org/misc/UCD/15.1.0/auxiliary/WordBreakTest.txt"
-    "WordBreakTest-15.1.0.txt" cache-file [ ?download-to ] keep ;
+    "WordBreakTest-15.1.0.txt" cache-file download-to ;
 
 : parse-test-file ( file-name -- tests )
     utf8 file-lines
index eb9438a12f9a96b1ee2ab3e9161efd320792dbf3..2cf37e1b1ed2a88857f7e08a3167df1326ac4623 100644 (file)
@@ -1,7 +1,7 @@
 USING: arrays assocs grouping hash-sets http.client
-io.encodings.binary io.encodings.string io.encodings.utf8
-io.files io.files.temp kernel math math.order math.parser
-sequences sets splitting strings tools.test unicode ;
+http.download io.encodings.binary io.encodings.string
+io.encodings.utf8 io.files io.files.temp kernel math math.order
+math.parser sequences sets splitting strings tools.test unicode ;
 IN: unicode.collation.tests
 
 : test-equality ( str1 str2 -- ? ? ? ? )
@@ -19,7 +19,7 @@ IN: unicode.collation.tests
 
 : collation-test-lines ( -- lines )
     "https://downloads.factorcode.org/misc/UCA/15.1.0/CollationTest_SHIFTED.txt"
-    "CollationTest_SHIFTED_15.1.0.txt" cache-file [ ?download-to ] keep
+    "CollationTest_SHIFTED_15.1.0.txt" cache-file download-to
     utf8 file-lines [ "#" head? ] reject harvest ;
 
 : parse-collation-test-shifted ( -- lines )
index a059bb184dfe2fce864319c24da1f48538299bbc..9b5e051ec05344190f65252d1e25141606fc9af5 100644 (file)
@@ -1,9 +1,9 @@
 ! Copyright (C) 2008 Daniel Ehrenberg.
 ! See https://factorcode.org/license.txt for BSD license.
 USING: accessors arrays assocs combinators
-combinators.short-circuit combinators.smart fry kernel make
-math math.order math.parser namespaces sequences
-simple-flat-file splitting strings unicode.data ;
+combinators.short-circuit combinators.smart kernel make math
+math.order math.parser namespaces sequences simple-flat-file
+splitting strings unicode.data ;
 IN: unicode.collation
 
 <PRIVATE
index 98ac3e54081c3f3b886a42fe5b705699bb4f7fa6..3d72ad99e5852776da317293730dfd667e5a8f10 100644 (file)
@@ -1,8 +1,7 @@
-USING: arrays assocs combinators combinators.short-circuit
-grouping http.client io.encodings.utf8 io.files io.files.temp
-io.streams.null kernel locals math math.parser quotations random
-sequences splitting splitting.extras strings tools.test unicode
-unicode.normalize.private ;
+USING: arrays assocs combinators.short-circuit grouping
+http.download io.encodings.utf8 io.files io.files.temp kernel
+math math.parser sequences splitting splitting.extras strings
+tools.test unicode unicode.normalize.private ;
 IN: unicode.normalize.tests
 
 { "ab\u000323\u000302cd" } [ "ab\u000302" "\u000323cd" string-append ] unit-test
@@ -28,7 +27,7 @@ IN: unicode.normalize.tests
 ! Could use simple-flat-file after some cleanup
 : parse-normalization-tests ( -- tests )
     "https://downloads.factorcode.org/misc/UCD/15.1.0/NormalizationTest.txt"
-    "NormalizationTest-15.1.0.txt" cache-file [ ?download-to ] keep
+    "NormalizationTest-15.1.0.txt" cache-file download-to
     utf8 file-lines [ "#" head? ] reject
     [ "@" head? ] split*-when
     2 <groups> [ first2 [ first ] dip 2array ] map
index 0bf4b08c71584f31afbbe0169a90aa68ea62fd97..c5d4dabcb15660bada9d0dfe79b2db250b741808 100644 (file)
@@ -1,9 +1,8 @@
 ! Copyright (C) 2008 Daniel Ehrenberg.
 ! See https://factorcode.org/license.txt for BSD license.
 USING: accessors arrays ascii combinators
-combinators.short-circuit hints kernel make math
-math.order sbufs sequences sorting.insertion strings
-unicode.data vectors ;
+combinators.short-circuit hints kernel make math math.order
+sbufs sequences sorting.insertion strings unicode.data vectors ;
 IN: unicode.normalize
 
 <PRIVATE
index c4f2c29ea94e4310b3437c3664ca4ee93e07dd27..02b5826d790305b673c034572265e91f42186438 100644 (file)
@@ -2,11 +2,12 @@
 ! See https://factorcode.org/license.txt for BSD license.
 USING: accessors arrays assocs calendar calendar.format cli.git
 combinators combinators.short-circuit continuations formatting
-github html.parser html.parser.analyzer http.client io
-io.directories io.encodings.string io.encodings.utf8 io.files
-io.launcher io.pathnames json kernel layouts math namespaces qw
-semver sequences sequences.extras sorting sorting.human
-sorting.specification splitting system unicode ;
+github html.parser html.parser.analyzer http.client
+http.download io io.directories io.encodings.string
+io.encodings.utf8 io.files io.launcher io.pathnames json kernel
+layouts math namespaces qw semver sequences sequences.extras
+sorting sorting.human sorting.specification splitting system
+unicode ;
 IN: build-from-source
 
 INITIALIZED-SYMBOL: use-gitlab-git-uris [ f ]
@@ -184,7 +185,7 @@ ERROR: no-output-file path ;
     ] with-directory ; inline
 
 : ?download ( path -- )
-    dup file-name file-exists? [ drop ] [ download ] if ; inline
+    dup file-name file-exists? [ drop ] [ download drop ] if ; inline
 
 : with-tar-gz ( path quot -- )
     '[
index f7724476a3c3a0cf11620b951f5861b414388eee..fb64d7193d2ee7b57ba1310bfd982b50acbd0e58 100644 (file)
@@ -1,5 +1,5 @@
 USING: accessors alien.c-types alien.data arrays combinators
-destructors http.client io io.encodings.ascii io.files
+destructors http.download io io.encodings.ascii io.files
 io.files.temp kernel math math.parser math.vectors opengl
 opengl.capabilities opengl.demo-support opengl.gl sequences
 specialized-arrays splitting vectors ;
@@ -46,7 +46,7 @@ CONSTANT: model-url
 "https://downloads.factorcode.org/misc/bun_zipper.ply"
 
 : download-bunny ( -- path )
-    model-url model-path [ ?download-to ] keep ;
+    model-url model-path download-to ;
 
 :: (draw-triangle) ( ns vs triple -- )
     triple [| elt |
index dc412f13701afb74cbec6b694bdf96af55e62fd4..97bde0ad8739c1d5381a29a96d375d14619b1a28 100644 (file)
@@ -3,11 +3,11 @@
 USING: accessors alien.c-types arrays classes.struct combinators
 combinators.short-circuit game.loop game.worlds gpu gpu.buffers
 gpu.framebuffers gpu.render gpu.shaders gpu.state gpu.textures
-gpu.util gpu.util.wasd grouping http.client images images.loader
-io io.encodings.ascii io.files io.files.temp kernel literals
-math.parser math.vectors math.vectors.simd method-chains
-namespaces sequences specialized-arrays specialized-vectors
-threads ui.gadgets.worlds ui.pixel-formats ;
+gpu.util gpu.util.wasd grouping http.client http.download images
+images.loader io io.encodings.ascii io.files io.files.temp
+kernel literals math.parser math.vectors math.vectors.simd
+method-chains namespaces sequences specialized-arrays
+specialized-vectors threads ui.gadgets.worlds ui.pixel-formats ;
 FROM: alien.c-types => float ;
 SPECIALIZED-ARRAY: float
 SPECIALIZED-VECTOR: uint
@@ -149,7 +149,7 @@ CONSTANT: bunny-model-url
 "https://downloads.factorcode.org/misc/bun_zipper.ply"
 
 : download-bunny ( -- path )
-    bunny-model-url bunny-model-path [ ?download-to ] keep ;
+    bunny-model-url bunny-model-path download-to ;
 
 : get-bunny-data ( bunny-state -- )
     download-bunny bunny-data
index 00f008ec10ab27f448376830a08180158fb75928..48626fcaf3630bd62ff429cb0a6de14ffc4250db 100644 (file)
@@ -1,8 +1,8 @@
 ! Copyright (C) 2010 Erik Charlebois.
 ! See https://factorcode.org/license.txt for BSD license.
-USING: accessors alien http.client io io.files.temp
+USING: accessors alien http.download io.files.temp
 io.streams.string kernel literals macho multiline sequences
-strings system tools.test urls ;
+system tools.test urls ;
 IN: macho.tests
 
 STRING: validation-output
@@ -24,11 +24,11 @@ STRING: validation-output
 
 : a.macho ( -- path )
     URL" https://downloads.factorcode.org/misc/a.macho"
-    "a.macho" cache-file [ ?download-to ] keep ;
+    "a.macho" cache-file download-to ;
 
 : a2.macho ( -- path )
     URL" https://downloads.factorcode.org/misc/a2.macho"
-    "a2.macho" cache-file [ ?download-to ] keep ;
+    "a2.macho" cache-file download-to ;
 
 cpu ppc? [
     { $ validation-output }
index d43eaf8fb885bfdbacafbf3458d486c56deb6deb..27db0b8cf512f340ca7ce4e108fc4c607cce3210 100644 (file)
@@ -42,7 +42,7 @@ IN: project-euler.098
 
 : wordlist ( -- seq )
     "https://projecteuler.net/project/resources/p098_words.txt"
-    "p098_words.txt" temp-file [ ?download-to ] keep
+    "p098_words.txt" temp-file download-to
     utf8 file-contents "," split [ rest-slice but-last ] map ;
 
 : squarelist ( n -- seq )
index 284e85c4c64b575a9b566962d58a78bab9d64a9e..d65f06a8a99c0d0d4f41317989c169c9200163c2 100644 (file)
@@ -1,6 +1,6 @@
 ! Copyright (c) 2012 Anonymous
 ! See https://factorcode.org/license.txt for BSD license.
-USING: assocs http.client io.encodings.utf8 io.files
+USING: assocs http.download io.encodings.utf8 io.files
 io.files.temp kernel math math.combinatorics sequences sorting
 strings urls ;
 
@@ -15,8 +15,8 @@ IN: rosettacode.anagrams-deranged
 ! in the same position in both words.
 
 ! The task is to use the word list at
-! https://www.puzzlers.org/pub/wordlists/unixdict.txt to find and
-! show the longest deranged anagram.
+! https://raw.githubusercontent.com/quinnj/Rosetta-Julia/master/unixdict.txt
+! to find and show show the longest deranged anagram.
 
 : derangement? ( str1 str2 -- ? ) [ = not ] 2all? ;
 
@@ -41,8 +41,8 @@ IN: rosettacode.anagrams-deranged
     deranged-anagrams [ first length ] sort-by last ;
 
 : default-word-list ( -- path )
-    URL" https://puzzlers.org/pub/wordlists/unixdict.txt"
-    "unixdict.txt" temp-file [ ?download-to ] keep ;
+    URL" https://raw.githubusercontent.com/quinnj/Rosetta-Julia/master/unixdict.txt"
+    "unixdict.txt" temp-file download-to ;
 
 : longest-deranged-anagrams ( -- anagrams )
     default-word-list (longest-deranged-anagrams) ;
index b1ca4c3301d5eab7d2d5739d54135cbd1b8558b6..0ce7c4319e0e2872d27c723cb3f6e34f11e9d229 100644 (file)
@@ -1,8 +1,7 @@
 ! Copyright (c) 2012 Anonymous
 ! See https://factorcode.org/license.txt for BSD license.
-USING: grouping http.client io io.encodings.utf8 io.files
-io.files.temp kernel math sequences sequences.extras
-unicode urls ;
+USING: grouping http.download io io.encodings.utf8 io.files
+io.files.temp math sequences sequences.extras unicode urls ;
 IN: rosetta-code.ordered-words
 
 ! https://rosettacode.org/wiki/Ordered_words
@@ -18,9 +17,9 @@ IN: rosetta-code.ordered-words
 ! this page.
 
 MEMO: word-list ( -- seq )
-    URL" https://puzzlers.org/pub/wordlists/unixdict.txt"
+    URL" https://raw.githubusercontent.com/quinnj/Rosetta-Julia/master/unixdict.txt"
     "unixdict.txt" temp-file
-    [ ?download-to ] [ utf8 file-lines ] bi ;
+    download-to utf8 file-lines ;
 
 : ordered-word? ( word -- ? )
     >lower [ <= ] monotonic? ;
index 3e9f0911322466e2822a93545dfe0d6d9a1f14fb..d48bffdc84ca00ffd987b818cca373039877bbb6 100644 (file)
@@ -1,7 +1,7 @@
 ! Copyright (C) 2010 John Benediktsson
 ! See https://factorcode.org/license.txt for BSD license
 USING: arrays ascii assocs combinators combinators.smart
-http.client io.encodings.ascii io.files io.files.temp kernel
+http.download io.encodings.ascii io.files io.files.temp kernel
 math math.statistics ranges sequences sequences.private sorting
 splitting urls ;
 IN: spelling
@@ -58,7 +58,7 @@ CONSTANT: ALPHABET "abcdefghijklmnopqrstuvwxyz"
 
 MEMO: default-dictionary ( -- counts )
     URL" https://norvig.com/big.txt" "big.txt" temp-file
-    [ ?download-to ] [ load-dictionary ] bi ;
+    download-to load-dictionary ;
 
 : (correct) ( word dictionary -- word/f )
     corrections ?first ;
index a64fbc2c9fb8e2dea465edb81c54cee17761ca15..5fc08b8af525514b82e55f8103a47e2f5760d90c 100644 (file)
@@ -1,7 +1,7 @@
 ! Copyright (C) 2021 John Benediktsson
 ! See https://factorcode.org/license.txt for BSD license
 
-USING: assocs combinators command-line http.client io
+USING: assocs combinators command-line http.download io
 io.directories io.encodings.utf8 io.files io.files.temp
 io.launcher io.pathnames json kernel namespaces regexp sequences
 splitting system urls wrap.strings ;
@@ -26,7 +26,7 @@ CONSTANT: tldr-zip URL" https://tldr-pages.github.io/assets/tldr.zip"
 
 : download-tldr ( -- )
     "tldr" cache-file dup make-directory [
-        tldr-zip "tldr.zip" download-to
+        tldr-zip "tldr.zip" download-to drop
         { "unzip" "tldr.zip" } try-process
     ] with-directory ;
 
index bd13fc93dcfb6255965951f2b6fcabaff24ff59a..dbf172aa47251d8f45ca7789e72371ba909105c0 100644 (file)
@@ -2,13 +2,12 @@
 ! See https://factorcode.org/license.txt for BSD license.
 USING: accessors arrays assocs bootstrap.image calendar cli.git
 combinators combinators.short-circuit concurrency.combinators
-environment formatting http.client io io.directories
-io.encodings.utf8 io.launcher io.pathnames kernel math.parser
-memory modern.paths namespaces parser.notes prettyprint
-regexp.classes sequences sequences.extras sets splitting system
-system-info threads tools.test tools.test.private vocabs
-vocabs.hierarchy vocabs.hierarchy.private vocabs.loader
-vocabs.metadata zealot ;
+environment formatting http.download io io.directories
+io.launcher io.pathnames kernel math.parser memory modern.paths
+namespaces parser.notes prettyprint regexp.classes sequences
+sequences.extras sets splitting system system-info threads
+tools.test tools.test.private vocabs vocabs.hierarchy
+vocabs.hierarchy.private vocabs.loader vocabs.metadata zealot ;
 IN: zealot.factor
 
 ! XXX: Could check if it's a branch instead with a git command
@@ -16,10 +15,10 @@ IN: zealot.factor
     { [ length 40 = ] [ [ hex-digit? ] all? ] } 1&& ;
 
 : download-boot-checksum-branch ( path branch -- )
-    '[ _ "https://downloads.factorcode.org/images/%s/checksums.txt" sprintf download ] with-directory ;
+    '[ _ "https://downloads.factorcode.org/images/%s/checksums.txt" sprintf download drop ] with-directory ;
 
 : download-boot-checksum-git-checksum ( path checksum -- )
-    '[ _ "https://downloads.factorcode.org/images/build/checksums.txt.%s" sprintf download ] with-directory ;
+    '[ _ "https://downloads.factorcode.org/images/build/checksums.txt.%s" sprintf download drop ] with-directory ;
 
 : download-boot-checksums ( path branch/checksum -- )
     dup git-checksum?
@@ -27,7 +26,7 @@ IN: zealot.factor
     [ download-boot-checksum-branch ] if ;
 
 : download-boot-image ( path url -- )
-    '[ _ my-arch-name "boot.%s.image" sprintf download-to ] with-directory ;
+    '[ _ my-arch-name "boot.%s.image" sprintf download-to drop ] with-directory ;
 
 : arch-git-boot-image-path ( arch git-id -- str )
     "https://downloads.factorcode.org/images/build/boot.%s.image.%s" sprintf ;