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

db4
Joe Groff 2009-09-23 19:42:18 -05:00
commit 0845ffaf39
18 changed files with 109 additions and 69 deletions

View File

@ -251,7 +251,7 @@ ARTICLE: "db-lowlevel-tutorial" "Low-level database tutorial"
{ $subsection sql-query } { $subsection sql-query }
"Here's an example usage where we'll make a book table, insert some objects, and query them." $nl "Here's an example usage where we'll make a book table, insert some objects, and query them." $nl
"First, let's set up a custom combinator for using our database. See " { $link "db-custom-database-combinators" } " for more details." "First, let's set up a custom combinator for using our database. See " { $link "db-custom-database-combinators" } " for more details."
{ $code " { $code """
USING: db.sqlite db io.files io.files.temp ; USING: db.sqlite db io.files io.files.temp ;
: with-book-db ( quot -- ) : with-book-db ( quot -- )
"book.db" temp-file <sqlite-db> swap with-db ; inline" } "book.db" temp-file <sqlite-db> swap with-db ; inline" }
@ -259,16 +259,16 @@ USING: db.sqlite db io.files io.files.temp ;
{ $code " "create table books { $code " "create table books
(id integer primary key, title text, author text, date_published timestamp, (id integer primary key, title text, author text, date_published timestamp,
edition integer, cover_price double, condition text)" edition integer, cover_price double, condition text)"
[ sql-command ] with-book-db" } [ sql-command ] with-book-db""" }
"Time to insert some books:" "Time to insert some books:"
{ $code " { $code """
"insert into books "insert into books
(title, author, date_published, edition, cover_price, condition) (title, author, date_published, edition, cover_price, condition)
values('Factor for Sheeple', 'Mister Stacky Pants', date('now'), 1, 13.37, 'mint')" values('Factor for Sheeple', 'Mister Stacky Pants', date('now'), 1, 13.37, 'mint')"
[ sql-command ] with-book-db" } [ sql-command ] with-book-db""" }
"Now let's select the book:" "Now let's select the book:"
{ $code " { $code """
"select id, title, cover_price from books;" [ sql-query ] with-book-db " } "select id, title, cover_price from books;" [ sql-query ] with-book-db""" }
"Notice that the result of this query is a Factor array containing the database rows as arrays of strings. We would have to convert the " { $snippet "cover_price" } " from a string to a number in order to use it in a calculation." $nl "Notice that the result of this query is a Factor array containing the database rows as arrays of strings. We would have to convert the " { $snippet "cover_price" } " from a string to a number in order to use it in a calculation." $nl
"In conclusion, this method of accessing a database is supported, but it is fairly low-level and generally specific to a single database. The " { $vocab-link "db.tuples" } " vocabulary is a good alternative to writing SQL by hand." ; "In conclusion, this method of accessing a database is supported, but it is fairly low-level and generally specific to a single database. The " { $vocab-link "db.tuples" } " vocabulary is a good alternative to writing SQL by hand." ;
@ -278,13 +278,13 @@ ARTICLE: "db-custom-database-combinators" "Custom database combinators"
"Make a " { $snippet "with-" } " combinator to open and close a database so that resources are not leaked." $nl "Make a " { $snippet "with-" } " combinator to open and close a database so that resources are not leaked." $nl
"SQLite example combinator:" "SQLite example combinator:"
{ $code " { $code """
USING: db.sqlite db io.files io.files.temp ; USING: db.sqlite db io.files io.files.temp ;
: with-sqlite-db ( quot -- ) : with-sqlite-db ( quot -- )
"my-database.db" temp-file <sqlite-db> swap with-db ; inline" } "my-database.db" temp-file <sqlite-db> swap with-db ; inline""" }
"PostgreSQL example combinator:" "PostgreSQL example combinator:"
{ $code " USING: db.postgresql db ; { $code """USING: db.postgresql db ;
: with-postgresql-db ( quot -- ) : with-postgresql-db ( quot -- )
<postgresql-db> <postgresql-db>
"localhost" >>host "localhost" >>host
@ -292,7 +292,7 @@ USING: db.sqlite db io.files io.files.temp ;
"erg" >>username "erg" >>username
"secrets?" >>password "secrets?" >>password
"factor-test" >>database "factor-test" >>database
swap with-db ; inline" swap with-db ; inline"""
} ; } ;
ABOUT: "db" ABOUT: "db"

View File

@ -201,19 +201,19 @@ M: sqlite-db-connection persistent-table ( -- assoc )
: insert-trigger ( -- string ) : insert-trigger ( -- string )
[ [
" """
CREATE TRIGGER fki_${table-name}_${table-id}_${foreign-table-name}_${foreign-table-id}_id CREATE TRIGGER fki_${table-name}_${table-id}_${foreign-table-name}_${foreign-table-id}_id
BEFORE INSERT ON ${table-name} BEFORE INSERT ON ${table-name}
FOR EACH ROW BEGIN FOR EACH ROW BEGIN
SELECT RAISE(ROLLBACK, 'insert on table "${table-name}" violates foreign key constraint "fki_${table-name}_$table-id}_${foreign-table-name}_${foreign-table-id}_id"') SELECT RAISE(ROLLBACK, 'insert on table "${table-name}" violates foreign key constraint "fki_${table-name}_$table-id}_${foreign-table-name}_${foreign-table-id}_id"')
WHERE (SELECT ${foreign-table-id} FROM ${foreign-table-name} WHERE ${foreign-table-id} = NEW.${table-id}) IS NULL; WHERE (SELECT ${foreign-table-id} FROM ${foreign-table-name} WHERE ${foreign-table-id} = NEW.${table-id}) IS NULL;
END; END;
" interpolate """ interpolate
] with-string-writer ; ] with-string-writer ;
: insert-trigger-not-null ( -- string ) : insert-trigger-not-null ( -- string )
[ [
" """
CREATE TRIGGER fki_${table-name}_${table-id}_${foreign-table-name}_${foreign-table-id}_id CREATE TRIGGER fki_${table-name}_${table-id}_${foreign-table-name}_${foreign-table-id}_id
BEFORE INSERT ON ${table-name} BEFORE INSERT ON ${table-name}
FOR EACH ROW BEGIN FOR EACH ROW BEGIN
@ -221,24 +221,24 @@ M: sqlite-db-connection persistent-table ( -- assoc )
WHERE NEW.${table-id} IS NOT NULL WHERE NEW.${table-id} IS NOT NULL
AND (SELECT ${foreign-table-id} FROM ${foreign-table-name} WHERE ${foreign-table-id} = NEW.${table-id}) IS NULL; AND (SELECT ${foreign-table-id} FROM ${foreign-table-name} WHERE ${foreign-table-id} = NEW.${table-id}) IS NULL;
END; END;
" interpolate """ interpolate
] with-string-writer ; ] with-string-writer ;
: update-trigger ( -- string ) : update-trigger ( -- string )
[ [
" """
CREATE TRIGGER fku_${table-name}_${table-id}_${foreign-table-name}_${foreign-table-id}_id CREATE TRIGGER fku_${table-name}_${table-id}_${foreign-table-name}_${foreign-table-id}_id
BEFORE UPDATE ON ${table-name} BEFORE UPDATE ON ${table-name}
FOR EACH ROW BEGIN FOR EACH ROW BEGIN
SELECT RAISE(ROLLBACK, 'update on table "${table-name}" violates foreign key constraint "fku_${table-name}_$table-id}_${foreign-table-name}_${foreign-table-id}_id"') SELECT RAISE(ROLLBACK, 'update on table "${table-name}" violates foreign key constraint "fku_${table-name}_$table-id}_${foreign-table-name}_${foreign-table-id}_id"')
WHERE (SELECT ${foreign-table-id} FROM ${foreign-table-name} WHERE ${foreign-table-id} = NEW.${table-id}) IS NULL; WHERE (SELECT ${foreign-table-id} FROM ${foreign-table-name} WHERE ${foreign-table-id} = NEW.${table-id}) IS NULL;
END; END;
" interpolate """ interpolate
] with-string-writer ; ] with-string-writer ;
: update-trigger-not-null ( -- string ) : update-trigger-not-null ( -- string )
[ [
" """
CREATE TRIGGER fku_${table-name}_${table-id}_${foreign-table-name}_${foreign-table-id}_id CREATE TRIGGER fku_${table-name}_${table-id}_${foreign-table-name}_${foreign-table-id}_id
BEFORE UPDATE ON ${table-name} BEFORE UPDATE ON ${table-name}
FOR EACH ROW BEGIN FOR EACH ROW BEGIN
@ -246,30 +246,30 @@ M: sqlite-db-connection persistent-table ( -- assoc )
WHERE NEW.${table-id} IS NOT NULL WHERE NEW.${table-id} IS NOT NULL
AND (SELECT ${foreign-table-id} FROM ${foreign-table-name} WHERE ${foreign-table-id} = NEW.${table-id}) IS NULL; AND (SELECT ${foreign-table-id} FROM ${foreign-table-name} WHERE ${foreign-table-id} = NEW.${table-id}) IS NULL;
END; END;
" interpolate """ interpolate
] with-string-writer ; ] with-string-writer ;
: delete-trigger-restrict ( -- string ) : delete-trigger-restrict ( -- string )
[ [
" """
CREATE TRIGGER fkd_${table-name}_${table-id}_${foreign-table-name}_${foreign-table-id}_id CREATE TRIGGER fkd_${table-name}_${table-id}_${foreign-table-name}_${foreign-table-id}_id
BEFORE DELETE ON ${foreign-table-name} BEFORE DELETE ON ${foreign-table-name}
FOR EACH ROW BEGIN FOR EACH ROW BEGIN
SELECT RAISE(ROLLBACK, 'delete on table "${foreign-table-name}" violates foreign key constraint "fkd_${table-name}_$table-id}_${foreign-table-name}_${foreign-table-id}_id"') SELECT RAISE(ROLLBACK, 'delete on table "${foreign-table-name}" violates foreign key constraint "fkd_${table-name}_$table-id}_${foreign-table-name}_${foreign-table-id}_id"')
WHERE (SELECT ${foreign-table-id} FROM ${foreign-table-name} WHERE ${foreign-table-id} = OLD.${foreign-table-id}) IS NOT NULL; WHERE (SELECT ${foreign-table-id} FROM ${foreign-table-name} WHERE ${foreign-table-id} = OLD.${foreign-table-id}) IS NOT NULL;
END; END;
" interpolate """ interpolate
] with-string-writer ; ] with-string-writer ;
: delete-trigger-cascade ( -- string ) : delete-trigger-cascade ( -- string )
[
" """
CREATE TRIGGER fkd_${table-name}_${table-id}_${foreign-table-name}_${foreign-table-id}_id CREATE TRIGGER fkd_${table-name}_${table-id}_${foreign-table-name}_${foreign-table-id}_id
BEFORE DELETE ON ${foreign-table-name} BEFORE DELETE ON ${foreign-table-name}
FOR EACH ROW BEGIN FOR EACH ROW BEGIN
DELETE from ${table-name} WHERE ${table-id} = OLD.${foreign-table-id}; DELETE from ${table-name} WHERE ${table-id} = OLD.${foreign-table-id};
END; END;
" interpolate """ interpolate
] with-string-writer ; ] with-string-writer ;
: can-be-null? ( -- ? ) : can-be-null? ( -- ? )

View File

@ -319,7 +319,9 @@ M: lexer-error error-help
M: bad-effect summary M: bad-effect summary
drop "Bad stack effect declaration" ; drop "Bad stack effect declaration" ;
M: bad-escape summary drop "Bad escape code" ; M: bad-escape error.
"Bad escape code: \\" write
char>> 1string print ;
M: bad-literal-tuple summary drop "Bad literal tuple" ; M: bad-literal-tuple summary drop "Bad literal tuple" ;

View File

@ -1,6 +1,6 @@
USING: help.markup help.syntax sequences math math.vectors USING: classes.tuple.private cpu.architecture help.markup
classes.tuple.private help.syntax kernel.private math math.vectors
math.vectors.simd.intrinsics cpu.architecture ; math.vectors.simd.intrinsics sequences ;
IN: math.vectors.simd IN: math.vectors.simd
ARTICLE: "math.vectors.simd.intro" "Introduction to SIMD support" ARTICLE: "math.vectors.simd.intro" "Introduction to SIMD support"

View File

@ -8,17 +8,6 @@ bar
; ;
[ "foo\nbar\n" ] [ test-it ] unit-test [ "foo\nbar\n" ] [ test-it ] unit-test
[ "foo\nbar\n" ] [ <" foo
bar
"> ] unit-test
[ "hello\nworld" ] [ <" hello
world"> ] unit-test
[ "hello" "world" ] [ <" hello"> <" world"> ] unit-test
[ "\nhi" ] [ <"
hi"> ] unit-test
! HEREDOC: ! HEREDOC:

View File

@ -72,6 +72,18 @@ HELP: randomize
} }
{ $description "Randomizes a sequence in-place with the Fisher-Yates algorithm and returns the sequence." } ; { $description "Randomizes a sequence in-place with the Fisher-Yates algorithm and returns the sequence." } ;
HELP: sample
{ $values
{ "seq" sequence } { "n" integer }
{ "seq'" sequence }
}
{ $description "Takes " { $snippet "n" } " samples at random without replacement from a sequence. Throws an error if " { $snippet "n" } " is longer than the sequence." }
{ $examples
{ $unchecked-example "USING: random prettyprint ; { 1 2 3 } 2 sample ."
"{ 3 2 }"
}
} ;
HELP: delete-random HELP: delete-random
{ $values { $values
{ "seq" sequence } { "seq" sequence }
@ -100,6 +112,8 @@ $nl
{ $subsection "random-protocol" } { $subsection "random-protocol" }
"Randomizing a sequence:" "Randomizing a sequence:"
{ $subsection randomize } { $subsection randomize }
"Sampling a sequences:"
{ $subsection sample }
"Deleting a random element from a sequence:" "Deleting a random element from a sequence:"
{ $subsection delete-random } { $subsection delete-random }
"Random numbers with " { $snippet "n" } " bits:" "Random numbers with " { $snippet "n" } " bits:"

View File

@ -25,3 +25,8 @@ IN: random.tests
[ 100 [ { 0 1 } random ] replicate all-equal? ] unit-test [ 100 [ { 0 1 } random ] replicate all-equal? ] unit-test
[ 49 ] [ 50 random-bits* log2 ] unit-test [ 49 ] [ 50 random-bits* log2 ] unit-test
[ { 1 2 } 3 sample ] [ too-many-samples? ] must-fail-with
[ 3 ] [ { 1 2 3 4 } 3 sample prune length ] unit-test
[ 99 ] [ 100 99 sample prune length ] unit-test

View File

@ -1,9 +1,9 @@
! Copyright (C) 2008 Doug Coleman. ! Copyright (C) 2008 Doug Coleman.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: alien.c-types kernel math namespaces sequences USING: accessors alien.c-types assocs byte-arrays byte-vectors
io.backend io.binary combinators system vocabs.loader combinators fry io.backend io.binary kernel locals math
summary math.bitwise byte-vectors fry byte-arrays math.bitwise math.constants math.functions math.ranges
math.ranges math.constants math.functions accessors ; namespaces sequences sets summary system vocabs.loader ;
IN: random IN: random
SYMBOL: system-random-generator SYMBOL: system-random-generator
@ -60,6 +60,25 @@ PRIVATE>
[ [ iota random ] [ 1 - ] bi [ pick exchange ] keep ] [ [ iota random ] [ 1 - ] bi [ pick exchange ] keep ]
while drop ; while drop ;
ERROR: too-many-samples seq n ;
<PRIVATE
:: next-sample ( length n seq hashtable -- elt )
n hashtable key? [
length n 1 + length mod seq hashtable next-sample
] [
n hashtable conjoin
n seq nth
] if ;
PRIVATE>
: sample ( seq n -- seq' )
2dup [ length ] dip < [ too-many-samples ] when
swap [ length ] [ ] bi H{ } clone
'[ _ dup random _ _ next-sample ] replicate ;
: delete-random ( seq -- elt ) : delete-random ( seq -- elt )
[ length random-integer ] keep [ nth ] 2keep delete-nth ; [ length random-integer ] keep [ nth ] 2keep delete-nth ;

View File

@ -1,29 +1,29 @@
! Copyright (C) 2008, 2009 Daniel Ehrenberg, Slava Pestov ! Copyright (C) 2008, 2009 Daniel Ehrenberg, Slava Pestov
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: wrap.strings tools.test multiline ; USING: wrap.strings tools.test ;
IN: wrap.strings.tests IN: wrap.strings.tests
[ [
<" This is a """This is a
long piece long piece
of text of text
that we that we
wish to wish to
word wrap."> word wrap."""
] [ ] [
<" This is a long piece of text that we wish to word wrap."> 10 """This is a long piece of text that we wish to word wrap.""" 10
wrap-string wrap-string
] unit-test ] unit-test
[ [
<" This is a """ This is a
long piece long piece
of text of text
that we that we
wish to wish to
word wrap."> word wrap."""
] [ ] [
<" This is a long piece of text that we wish to word wrap."> 12 """This is a long piece of text that we wish to word wrap.""" 12
" " wrap-indented-string " " wrap-indented-string
] unit-test ] unit-test

View File

@ -54,6 +54,7 @@ $nl
"one two three" " " split "one two three" " " split
[ [XML <item><-></item> XML] ] map [ [XML <item><-></item> XML] ] map
<XML <doc><-></doc> XML> pprint-xml""" <XML <doc><-></doc> XML> pprint-xml"""
"""<?xml version="1.0" encoding="UTF-8"?> """<?xml version="1.0" encoding="UTF-8"?>
<doc> <doc>
<item> <item>
@ -74,7 +75,7 @@ $nl
false [ f ] false [ f ]
url [ URL" http://factorcode.org/" ] url [ URL" http://factorcode.org/" ]
string [ "hello" ] string [ "hello" ]
word [ \ drop ] | word [ \\ drop ] |
<XML <XML
<x <x
number=<-number-> number=<-number->
@ -82,7 +83,9 @@ $nl
url=<-url-> url=<-url->
string=<-string-> string=<-string->
word=<-word-> /> word=<-word-> />
XML> pprint-xml ]""" XML> pprint-xml
]"""
"""<?xml version="1.0" encoding="UTF-8"?> """<?xml version="1.0" encoding="UTF-8"?>
<x number="3" url="http://factorcode.org/" string="hello" word="drop"/>""" } <x number="3" url="http://factorcode.org/" string="hello" word="drop"/>""" }
"XML interpolation can also be used, in conjunction with " { $vocab-link "inverse" } " in pattern matching. For example:" "XML interpolation can also be used, in conjunction with " { $vocab-link "inverse" } " in pattern matching. For example:"
@ -94,7 +97,8 @@ $nl
{ [ [XML <b val='yes'/> XML] ] [ "yes" ] } { [ [XML <b val='yes'/> XML] ] [ "yes" ] }
{ [ [XML <b val=<->/> XML] ] [ "no" prepend ] } { [ [XML <b val=<->/> XML] ] [ "no" prepend ] }
} switch ; } switch ;
[XML <a>pple</a> XML] dispatch write""" "apple" } ; [XML <a>pple</a> XML] dispatch write"""
"apple" } ;
HELP: XML-NS: HELP: XML-NS:
{ $syntax "XML-NS: name http://url" } { $syntax "XML-NS: name http://url" }

View File

@ -52,7 +52,8 @@ HELP: sensitive-tags
{ $example """USING: xml.syntax xml.writer namespaces ; { $example """USING: xml.syntax xml.writer namespaces ;
[XML <html> <head> <title> something</title></head><body><pre>bing [XML <html> <head> <title> something</title></head><body><pre>bing
bang bang
bong</pre></body></html> XML] { "pre" } sensitive-tags [ pprint-xml ] with-variable "} {" bong</pre></body></html> XML] { "pre" } sensitive-tags [ pprint-xml ] with-variable"""
"""
<html> <html>
<head> <head>
<title> <title>

View File

@ -5,7 +5,7 @@ namespaces parser sequences splitting strings arrays
math.order ; math.order ;
IN: strings.parser IN: strings.parser
ERROR: bad-escape ; ERROR: bad-escape char ;
: escape ( escape -- ch ) : escape ( escape -- ch )
H{ H{
@ -19,7 +19,7 @@ ERROR: bad-escape ;
{ CHAR: 0 CHAR: \0 } { CHAR: 0 CHAR: \0 }
{ CHAR: \\ CHAR: \\ } { CHAR: \\ CHAR: \\ }
{ CHAR: \" CHAR: \" } { CHAR: \" CHAR: \" }
} at [ bad-escape ] unless* ; } ?at [ bad-escape ] unless ;
SYMBOL: name>char-hook SYMBOL: name>char-hook

View File

@ -530,17 +530,19 @@ HELP: CHAR:
} ; } ;
HELP: " HELP: "
{ $syntax "\"string...\"" } { $syntax "\"string...\"" "\"\"\"string...\"\"\"" }
{ $syntax "\"\"\"string...\"\"\"" }
{ $values { "string" "literal and escaped characters" } } { $values { "string" "literal and escaped characters" } }
{ $description "Reads from the input string until the next occurrence of " { $link POSTPONE: " } " or " { $snippet "\"\"\"" } ", and appends the resulting string to the parse tree. String literals can span multiple lines. For strings beginning with a single double-quote, the " { $link POSTPONE: " } " character and various other special characters can be read by inserting " { $link "escape" } ". For triple quoted strings, the double-quote character does not require escaping." } { $description "Reads from the input string until the next occurrence of " { $snippet "\"" } " or " { $snippet "\"\"\"" } ", and appends the resulting string to the parse tree. String literals can span multiple lines. Various special characters can be read by inserting " { $link "escape" } ". For triple quoted strings, the double-quote character does not require escaping." }
{ $examples { $examples
"A string with a newline in it:" "A string with an escaped newline in it:"
{ $example "USE: io" "\"Hello\\nworld\" print" "Hello\nworld" } { $example "USE: io" "\"Hello\\nworld\" print" "Hello\nworld" }
"A string with an actual newline in it:"
{ $example "USE: io" "\"Hello\nworld\" print" "Hello\nworld" }
"A string with a named Unicode code point:" "A string with a named Unicode code point:"
{ $example "USE: io" "\"\\u{greek-capital-letter-sigma}\" print" "\u{greek-capital-letter-sigma}" } { $example "USE: io" "\"\\u{greek-capital-letter-sigma}\" print" "\u{greek-capital-letter-sigma}" }
"A triple-quoted string:" "A triple-quoted string:"
{ $example "USE: io \"\"\"\"Teach a man to fish...\"\"\"\" print" """"Teach a man to fish..."""" } { $example "USE: io \"\"\"Teach a man to \"fish\"...\nand fish will go extinct\"\"\" print" """Teach a man to \"fish\"...
and fish will go extinct""" }
} ; } ;
HELP: SBUF" HELP: SBUF"

View File

@ -0,0 +1,4 @@
IN: rpn.tests
USING: rpn lists tools.test ;
[ { 2 } ] [ "4 2 -" rpn-parse rpn-eval list>array ] unit-test

View File

@ -10,7 +10,7 @@ TUPLE: push-insn value ;
GENERIC: eval-insn ( stack insn -- stack ) GENERIC: eval-insn ( stack insn -- stack )
: binary-op ( stack quot: ( x y -- z ) -- stack ) : binary-op ( stack quot: ( x y -- z ) -- stack )
[ uncons uncons ] dip dip cons ; inline [ uncons uncons [ swap ] dip ] dip dip cons ; inline
M: add-insn eval-insn drop [ + ] binary-op ; M: add-insn eval-insn drop [ + ] binary-op ;
M: sub-insn eval-insn drop [ - ] binary-op ; M: sub-insn eval-insn drop [ - ] binary-op ;
@ -35,11 +35,11 @@ M: push-insn eval-insn value>> swons ;
: print-stack ( list -- ) : print-stack ( list -- )
[ number>string print ] leach ; [ number>string print ] leach ;
: rpn-eval ( tokens -- ) : rpn-eval ( tokens -- stack )
nil [ eval-insn ] foldl print-stack ; nil [ eval-insn ] foldl ;
: rpn ( -- ) : rpn ( -- )
"RPN> " write flush "RPN> " write flush
readln [ rpn-parse rpn-eval rpn ] when* ; readln [ rpn-parse rpn-eval print-stack rpn ] when* ;
MAIN: rpn MAIN: rpn

View File

@ -24,8 +24,8 @@ HELP: <product-sequence>
{ $description "Constructs a " { $link product-sequence } " over " { $snippet "sequences" } "." } { $description "Constructs a " { $link product-sequence } " over " { $snippet "sequences" } "." }
{ $examples { $examples
{ $example """USING: arrays prettyprint sequences.product ; { $example """USING: arrays prettyprint sequences.product ;
{ { 1 2 3 } { "a" "b" "c" } } <product-sequence> >array . { { 1 2 3 } { "a" "b" "c" } } <product-sequence> >array ."""
""" """ { """{
{ 1 "a" } { 1 "a" }
{ 2 "a" } { 2 "a" }
{ 3 "a" } { 3 "a" }

View File

@ -1,6 +1,6 @@
! Copyright (C) 2009 Slava Pestov. ! Copyright (C) 2009 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license. ! See http://factorcode.org/license.txt for BSD license.
USING: smtp namespaces accessors kernel arrays ; USING: smtp namespaces accessors kernel arrays site-watcher.db ;
IN: site-watcher.email IN: site-watcher.email
SYMBOL: site-watcher-from SYMBOL: site-watcher-from

View File

@ -1,6 +1,6 @@
! (c)2009 Joe Groff, see BSD license ! (c)2009 Joe Groff, see BSD license
USING: accessors arrays literals math math.affine-transforms USING: accessors arrays literals math math.affine-transforms
math.functions sequences svg tools.test xml xml.traversal ; math.functions sequences svg tools.test xml xml.traversal multiline ;
IN: svg.tests IN: svg.tests
{ 1.0 2.25 } { -3.0 4.0 } { 5.5 0.5 } <affine-transform> 1array [ { 1.0 2.25 } { -3.0 4.0 } { 5.5 0.5 } <affine-transform> 1array [