The Extended Console (apc+)

The program apc+.exe is an interpreter for a kind of astrological language which allows easy access of the API functions of AstroPatterns.

You may start a session in a MS-DOS command shell. You can also store a sequence of AstroPatterns instructions (that is an AstroPatterns program) in a file and execute it. Since apc+ supports the include instruction, you can reuse AstroPatterns programs in other AstroPatterns programs. However, apc+ doesn't support more elaborated programming language features of modularization yet (things like function definitions and function calls, except the built-in functions, see below).

For using apc+ interactively from the shell, you open an MS-DOS command shell, navigate to the directory where apc+ resides and type apc+: The program is then ready for your input. You can type in any input, even longer than a line. For this, you can use the Enter key of your keyboard. Hitting "Enter" will not automatically trigger the execution of your input. Your input will be regarded as complete as soon as there is a terminating semicolon detected. You can use the semicolon to separate more than one instructions.

So, let's start with some examples.

Go to top

Simple arithmetics

If, as stated, apc+ is an interpreter, nobody will be suprised by the following session:
1+1;
2.000000 
1+1*2;
3.000000
That is, arithmetic expression involving the four basic operations will be evaluated. Observe that in the second example the operator precedence is respected: The dot operation is evaluated first. Of course, you may use brackets to force the execution order:
(1+1)*2;
4.000000
Go to top

Sexagesimal numbers

Now, let's turn to astrology. Astrologers use to work with sexagesimal number formats. To separate the parts of such a number, you may use the colon :.
1:23:46;
1.383333
The abbreviations for signs and houses are available. If you prefer, however, you may write them out: apc+ accepts cp as well as Capricorn. Let's consider an example. What is the longitude of Moon on May 02, 2010, 1:20 p.m. GMT? The ephemeris gives the midnight positions 24 Sagittarius 43:21 on May 02, and 7 Capricorn 16:27 on May 03.

Such an interpolation can be performed easily in apc+ as follows:

mode dms;
(  7 cp 16:27
 - 24 sg 43:21 ) * 13:20 / 24 + 24sg43:21;
271:41:44
The first command mode dms switched numeric output to sexagesimal mode (you can always go back to decimal output with mode deg). The second expression is the interpolation itself. Observe that the second expression extends over two lines. Hitting enter does not fire the evaluation, as long as there is no semicolon in the input stream. As the result shows, the Moon is already in Capricorn at 1:20 pm.

There are functions for getting the Moon's longitude directly, see below, this is only an example illustrating that apc+ can compute with sexagesimals as well as with ordinary numbers.

Go to top

Built-in functions

There are several built-in functions. For example, the cyclometric functions and their inverses are helpful for many computations on the sphere. Suppose, you want to know the declination of the ecliptic point 17° 23' Gemini, assuming 23°26' for the obliquity of the ecliptic. You enter
arcsin( sin(23:26) * sin( 17ge23 ) );
22:50:6
Go to top

Working with dates

Another useful feature is about calendar computations. Assume you are working with the Naibod key (which allots 0°59'8" for a year), and you have computed a certain direction with an arc of 47°45'6" for a person born on July 14, 1969. When will the direction become valid?
mode deg;
14.7.1969 + 365.2422 * 47:45:6 / 0:59:8;
2458152.413610
date;
 2. 2.2018 21h55m36s
We switched to decimal mode first. Then we work with dates with the usual arithmetic: Add the number of days to the reference date. This number of days is determined by multiplying the days of a tropical solar year (365.2422) with the directional arc in degrees and dividing by the Naibod key (0°59'8"), resulting in February 2nd, 2018. So there are still some years before this direction becomes valid.

You can also subtract dates from each other, so the reverse question can be computed quickly too: How many days have passed from 4th of July 2009, 18h until 1.1.2010, 0h?

mode deg;
1.1.2010 0h - 4.7.2009 18h;
180.250000
Watch that in this example a date and a time have been specified.

There is a predefined symbol now which gives the actual date, based on the system time:

now;
2455330.040231
date(now);
13. 5.2010 12h58m22s
Go to top

Computations with Planets

You have access to the ephemeris functions. The planets' short names (SO, MO, ME, VE, MA, JU, SA, UR, NE, PL) can be employed as functions, with the date as argument. The following command computes the position of Neptune on February 19, 1964:
ne(19.2.1964);
227:50:12
Actually, the computation is indirected through the AstroPatterns library, to the effect that the options of the current AstroPatterns session are employed. For example, if you switch on the heliocentric mode, all further computations will be heliocentric, until you switch back to geocentric mode:
mode helio;
ma(19.2.1964);
328:40:35
mode geo; ma( 19.2.1964);
328:57:38
Was Neptune retrograde in February 19, 1964? You get an easy answer by computing the daily motion:
mode dms; 
ne(20.2.1964)-ne(19.2.1964);
-0:0:2
So the answer is yes. The daily motion was 2 seconds of arc in retrograde direction.

For some computations, it may be useful to have the obliquity of ecliptic available quickly. For this, you can use the keyword epsilon or ecl for short:

ecl;
23:26:17
This gives you the mean obliquity of the ecliptic for the current date. If you need it for a different date, you can use it as a function:
ecl(now-10000);
23:26:29
Go to top

Including commands from a file

If you are working for a while with the same type of data, it can be tedious to enter them always again. For this purpose, you can save your commands in a file – the preferred and default file extension would be .ap – and re-execute the commands in your current session.

Files are included with the do statement. You may use include or even incl as a synonym, if you prefer these. Includes can be nested up to 10 levels.

Suppose, you want to have the current planetary positions with one command. You could write a file planets.ap with this content:

# Compute the planets for NOW
mode longitudes;
"so " so(now);
"mo " mo(now);
"me " me(now);
"ve " ve(now);
"ma " ma(now);
"ju " ju(now);
"sa " sa(now);
"ur " ur(now);
"ne " ne(now);
"pl " pl(now);
With this file, you have a new command do planets at your hands that you can use in an apc+ session:
do planets;
so 22ta48:16
mo 18ta20:08
me  2ta46:41
ma 17le57:44
ju 26ps13:11
sa 28vi04:44
ur 29ps30:05
ne 28aq36:49
pl  5cp05:24
Go to top

Comments, strings, special output format

This example shows some more features of the apc+ syntax:
Go to top

Ranges

If you are searching for all conjunctions of Mars and Jupiter in this and the next decade, you can enter the following command:
all mars conjunction jupiter from 2000 to 2020;
  6.4.2000  6h40m43s
  3.7.2002 13h24m20s
 27.9.2004  0h16m50s
11.12.2006 16h11m11s
 17.2.2009 16h27m11s
  1.5.2011  4h25m50s
 22.7.2013  7h34m46s
17.10.2015 22h39m42s
  7.1.2018  0h38m50s
 20.3.2020 11h34m39s
Number of hits: 10
This is a typical job for AstroPatterns. The console translate the command into a corresponding call of the AstroPatterns library.

You may abbreviate, if you like:

all ma con ju 1900 to 1905;
17.12.1901 19h31m33s
 25.2.1904 19h54m57s
Number of hits: 2
Go to top

Patterns

Suppose, you want to find the five conjunctions of Sun and Mars of the last century with the highest representation of the element fire in the horoscope of the conjunction. You can write this as follows:
for all so con ma 1900 to 2000 get top 5 for element fire ;
 17.8.1955  2h45m41s :            17.0
 12.5.1998 19h46m18s :            14.0
 22.8.1908  5h23m41s :            13.0
14.12.1961 18h28m36s :            12.5
 3.12.1929  7h11m10s :            12.5
Number of hits: 5
This calls the standard ElementPattern of AstroPatterns, which only counts the presence of planets in fire signs. The Pattern has options with which ASC and MC can be included into the computation. Also, the strength of the planets according to their actual mundane position can be taken into respect. Those options can be controlled with the using keyword in apc+. Assume we want to use ASC and MC, but do not want to use mundane positions. We switch ASC and MC on and specifiy not to work with mundane positions:
for all so con ma 1900 to 2000
  get top 5 for element fire
    using (
      asc : yes,
      mc  : yes,
      mundane positions : no );
 17.8.1955  2h45m41s :            31.0
 22.8.1908  5h23m41s :            30.5
  2.8.1970 12h 0m38s :            28.5
 12.5.1998 19h46m18s :            22.5
 21.9.1957 14h28m56s :            22.5
Number of hits: 5
You can look for certain zodiacal or house positions. Say, you are looking for Great conjunctions of Jupiter and Saturn while Sun was in a water sign. You enter it in a way you might expect:
for all ju con sa from 1000 to 2000 get so in water;
  4.3.1981 19h 7m19s :             1.0
 19.2.1961  0h 1m60s :             1.0
 17.7.1802 22h48m27s :             1.0
 5.11.1782  9h26m13s :             1.0
 18.3.1762 16h41m42s :             1.0
24.10.1682  7h40m12s :             1.0
 24.2.1643 23h14m 9s :             1.0
 16.7.1623 22h42m15s :             1.0
 14.7.1444  3h31m 3s :             1.0
 14.2.1425 14h43m29s :             1.0
25.10.1365 11h44m29s :             1.0
  5.3.1226  4h21m48s :             1.0
 8.11.1186  8h33m42s :             1.0
 26.2.1087  8h26m44s :             1.0
  7.3.1008  2h14m34s :             1.0
 8.11.1007  0h44m41s :             1.0
Number of hits: 16
Similar, you can look for house positions: Which conjunctions had happened in an angular house for Rome?
set location Rome;
location ...
for all ju con sa from 1000 to 2000 get ju in angular house;
 28.5.2000 16h 3m41s :             1.0
  4.3.1981 19h 7m19s :             1.0
  5.1.1723 15h15m45s :             1.0
 18.9.1544  2h41m17s :             1.0
 31.1.1524  6h15m23s :             1.0
  8.4.1464  8h 4m 4s :             1.0
 14.7.1444  3h31m 3s :             1.0
 18.3.1425  7h41m14s :             1.0
25.12.1305 11h52m26s :             1.0
 16.4.1206 19h21m 6s :             1.0
 8.11.1186  8h33m42s :             1.0
  7.8.1127  7h14m45s :             1.0
 26.2.1087  8h26m44s :             1.0
 8.11.1007  0h44m41s :             1.0
Number of hits: 14
Go to top

Redirecting input and output

One of the purposes of writing a console program instead of a windows-based application in these days is that we can take advantage of automation. The program can work automatically, the command-line calls being controlled from a batch file. Such a batch file can be scheduled for regular execution. Also, it may contain a sequence of several commands, so that after completion of the first step a second step will be executed, working with the output of the first step.

All of this can be perfectly done with apc+. Instead of entering your commands in the shell, you can also use a file as standard input. The command

apc+ <planets.ap >planets_today.txt
may be contained in a larger batch file. It delegates the execution of the little program planets.ap written above to the apc+.exe program, writing the result to the file planets_today.txt instead of standard output. Such files could be used in subsequent steps.
Go to top

Limitations

Currently, the shell apc+ is restricted to the fixed planet set
SO - Sun 
MO - Moon
ME - Mercury
VE - Venus
MA - Mars
JU - Jupiter
SA - Saturn
UR - Uranus
NE - Neptune
PL - Pluto
and to the fixed set of aspects
CON - Conjunction (0°)
OPP - Opposition (180°)
TRI - Trine (120°)
SQU - Square (90°)
SXT - Sextile (60°)
SSX - Semi Sextile (30°)
QCX - Inconjunct (150°)
SSQ - Semi Square (45°)
SQQ - Sesqui Square (135°)
With other words, contrary to the Excel UI, apc+ does not account for customizable planets and aspects. The same holds for mundane position strengths which are fixed in their initial state (allotting 3 points to angular, 2 points to intermediate and one point to cadent houses).

This is because the grammar file for apc+ (which is written in the Bison metapgrogramming language). When introducing a new planet, the corresponding change of the grammar would require to recompile apc+.exe. This cannot reasonably be required on the user site.