releasing factor 0.60.10
parent
38835c2832
commit
c60caaea46
|
|
@ -43,7 +43,7 @@ Slava Pestov
|
||||||
Introduction
|
Introduction
|
||||||
\layout Standard
|
\layout Standard
|
||||||
|
|
||||||
Factor is an imperitive programming language with functional and object-oriented
|
Factor is an imperative programming language with functional and object-oriented
|
||||||
influences.
|
influences.
|
||||||
Its primary goal is to be used for web-based server-side applications.
|
Its primary goal is to be used for web-based server-side applications.
|
||||||
Factor is interpreted by a virtual machine that provides garbage collection
|
Factor is interpreted by a virtual machine that provides garbage collection
|
||||||
|
|
@ -80,7 +80,7 @@ cons cells
|
||||||
\begin_inset Quotes erd
|
\begin_inset Quotes erd
|
||||||
\end_inset
|
\end_inset
|
||||||
|
|
||||||
to represent code and data struture.
|
to represent code and data structure.
|
||||||
\layout Section
|
\layout Section
|
||||||
|
|
||||||
Fundamentals
|
Fundamentals
|
||||||
|
|
@ -221,7 +221,7 @@ infix
|
||||||
|
|
||||||
More complicated infix expressions can be translated into postfix by translating
|
More complicated infix expressions can be translated into postfix by translating
|
||||||
the inner-most parts first.
|
the inner-most parts first.
|
||||||
Grouping parantheses are never necessary:
|
Grouping parentheses are never necessary:
|
||||||
\layout LyX-Code
|
\layout LyX-Code
|
||||||
|
|
||||||
! Postfix equivalent of (2 + 3) * 6
|
! Postfix equivalent of (2 + 3) * 6
|
||||||
|
|
@ -461,8 +461,9 @@ However, the stack effect of
|
||||||
one
|
one
|
||||||
\emph default
|
\emph default
|
||||||
input only.
|
input only.
|
||||||
To achive this, we need to be able to duplicate the top stack element twice.
|
To achieve this, we need to be able to duplicate the top stack element
|
||||||
As it happends, there is a word
|
twice.
|
||||||
|
As it happens, there is a word
|
||||||
\family typewriter
|
\family typewriter
|
||||||
dup ( x -- x x )
|
dup ( x -- x x )
|
||||||
\family default
|
\family default
|
||||||
|
|
@ -826,7 +827,7 @@ collapsed false
|
||||||
\layout Standard
|
\layout Standard
|
||||||
|
|
||||||
The rationale here is that the interactive interpreter should have a large
|
The rationale here is that the interactive interpreter should have a large
|
||||||
number of words available by default, for convinience, whereas source files
|
number of words available by default, for convenience, whereas source files
|
||||||
should specify their external dependencies explicitly.
|
should specify their external dependencies explicitly.
|
||||||
\end_inset
|
\end_inset
|
||||||
|
|
||||||
|
|
@ -1507,7 +1508,7 @@ word
|
||||||
( min max -- n )
|
( min max -- n )
|
||||||
\family default
|
\family default
|
||||||
pushes a random number in a specified range.
|
pushes a random number in a specified range.
|
||||||
The range is inclusive, so both the minimum and maximum indices are candidate
|
The range is inclusive, so both the minimum and maximum indexes are candidate
|
||||||
random numbers.
|
random numbers.
|
||||||
Use
|
Use
|
||||||
\family typewriter
|
\family typewriter
|
||||||
|
|
@ -2119,7 +2120,7 @@ collapsed false
|
||||||
Side effect-free code is the fundamental idea underlying functional programming
|
Side effect-free code is the fundamental idea underlying functional programming
|
||||||
languages.
|
languages.
|
||||||
While Factor allows side effects and is not a functional programming language,
|
While Factor allows side effects and is not a functional programming language,
|
||||||
for a lot of problems, coding in a functional style gives the most maintanable
|
for a lot of problems, coding in a functional style gives the most maintainable
|
||||||
and readable results.
|
and readable results.
|
||||||
\end_inset
|
\end_inset
|
||||||
|
|
||||||
|
|
@ -2763,7 +2764,7 @@ List combinators
|
||||||
\layout Standard
|
\layout Standard
|
||||||
|
|
||||||
In a traditional language such as C, every iteration or collection must
|
In a traditional language such as C, every iteration or collection must
|
||||||
be written out as a loop, with setting up and updating of idices, etc.
|
be written out as a loop, with setting up and updating of indexes, etc.
|
||||||
Factor on the other hand relies on combinators and quotations to avoid
|
Factor on the other hand relies on combinators and quotations to avoid
|
||||||
duplicating these loop
|
duplicating these loop
|
||||||
\begin_inset Quotes eld
|
\begin_inset Quotes eld
|
||||||
|
|
|
||||||
|
|
@ -31,11 +31,11 @@ USE: combinators
|
||||||
USE: real-math
|
USE: real-math
|
||||||
USE: stack
|
USE: stack
|
||||||
|
|
||||||
!!! Inverse trigonometric functions:
|
! Inverse trigonometric functions:
|
||||||
!!! acos asec asin acosec atan acot
|
! acos asec asin acosec atan acot
|
||||||
|
|
||||||
!!! Inverse hyperbolic functions:
|
! Inverse hyperbolic functions:
|
||||||
!!! acosh asech asinh acosech atanh acoth
|
! acosh asech asinh acosech atanh acoth
|
||||||
|
|
||||||
: acosh dup sq pred sqrt + log ;
|
: acosh dup sq pred sqrt + log ;
|
||||||
: asech recip acosh ;
|
: asech recip acosh ;
|
||||||
|
|
|
||||||
|
|
@ -32,8 +32,8 @@ USE: real-math
|
||||||
USE: kernel
|
USE: kernel
|
||||||
USE: stack
|
USE: stack
|
||||||
|
|
||||||
!!! Power-related functions:
|
! Power-related functions:
|
||||||
!!! exp log sqrt pow
|
! exp log sqrt pow
|
||||||
|
|
||||||
: exp >rect swap fexp swap polar> ;
|
: exp >rect swap fexp swap polar> ;
|
||||||
: log >polar swap flog swap rect> ;
|
: log >polar swap flog swap rect> ;
|
||||||
|
|
|
||||||
|
|
@ -32,11 +32,11 @@ USE: kernel
|
||||||
USE: real-math
|
USE: real-math
|
||||||
USE: stack
|
USE: stack
|
||||||
|
|
||||||
!!! Trigonometric functions:
|
! Trigonometric functions:
|
||||||
!!! cos sec sin cosec tan cot
|
! cos sec sin cosec tan cot
|
||||||
|
|
||||||
!!! Hyperbolic functions:
|
! Hyperbolic functions:
|
||||||
!!! cosh sech sinh cosech tanh coth
|
! cosh sech sinh cosech tanh coth
|
||||||
|
|
||||||
: cos ( z -- cos )
|
: cos ( z -- cos )
|
||||||
>rect 2dup
|
>rect 2dup
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue