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

db4
John Benediktsson 2008-09-12 10:03:40 -07:00
commit 5ef537b752
19 changed files with 45 additions and 23 deletions

View File

@ -1,6 +1,6 @@
USING: definitions kernel parser words sequences math.parser
namespaces editors io.launcher windows.shell32 io.files
io.paths strings unicode.case ;
io.paths strings unicode.case make ;
IN: editors.editpadpro
: editpadpro-path

View File

@ -1,5 +1,5 @@
USING: editors io.files io.launcher kernel math.parser
namespaces sequences windows.shell32 ;
namespaces sequences windows.shell32 make ;
IN: editors.editplus
: editplus-path ( -- path )

View File

@ -1,5 +1,5 @@
USING: definitions io.launcher kernel parser words sequences math
math.parser namespaces editors ;
math.parser namespaces editors make ;
IN: editors.emacs
: emacsclient ( file line -- )

View File

@ -1,5 +1,6 @@
USING: editors hardware-info.windows io.files io.launcher
kernel math.parser namespaces sequences windows.shell32 ;
kernel math.parser namespaces sequences windows.shell32
make ;
IN: editors.emeditor
: emeditor-path ( -- path )

View File

@ -1,6 +1,6 @@
USING: io.backend io.files kernel math math.parser
namespaces sequences system combinators
editors.vim vocabs.loader ;
editors.vim vocabs.loader make ;
IN: editors.gvim
SINGLETON: gvim

View File

@ -1,5 +1,5 @@
USING: editors io.files io.launcher kernel math.parser
namespaces sequences windows.shell32 ;
namespaces sequences windows.shell32 make ;
IN: editors.notepadpp
: notepadpp-path

View File

@ -9,7 +9,7 @@
! if not on the path.
!
USING: io.files io.launcher kernel namespaces math
math.parser editors sequences windows.shell32 ;
math.parser editors sequences windows.shell32 make ;
IN: editors.scite
: scite-path ( -- path )

View File

@ -1,5 +1,5 @@
USING: editors io.files io.launcher kernel math.parser
namespaces sequences windows.shell32 ;
namespaces sequences windows.shell32 make ;
IN: editors.ted-notepad
: ted-notepad-path

View File

@ -1,5 +1,5 @@
USING: definitions io.launcher kernel math math.parser parser
namespaces prettyprint editors ;
namespaces prettyprint editors make ;
IN: editors.textmate

View File

@ -1,7 +1,7 @@
! Copyright (C) 2008 Ben Schlingelhof.
! See http://factorcode.org/license.txt for BSD license.
USING: definitions io.launcher kernel parser words sequences
math math.parser namespaces editors ;
math math.parser namespaces editors make ;
IN: editors.textwrangler
: tw ( file line -- )

View File

@ -1,5 +1,5 @@
USING: editors io.files io.launcher kernel math.parser
namespaces sequences windows.shell32 ;
namespaces sequences windows.shell32 wne ;
IN: editors.ultraedit
: ultraedit-path ( -- path )

View File

@ -1,5 +1,6 @@
USING: definitions io io.launcher kernel math math.parser
namespaces parser prettyprint sequences editors accessors ;
namespaces parser prettyprint sequences editors accessors
make ;
IN: editors.vim
SYMBOL: vim-path

View File

@ -5,3 +5,7 @@ USING: math.vectors tools.test ;
[ { 1 2 3 } ] [ { 2 4 6 } 1/2 v*n ] unit-test
[ { 1 2 3 } ] [ { 2 4 6 } 2 v/n ] unit-test
[ { 1/1 1/2 1/3 } ] [ 1 { 1 2 3 } n/v ] unit-test
[ 4 ] [ { 1 2 } norm-sq ] unit-test
[ 36 ] [ { 2 3 } norm-sq ] unit-test

View File

@ -1,4 +1,4 @@
! Copyright (C) 2005, 2007 Slava Pestov.
! Copyright (C) 2005, 2008 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license.
USING: arrays kernel sequences math math.functions hints
math.order ;
@ -19,8 +19,8 @@ IN: math.vectors
: vmax ( u v -- w ) [ max ] 2map ;
: vmin ( u v -- w ) [ min ] 2map ;
: v. ( u v -- x ) 0 [ * + ] 2reduce ;
: norm-sq ( v -- x ) 0 [ absq + ] reduce ;
: v. ( u v -- x ) [ * ] [ + ] 2map-reduce ;
: norm-sq ( v -- x ) [ absq ] [ + ] map-reduce ;
: norm ( v -- x ) norm-sq sqrt ;
: normalize ( u -- v ) dup norm v/n ;

View File

@ -4,12 +4,18 @@ USING: accessors kernel quotations help.syntax help.markup
io.sockets strings calendar ;
IN: smtp
HELP: smtp-domain
{ $description "The name of the machine that is sending the email. This variable will be filled in by the " { $link host-name } " word if not set by the user." } ;
HELP: smtp-server
{ $description "Holds an " { $link inet } " object with the address of an SMTP server." } ;
HELP: smtp-read-timeout
{ $description "Holds an " { $link duration } " object that specifies how long to wait for a response from the SMTP server." } ;
HELP: esmtp?
{ $description "Set true by default, determines whether the SMTP client is using the Extended SMTP protocol." } ;
HELP: with-smtp-connection
{ $values { "quot" quotation } }
{ $description "Connects to an SMTP server stored in " { $link smtp-server } " and calls the quotation." } ;
@ -36,5 +42,10 @@ HELP: send-email
} ;
ARTICLE: "smtp" "SMTP Client Library"
"Configuring SMTP:"
{ $subsection smtp-server }
{ $subsection smtp-read-timeout }
{ $subsection smtp-domain }
{ $subsection esmtp? }
"Sending an email:"
{ $subsection send-email } ;

View File

@ -10,7 +10,7 @@ IN: smtp
SYMBOL: smtp-domain
SYMBOL: smtp-server "localhost" "smtp" <inet> smtp-server set-global
SYMBOL: smtp-read-timeout 1 minutes smtp-read-timeout set-global
SYMBOL: esmtp t esmtp set-global
SYMBOL: esmtp? t esmtp? set-global
LOG: log-smtp-connection NOTICE ( addrspec -- )
@ -39,7 +39,7 @@ TUPLE: email
: command ( string -- ) write crlf flush ;
: helo ( -- )
esmtp get "EHLO " "HELO " ? host-name append command ;
esmtp? get "EHLO " "HELO " ? host-name append command ;
ERROR: bad-email-address email ;

View File

@ -747,6 +747,17 @@ PRIVATE>
: unclip-slice ( seq -- rest first )
[ rest-slice ] [ first ] bi ; inline
: 2unclip-slice ( seq1 seq2 -- seq1' seq2' elt1 elt2 )
[ unclip-slice ] bi@ swapd ; inline
: map-reduce ( seq map-quot reduce-quot -- result )
[ [ unclip-slice ] dip [ call ] keep ] dip
compose reduce ; inline
: 2map-reduce ( seq1 seq2 map-quot reduce-quot -- result )
[ [ 2unclip-slice ] dip [ call ] keep ] dip
compose 2reduce ; inline
: unclip-last-slice ( seq -- butlast last )
[ but-last-slice ] [ peek ] bi ; inline

View File

@ -10,9 +10,6 @@ IN: sequences.lib.tests
{ { 16 17 18 19 20 } } [ 1 2 3 4 { 6 7 8 9 10 } [ + + + + ] 4 map-withn ] unit-test
[ { 910 911 912 } ] [ 10 900 3 [ + + ] map-with2 ] unit-test
[ 4 ] [ { 1 2 } [ sq ] [ * ] map-reduce ] unit-test
[ 36 ] [ { 2 3 } [ sq ] [ * ] map-reduce ] unit-test
[ 10 ] [ { 1 2 3 4 } [ + ] reduce* ] unit-test
[ 24 ] [ { 1 2 3 4 } [ * ] reduce* ] unit-test

View File

@ -31,9 +31,6 @@ IN: sequences.lib
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
: map-reduce ( seq map-quot reduce-quot -- result )
>r [ unclip ] dip [ call ] keep r> compose reduce ; inline
: reduce* ( seq quot -- result ) [ ] swap map-reduce ; inline
! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!