This is part of the HicEst documentation

Newcomer to HicEst?

Read this if you are not sure about the uses of HicEst. To get answers move the mouse over the questions below.

⇾Home ⇾Contents ⇾more General ⇾ Examples

  1. You never wrote a line of program code? Let us simply talk about time ...
    1. How many seconds has an hour ?
      • HicEst can serve as a printing desk calculator:
        Type in 60 * 60 and press Enter:
        60 * 60 3600
      • A short answer is always shown at the end of the statement line.
    2. How many seconds have passed today ?
      • Obviously the answer varies with the time this is asked.
      • We define a variable named "sec" (or almost any other word), and assign the answer of HicEst's TIME function to "sec":
        sec = TIME() ! always returns seconds since midnight 58357.6
        The "!" makes the rest of the line a comment.
      • If you type or copy the statement again and press Enter:
        sec = TIME() ! sec has a new value now: 58358.18
    3. How many seconds has this century so far ?
      Many HicEst functions have optional keywords . The statements below show the idea:
      1. We calculate a "day number" for "January 1, 2000" and name this variable "day1":
        TIME( Month=1, Day=1, Year=2000, TO, Excel=day1) 58517.29
        • The TO keyword separates the input keyword(s) from the result keyword(s).
        • The keyword "Excel" converts the input to an Excel-compatible "day number".
          "day1" is set to 36526.
        • Again the result-field shows the current time of the day in seconds.
      2. With no input keywords left of "TO" the current date is converted to the keywords right of TO, here the variables "right_now", m, d, and y:
        TIME( TO, Excel=right_now, MOnth=m, Day=d, Year=y) 58519.15
        • To check the value of right_now move the cursor to it: A tooltip displays 41303.6819.
        • The decimal fraction of right_now is the current time of the day.
        • The next item below shows the complete results in a message box.
      3. Finally "sec" is set to the result of "(number of days) times (seconds per day)":
        sec = ( right_now - day1 ) * 24 * 60 * 60 4.1279E8
        "E8" in the result field stands for 10^8 (100 million)
    4. Ways to get more detailed output:
      The result-field always shows a maximum of information fitting to 8 characters.
      Increasingly better presentation is achieved by:
      1. Cursor on variable: A tooltip shows its value.
      2. F1 or right mouse click over variable: An Edit dialog opens allowing to change its value.
      3. The WRITE function has 32 optional keywords. Two are used here:
        • WRITE(Messagebox="i", name) "Results are:|", day1, m, d, y, sec
        datetime.jpg Text, File, Statusbar, Titlebar, Clipboard instead of Messagebox are other options of WRITE,

        The optional Format keyword allows precisely formatted output.

        Other output functions are WINDOW, DLG, POP, COM, BEEP, Print.
  2. In 4 statements calculate the growth of 100$ at 4% over 10 years and show as graph.
    1. Initialize 3 numerical variables (no other declarations needed):
      • REAL :: capital=100, annual_rate=0.04, years=10
    2. Open a default child window ( WINDOW has 55 more optional keywords):
      • WINDOW( WIN=handle, TItle="100$ at 4%" ) ! Windows sets handle
    3. Plot x-y coordinates to child window (default for 24 more options):
      • AXIS( WIN=handle, Title="years", MaX=years, Y, Title="capital + interest ( $)")
    4. Plot 100 X-values of Y=... (16 more options):
      • LINE(X=years, Y=capital*(1+annual_rate)^years, Points=100 )
    interest.jpg Without step b the graph is drawn to the main window (script window).
  3. In 5 statements search Shakespeare for the best matches of "The to-be-to question.".
    • As with commercial search engines HicEst's InvertedIndex allows fast full text searches of original master text(s).
    • a-c serve to build an index, d is the search. This script is complete and it works.
    1. The complete works of Shakespeare are read to the string variable "original". Required definitions:
      • CHARACTER original*6000000, InvIdx*6000000, found*100000
    2. Read the Shakespeare file and store it to "original":
      • OPEN( FIle="\Shakespeare\COMPLETE WORKS.txt", UNFormatted, LENgth=L)
      • READ( FIle="\Shakespeare\COMPLETE WORKS.txt", CLoSe=1) original
      The character count L is set by the OPEN function to 5590193.
    3. On an oldish Laptop it takes 21 sec to build InvIdx:
      • EDIT(Text=original, ID="all of W.S.", InvertedIndex=InvIdx)
    4. InvIdx (4211287 bytes, 24025 words indexed) can be searched now:
      • found = EDIT(Text="The to-be-to question.", InvertedIndex=InvIdx)
      • The 2 shortest matches out of 145 containing all search words in arbitrary order:
        1. "To be, or not to be- that is the question"
        2. "To be young again, if we could, I will be a fool in question, hoping to be the"
      • Numerous other options exist to build InvIdx (InvertedIndex) and to search InvIdx ( InvertedIndexQuery).
        A single statement for example is enough to replace "all of W.S." used above by the name of the particular Shakespeare play.
      • Total search time is 125 msec.
  4. CountDown.hic is a useful short example. countdown_example.png

Support HicEst   ⇾ Impressum
©2000-2019 Georg Petrich, HicEst Instant Prototype Computing. All rights reserved.