Merge branch 'master' of git://factorcode.org/git/factor

db4
Doug Coleman 2008-10-02 19:04:05 -05:00
commit ae60340653
54 changed files with 133 additions and 166 deletions

View File

@ -3,4 +3,4 @@ IN: db.tests
{ 1 0 } [ [ drop ] query-each ] must-infer-as
{ 1 1 } [ [ ] query-map ] must-infer-as
{ 2 0 } [ [ ] with-db ] must-infer-as
{ 1 0 } [ [ ] with-db ] must-infer-as

View File

@ -4,7 +4,7 @@ accessors kernel math destructors ;
\ <db-pool> must-infer
{ 2 0 } [ [ ] with-db-pool ] must-infer-as
{ 1 0 } [ [ ] with-db-pool ] must-infer-as
{ 1 0 } [ [ ] with-pooled-db ] must-infer-as
@ -13,7 +13,7 @@ USE: db.sqlite
[ "pool-test.db" temp-file delete-file ] ignore-errors
[ ] [ "pool-test.db" temp-file sqlite-db <db-pool> "pool" set ] unit-test
[ ] [ "pool-test.db" temp-file <sqlite-db> <db-pool> "pool" set ] unit-test
[ ] [ "pool" get expired>> t >>expired drop ] unit-test

View File

@ -1,13 +1,14 @@
! You will need to run 'createdb factor-test' to create the database.
! Set username and password in the 'connect' word.
USING: kernel db.postgresql alien continuations io classes
prettyprint sequences namespaces tools.test db
db.tuples db.types unicode.case ;
db.tuples db.types unicode.case accessors ;
IN: db.postgresql.tests
: test-db ( -- postgresql-db )
{ "localhost" "postgres" "foob" "factor-test" } postgresql-db ;
<postgresql-db>
"localhost" >>host
"postgres" >>username
"thepasswordistrust" >>password
"factor-test" >>database ;
[ ] [ test-db [ ] with-db ] unit-test
@ -92,4 +93,4 @@ IN: db.postgresql.tests
: with-dummy-db ( quot -- )
>r T{ postgresql-db } db r> with-variable ;
[ T{ postgresql-db } db ] dip with-variable ;

View File

@ -4,7 +4,7 @@ continuations db.types db.tuples unicode.case ;
IN: db.sqlite.tests
: db-path "test.db" temp-file ;
: test.db db-path sqlite-db ;
: test.db db-path <sqlite-db> ;
[ ] [ [ db-path delete-file ] ignore-errors ] unit-test

View File

@ -7,7 +7,7 @@ destructors mirrors sets db.types ;
IN: db.tuples
<PRIVATE
! returns a sequence of prepared-statements
HOOK: create-sql-statement db ( class -- object )
HOOK: drop-sql-statement db ( class -- object )
@ -65,6 +65,7 @@ GENERIC: eval-generator ( singleton -- object )
: do-count ( exemplar-tuple statement -- tuples )
[ [ bind-tuple ] [ nip default-query ] 2bi ] with-disposal ;
PRIVATE>

View File

View File

@ -0,0 +1,22 @@
! Copyright (C) 2008 Doug Coleman.
! See http://factorcode.org/license.txt for BSD license.
USING: help.markup help.syntax kernel ;
IN: hexdump
HELP: hexdump.
{ $values { "sequence" "a sequence" } }
{ $description "Converts a sequence to its hexadecimal and ASCII representation sixteen characters at a time and writes it to standard out." } ;
HELP: hexdump
{ $values { "sequence" "a sequence" } { "string" "a string" } }
{ $description "Converts a sequence to its hexadecimal and ASCII representation sixteen characters at a time. Lines are separated by a newline character." }
{ $see-also hexdump. } ;
ARTICLE: "hexdump" "Hexdump"
"The " { $vocab-link "hexdump" } " vocabulary provides a traditional hexdump view of a sequence." $nl
"Write hexdump to string:"
{ $subsection hexdump }
"Write the hexdump to the output stream:"
{ $subsection hexdump. } ;
ABOUT: "hexdump"

View File

@ -1,5 +1,8 @@
USING: arrays io io.streams.string kernel math math.parser namespaces
prettyprint sequences sequences.lib splitting grouping strings ascii ;
! Copyright (C) 2008 Doug Coleman.
! See http://factorcode.org/license.txt for BSD license.
USING: arrays io io.streams.string kernel math math.parser
namespaces prettyprint sequences splitting grouping strings
ascii ;
IN: hexdump
<PRIVATE
@ -21,11 +24,12 @@ IN: hexdump
nl ;
PRIVATE>
: hexdump ( seq -- str )
: hexdump ( sequence -- string )
[
dup length header.
16 <sliced-groups> [ line. ] each-index
] with-string-writer ;
: hexdump. ( seq -- )
: hexdump. ( sequence -- )
hexdump write ;

View File

@ -182,9 +182,11 @@ http.server.dispatchers db.tuples ;
[ stop-this-server "Goodbye" "text/html" <content> ] >>display
"quit" add-responder ;
: test-db "test.db" temp-file <sqlite-db> ;
: test-db-file "test.db" temp-file ;
[ test-db drop delete-file ] ignore-errors
: test-db test-db-file <sqlite-db> ;
[ test-db-file delete-file ] ignore-errors
test-db [
init-furnace-tables

View File

@ -1,4 +1,7 @@
! Copyright (C) 2008 DoDoug Coleman.
! See http://factorcode.org/license.txt for BSD license.
USING: crypto.barrett kernel math namespaces tools.test ;
IN: crypto.barrett.tests
[ HEX: 1f63edfb7e838622c7412eafaf0439cf0cdf3aae8bdd09e2de69b509a53883a83560d5ce50ea039e4 ] [ HEX: 827c67f31b2b46afa49ed95d7f7a3011e5875f7052d4c55437ce726d3c6ce0dc9c445fda63b6dc4e 16 barrett-mu ] unit-test

View File

@ -1,14 +1,12 @@
! Copyright (C) 2008 Doug Coleman.
! See http://factorcode.org/license.txt for BSD license.
USING: kernel math math.functions ;
IN: crypto.barrett
: barrett-mu ( n size -- mu )
#! Calculates Barrett's reduction parameter mu
#! size = word size in bits (8, 16, 32, 64, ...)
! over log2 1+ over / 2 * >r 2 swap ^ r> ^ swap / floor ;
[
[ log2 1+ ] [ / 2 * ] bi*
] [
2^ rot ^ swap /i
] 2bi ;
[ [ log2 1+ ] [ / 2 * ] bi* ]
[ 2^ rot ^ swap /i ] 2bi ;

View File

@ -1,17 +0,0 @@
USING: arrays kernel io io.binary sbufs splitting grouping
strings sequences namespaces math math.parser parser
hints math.bitwise assocs ;
IN: crypto.common
: (nth-int) ( string n -- int )
2 shift dup 4 + rot <slice> ; inline
: nth-int ( string n -- int ) (nth-int) le> ; inline
: update ( num var -- ) [ w+ ] change ; inline
SYMBOL: big-endian?
: mod-nth ( n seq -- elt )
#! 5 "abcd" -> b
[ length mod ] [ nth ] bi ;

View File

@ -1,4 +1,4 @@
USING: arrays combinators crypto.common checksums checksums.md5
USING: arrays combinators checksums checksums.md5
checksums.sha1 checksums.md5.private io io.binary io.files
io.streams.byte-array kernel math math.vectors memoize sequences
io.encodings.binary ;

View File

@ -1,40 +0,0 @@
USING: kernel math math-contrib sequences namespaces errors
hashtables words arrays parser compiler syntax io ;
IN: crypto
: make-bits ( quot numbits -- n | quot: -- 0/1 )
0 -rot [ drop dup call rot 1 shift bitor swap ] each drop ;
: random-bytes ( m -- n )
>r [ 2 random ] r> 8 * make-bits ;
! DEFER: random-bits
: add-bit ( bit integer -- integer ) 1 shift bitor ;
: append-bits ( inta intb nbits -- int ) swapd shift bitor ;
: large-random-bits ( n -- int )
#! random number with high bit and low bit enabled (odd)
2 swap ^ [ random ] keep -1 shift 1 bitor bitor ;
! : next-double ( -- f ) 53 random-bits 9007199254740992 /f ;
: 0count ( integer -- n ) 0 swap [ 0 = [ 1+ ] when ] each-bit ;
: 1count ( integer -- n ) 0 swap [ 1 = [ 1+ ] when ] each-bit ;
: bit-reverse-table
{
HEX: 00 HEX: 80 HEX: 40 HEX: C0 HEX: 20 HEX: A0 HEX: 60 HEX: E0 HEX: 10 HEX: 90 HEX: 50 HEX: D0 HEX: 30 HEX: B0 HEX: 70 HEX: F0
HEX: 08 HEX: 88 HEX: 48 HEX: C8 HEX: 28 HEX: A8 HEX: 68 HEX: E8 HEX: 18 HEX: 98 HEX: 58 HEX: D8 HEX: 38 HEX: B8 HEX: 78 HEX: F8
HEX: 04 HEX: 84 HEX: 44 HEX: C4 HEX: 24 HEX: A4 HEX: 64 HEX: E4 HEX: 14 HEX: 94 HEX: 54 HEX: D4 HEX: 34 HEX: B4 HEX: 74 HEX: F4
HEX: 0C HEX: 8C HEX: 4C HEX: CC HEX: 2C HEX: AC HEX: 6C HEX: EC HEX: 1C HEX: 9C HEX: 5C HEX: DC HEX: 3C HEX: BC HEX: 7C HEX: FC
HEX: 02 HEX: 82 HEX: 42 HEX: C2 HEX: 22 HEX: A2 HEX: 62 HEX: E2 HEX: 12 HEX: 92 HEX: 52 HEX: D2 HEX: 32 HEX: B2 HEX: 72 HEX: F2
HEX: 0A HEX: 8A HEX: 4A HEX: CA HEX: 2A HEX: AA HEX: 6A HEX: EA HEX: 1A HEX: 9A HEX: 5A HEX: DA HEX: 3A HEX: BA HEX: 7A HEX: FA
HEX: 06 HEX: 86 HEX: 46 HEX: C6 HEX: 26 HEX: A6 HEX: 66 HEX: E6 HEX: 16 HEX: 96 HEX: 56 HEX: D6 HEX: 36 HEX: B6 HEX: 76 HEX: F6
HEX: 0E HEX: 8E HEX: 4E HEX: CE HEX: 2E HEX: AE HEX: 6E HEX: EE HEX: 1E HEX: 9E HEX: 5E HEX: DE HEX: 3E HEX: BE HEX: 7E HEX: FE
HEX: 01 HEX: 81 HEX: 41 HEX: C1 HEX: 21 HEX: A1 HEX: 61 HEX: E1 HEX: 11 HEX: 91 HEX: 51 HEX: D1 HEX: 31 HEX: B1 HEX: 71 HEX: F1
HEX: 09 HEX: 89 HEX: 49 HEX: C9 HEX: 29 HEX: A9 HEX: 69 HEX: E9 HEX: 19 HEX: 99 HEX: 59 HEX: D9 HEX: 39 HEX: B9 HEX: 79 HEX: F9
HEX: 05 HEX: 85 HEX: 45 HEX: C5 HEX: 25 HEX: A5 HEX: 65 HEX: E5 HEX: 15 HEX: 95 HEX: 55 HEX: D5 HEX: 35 HEX: B5 HEX: 75 HEX: F5
HEX: 0D HEX: 8D HEX: 4D HEX: CD HEX: 2D HEX: AD HEX: 6D HEX: ED HEX: 1D HEX: 9D HEX: 5D HEX: DD HEX: 3D HEX: BD HEX: 7D HEX: FD
HEX: 03 HEX: 83 HEX: 43 HEX: C3 HEX: 23 HEX: A3 HEX: 63 HEX: E3 HEX: 13 HEX: 93 HEX: 53 HEX: D3 HEX: 33 HEX: B3 HEX: 73 HEX: F3
HEX: 0B HEX: 8B HEX: 4B HEX: CB HEX: 2B HEX: AB HEX: 6B HEX: EB HEX: 1B HEX: 9B HEX: 5B HEX: DB HEX: 3B HEX: BB HEX: 7B HEX: FB
HEX: 07 HEX: 87 HEX: 47 HEX: C7 HEX: 27 HEX: A7 HEX: 67 HEX: E7 HEX: 17 HEX: 97 HEX: 57 HEX: D7 HEX: 37 HEX: B7 HEX: 77 HEX: F7
HEX: 0F HEX: 8F HEX: 4F HEX: CF HEX: 2F HEX: AF HEX: 6F HEX: EF HEX: 1F HEX: 9F HEX: 5F HEX: DF HEX: 3F HEX: BF HEX: 7F HEX: FF
} ; inline

View File

@ -1,4 +1,5 @@
USING: kernel math namespaces crypto.rsa tools.test ;
IN: crypto.rsa.tests
[ 123456789 ] [ 128 generate-rsa-keypair 123456789 over rsa-encrypt swap rsa-decrypt ] unit-test
[ 123456789 ] [ 129 generate-rsa-keypair 123456789 over rsa-encrypt swap rsa-decrypt ] unit-test

View File

@ -1,3 +1,5 @@
! Copyright (C) 2008 Doug Coleman.
! See http://factorcode.org/license.txt for BSD license.
USING: math.miller-rabin kernel math math.functions namespaces
sequences accessors ;
IN: crypto.rsa

View File

@ -1 +1 @@
Cryptographic algorithms implemented in Factor, such as MD5 and SHA1
HMAC, XOR, Barrett, RSA, Timing

View File

@ -2,23 +2,24 @@ USING: continuations crypto.xor kernel strings tools.test ;
IN: crypto.xor.tests
! No key
[ "" dup xor-crypt ] [ T{ no-xor-key f } = ] must-fail-with
[ { } dup xor-crypt ] [ T{ no-xor-key f } = ] must-fail-with
[ V{ } dup xor-crypt ] [ T{ no-xor-key f } = ] must-fail-with
[ "" "asdf" dupd xor-crypt xor-crypt ] [ T{ no-xor-key f } = ] must-fail-with
[ "" dup xor-crypt ] [ T{ empty-xor-key } = ] must-fail-with
[ { } dup xor-crypt ] [ T{ empty-xor-key } = ] must-fail-with
[ V{ } dup xor-crypt ] [ T{ empty-xor-key } = ] must-fail-with
[ "" "asdf" dupd xor-crypt xor-crypt ] [ T{ empty-xor-key } = ] must-fail-with
! a xor a = 0
[ "\0\0\0\0\0\0\0" ] [ "abcdefg" dup xor-crypt ] unit-test
[ { 15 15 15 15 } ] [ { 10 10 10 10 } { 5 5 5 5 } xor-crypt ] unit-test
[ "asdf" ] [ "key" "asdf" dupd xor-crypt xor-crypt >string ] unit-test
[ "" ] [ "key" "" xor-crypt >string ] unit-test
[ "asdf" ] [ "asdf" "key" [ xor-crypt ] [ xor-crypt ] bi >string ] unit-test
[ "" ] [ "" "key" xor-crypt >string ] unit-test
[ "a longer message...!" ] [
"."
"a longer message...!" dupd xor-crypt xor-crypt >string
"a longer message...!"
"." [ xor-crypt ] [ xor-crypt ] bi >string
] unit-test
[ "a longer message...!" ] [
"a longer message...!"
"a very long key, longer than the message even."
"a longer message...!" dupd xor-crypt xor-crypt >string
[ xor-crypt ] [ xor-crypt ] bi >string
] unit-test

View File

@ -1,8 +1,12 @@
USING: crypto.common kernel math sequences ;
! Copyright (C) 2008 Doug Coleman.
! See http://factorcode.org/license.txt for BSD license.
USING: kernel math sequences fry ;
IN: crypto.xor
ERROR: no-xor-key ;
: mod-nth ( n seq -- elt ) [ length mod ] [ nth ] bi ;
: xor-crypt ( key seq -- seq' )
over empty? [ no-xor-key ] when
dup length rot [ mod-nth bitxor ] curry 2map ;
ERROR: empty-xor-key ;
: xor-crypt ( seq key -- seq' )
dup empty? [ empty-xor-key ] when
[ dup length ] dip '[ _ mod-nth bitxor ] 2map ;

View File

@ -1,4 +1,4 @@
USING: words kernel sequences combinators.lib locals
USING: words kernel sequences locals
locals.private accessors parser namespaces continuations
summary definitions generalizations arrays ;
IN: descriptive

View File

@ -1,7 +1,7 @@
! Copyright (C) 2007 Daniel Ehrenberg
! See http://factorcode.org/license.txt for BSD license.
USING: xml kernel sequences xml.utilities combinators.lib
math xml.data arrays assocs xml.generator xml.writer namespaces
USING: xml kernel sequences xml.utilities math xml.data
arrays assocs xml.generator xml.writer namespaces
make math.parser io accessors ;
IN: faq

View File

@ -1 +0,0 @@
Doug Coleman

View File

@ -1,12 +0,0 @@
USING: help.markup help.syntax kernel ;
IN: hexdump
HELP: hexdump.
{ $values { "seq" "a sequence" } }
{ $description "Converts a sequence to its hexadecimal and ASCII representation sixteen characters at a time and writes it to standard out." } ;
HELP: hexdump
{ $values { "seq" "a sequence" } { "str" "a string" } }
{ $description "Converts a sequence to its hexadecimal and ASCII representation sixteen characters at a time. Lines are separated by a newline character." }
{ $see-also hexdump. } ;

View File

@ -1,14 +1,16 @@
! Copyright (C) 2008 Doug Coleman.
! See http://factorcode.org/license.txt for BSD license.
USING: io.files kernel sequences accessors
dlists deques arrays sequences.lib ;
dlists deques arrays ;
IN: io.paths
TUPLE: directory-iterator path bfs queue ;
: qualified-directory ( path -- seq )
dup directory [ first2 >r append-path r> 2array ] with map ;
dup directory [ first2 [ append-path ] dip 2array ] with map ;
: push-directory ( path iter -- )
>r qualified-directory r> [
[ qualified-directory ] dip [
dup queue>> swap bfs>>
[ push-front ] [ push-back ] if
] curry each ;
@ -24,27 +26,24 @@ TUPLE: directory-iterator path bfs queue ;
] if ;
: iterate-directory ( iter quot -- obj )
2dup >r >r >r next-file dup [
r> call dup [
r> r> 2drop
] [
drop r> r> iterate-directory
] if
over next-file [
over call
[ 2drop ] [ iterate-directory ] if
] [
drop r> r> r> 3drop f
] if ; inline
2drop f
] if* ; inline recursive
: find-file ( path bfs? quot -- path/f )
>r <directory-iterator> r>
[ <directory-iterator> ] dip
[ keep and ] curry iterate-directory ; inline
: each-file ( path bfs? quot -- )
>r <directory-iterator> r>
[ <directory-iterator> ] dip
[ f ] compose iterate-directory drop ; inline
: find-all-files ( path bfs? quot -- paths )
>r <directory-iterator> r>
pusher >r [ f ] compose iterate-directory drop r> ; inline
[ <directory-iterator> ] dip
pusher [ [ f ] compose iterate-directory drop ] dip ; inline
: recursive-directory ( path bfs? -- paths )
[ ] accumulator >r each-file r> ;
[ ] accumulator [ each-file ] dip ;

View File

@ -1,8 +1,8 @@
! Copyright (C) 2008 James Cash
! See http://factorcode.org/license.txt for BSD license.
USING: kernel peg sequences arrays strings combinators.lib
USING: kernel peg sequences arrays strings
namespaces combinators math locals locals.private locals.backend accessors
vectors syntax lisp.parser assocs parser sequences.lib words
vectors syntax lisp.parser assocs parser words
quotations fry lists summary combinators.short-circuit continuations multiline ;
IN: lisp

View File

@ -1,7 +1,7 @@
! Copyright (C) 2008 James Cash
! See http://factorcode.org/license.txt for BSD license.
USING: kernel peg peg.ebnf math.parser sequences arrays strings
combinators.lib math fry accessors lists combinators.short-circuit ;
math fry accessors lists combinators.short-circuit ;
IN: lisp.parser

View File

@ -1,6 +1,6 @@
USING: io kernel math math.functions math.parser parser lexer
namespaces make sequences splitting grouping combinators
continuations sequences.lib ;
continuations ;
IN: money
: dollars/cents ( dollars -- dollars cents )

View File

@ -1,6 +1,6 @@
USING: arrays combinators kernel lists math math.parser
namespaces parser lexer parser-combinators parser-combinators.simple
promises quotations sequences combinators.lib strings math.order
promises quotations sequences strings math.order
assocs prettyprint.backend memoize unicode.case unicode.categories
combinators.short-circuit accessors make io ;
IN: parser-combinators.regexp

View File

@ -1,6 +1,6 @@
! Copyright (c) 2007 Aaron Schaefer.
! See http://factorcode.org/license.txt for BSD license.
USING: arrays combinators.lib combinators.short-circuit kernel
USING: arrays combinators.short-circuit kernel
math math.ranges namespaces make sequences sorting ;
IN: project-euler.014

View File

@ -1,6 +1,6 @@
! Copyright (c) 2007 Aaron Schaefer.
! See http://factorcode.org/license.txt for BSD license.
USING: kernel math.ranges math.text.english sequences sequences.lib strings
USING: kernel math.ranges math.text.english sequences strings
ascii combinators.short-circuit ;
IN: project-euler.017

View File

@ -1,7 +1,7 @@
! Copyright (c) 2007 Samuel Tardieu, Aaron Schaefer.
! See http://factorcode.org/license.txt for BSD license.
USING: calendar combinators kernel math math.ranges namespaces sequences
sequences.lib math.order ;
math.order ;
IN: project-euler.019
! http://projecteuler.net/index.php?section=problems&id=19
@ -32,7 +32,7 @@ IN: project-euler.019
: euler019 ( -- answer )
1901 2000 [a,b] [
12 [1,b] [ 1 zeller-congruence ] map-with
12 [1,b] [ 1 zeller-congruence ] with map
] map concat [ zero? ] count ;
! [ euler019 ] 100 ave-time

View File

@ -1,7 +1,7 @@
! Copyright (c) 2007 Aaron Schaefer.
! See http://factorcode.org/license.txt for BSD license.
USING: combinators.lib combinators.short-circuit kernel math math.functions
math.ranges namespaces project-euler.common sequences sequences.lib ;
USING: combinators.short-circuit kernel math math.functions
math.ranges namespaces project-euler.common sequences ;
IN: project-euler.021
! http://projecteuler.net/index.php?section=problems&id=21

View File

@ -1,7 +1,7 @@
! Copyright (c) 2007 Aaron Schaefer.
! See http://factorcode.org/license.txt for BSD license.
USING: ascii io.encodings.ascii io.files kernel math project-euler.common
sequences sequences.lib sorting splitting ;
sequences sorting splitting ;
IN: project-euler.022
! http://projecteuler.net/index.php?section=problems&id=22

View File

@ -1,6 +1,6 @@
! Copyright (c) 2008 Aaron Schaefer.
! See http://factorcode.org/license.txt for BSD license.
USING: kernel math math.functions project-euler.common sequences sequences.lib ;
USING: kernel math math.functions project-euler.common sequences ;
IN: project-euler.030
! http://projecteuler.net/index.php?section=problems&id=30

View File

@ -1,6 +1,6 @@
! Copyright (c) 2008 Aaron Schaefer.
! See http://factorcode.org/license.txt for BSD license.
USING: combinators.lib hashtables kernel math math.combinatorics math.functions
USING: hashtables kernel math math.combinatorics math.functions
math.parser math.ranges project-euler.common sequences sets ;
IN: project-euler.032

View File

@ -1,6 +1,6 @@
! Copyright (c) 2008 Aaron Schaefer.
! See http://factorcode.org/license.txt for BSD license.
USING: kernel math.ranges project-euler.common sequences sequences.lib ;
USING: kernel math.ranges project-euler.common sequences ;
IN: project-euler.034
! http://projecteuler.net/index.php?section=problems&id=34

View File

@ -1,7 +1,7 @@
! Copyright (c) 2008 Aaron Schaefer.
! See http://factorcode.org/license.txt for BSD license.
USING: kernel math math.combinatorics math.parser math.primes
project-euler.common sequences sequences.lib sets ;
project-euler.common sequences sets ;
IN: project-euler.035
! http://projecteuler.net/index.php?section=problems&id=35

View File

@ -1,6 +1,6 @@
! Copyright (c) 2008 Aaron Schaefer.
! See http://factorcode.org/license.txt for BSD license.
USING: combinators.lib combinators.short-circuit kernel math.parser math.ranges
USING: combinators.short-circuit kernel math.parser math.ranges
project-euler.common sequences ;
IN: project-euler.036

View File

@ -1,6 +1,6 @@
! Copyright (c) 2008 Aaron Schaefer.
! See http://factorcode.org/license.txt for BSD license.
USING: arrays combinators.lib kernel math math.ranges
USING: arrays kernel math math.ranges
namespaces project-euler.common sequences ;
IN: project-euler.039

View File

@ -1,7 +1,7 @@
! Copyright (c) 2008 Aaron Schaefer.
! See http://factorcode.org/license.txt for BSD license.
USING: ascii io.files kernel math math.functions namespaces make
project-euler.common sequences sequences.lib splitting io.encodings.ascii ;
project-euler.common sequences splitting io.encodings.ascii ;
IN: project-euler.042
! http://projecteuler.net/index.php?section=problems&id=42

View File

@ -1,8 +1,8 @@
! Copyright (c) 2008 Aaron Schaefer.
! See http://factorcode.org/license.txt for BSD license.
USING: combinators.lib combinators.short-circuit hashtables kernel math
USING: combinators.short-circuit hashtables kernel math
math.combinatorics math.parser math.ranges project-euler.common sequences
sequences.lib sorting sets ;
sorting sets ;
IN: project-euler.043
! http://projecteuler.net/index.php?section=problems&id=43

View File

@ -1,6 +1,6 @@
! Copyright (c) 2008 Aaron Schaefer.
! See http://factorcode.org/license.txt for BSD license.
USING: arrays combinators.lib kernel math math.primes math.primes.factors
USING: arrays kernel math math.primes math.primes.factors
math.ranges namespaces sequences ;
IN: project-euler.047

View File

@ -1,6 +1,6 @@
! Copyright (c) 2008 Aaron Schaefer.
! See http://factorcode.org/license.txt for BSD license.
USING: combinators.lib combinators.short-circuit kernel math
USING: combinators.short-circuit kernel math
project-euler.common sequences sorting ;
IN: project-euler.052

View File

@ -1,6 +1,6 @@
! Copyright (c) 2008 Aaron Schaefer.
! See http://factorcode.org/license.txt for BSD license.
USING: kernel math math.parser project-euler.common sequences sequences.lib ;
USING: kernel math math.parser project-euler.common sequences ;
IN: project-euler.055
! http://projecteuler.net/index.php?section=problems&id=55
@ -49,8 +49,8 @@ IN: project-euler.055
: (lychrel?) ( n iteration -- ? )
dup 50 < [
>r add-reverse dup palindrome?
[ r> 2drop f ] [ r> 1+ (lychrel?) ] if
[ add-reverse ] dip over palindrome?
[ 2drop f ] [ 1+ (lychrel?) ] if
] [
2drop t
] if ;

View File

@ -1,7 +1,7 @@
! Copyright (c) 2008 Aaron Schaefer, Slava Pestov.
! See http://factorcode.org/license.txt for BSD license.
USING: arrays ascii assocs hashtables io.encodings.ascii io.files kernel math
math.parser namespaces make sequences sequences.lib sequences.private sorting
math.parser namespaces make sequences sequences.private sorting
splitting grouping strings sets accessors ;
IN: project-euler.059

View File

@ -1,7 +1,7 @@
! Copyright (c) 2008 Aaron Schaefer.
! See http://factorcode.org/license.txt for BSD license.
USING: arrays combinators.lib kernel math math.ranges
namespaces project-euler.common sequences sequences.lib ;
USING: arrays kernel math math.ranges
namespaces project-euler.common sequences ;
IN: project-euler.075
! http://projecteuler.net/index.php?section=problems&id=75

View File

@ -1,6 +1,6 @@
! Copyright (c) 2008 Eric Mertens.
! See http://factorcode.org/license.txt for BSD license.
USING: kernel math math.ranges sequences sequences.lib ;
USING: kernel math math.ranges sequences ;
IN: project-euler.116
! http://projecteuler.net/index.php?section=problems&id=116

View File

@ -1,6 +1,6 @@
! Copyright (c) 2008 Eric Mertens.
! See http://factorcode.org/license.txt for BSD license.
USING: kernel math math.functions sequences sequences.lib ;
USING: kernel math math.functions sequences ;
IN: project-euler.148
! http://projecteuler.net/index.php?section=problems&id=148

View File

@ -1,7 +1,6 @@
! Copyright (c) 2008 Eric Mertens.
! See http://factorcode.org/license.txt for BSD license.
USING: assocs combinators kernel math math.order namespaces sequences
sequences.lib ;
USING: assocs combinators kernel math math.order namespaces sequences ;
IN: project-euler.151
! http://projecteuler.net/index.php?section=problems&id=151

View File

@ -1,5 +1,5 @@
USING: circular disjoint-sets kernel math math.ranges
sequences sequences.lib ;
sequences ;
IN: project-euler.186
: (generator) ( k -- n )

View File

@ -1,6 +1,6 @@
! Copyright (c) 2008 Eric Mertens.
! See http://factorcode.org/license.txt for BSD license.
USING: kernel sequences sequences.lib math math.functions math.ranges locals ;
USING: kernel sequences math math.functions math.ranges locals ;
IN: project-euler.190
! http://projecteuler.net/index.php?section=problems&id=190

View File

@ -26,7 +26,7 @@ webapps.user-admin
webapps.help ;
IN: websites.concatenative
: test-db ( -- params db ) "resource:test.db" <sqlite-db> ;
: test-db ( -- db ) "resource:test.db" <sqlite-db> ;
: init-factor-db ( -- )
test-db [