OnWorks favicon

hocplan9 - Online in the Cloud

Run hocplan9 in OnWorks free hosting provider over Ubuntu Online, Fedora Online, Windows online emulator or MAC OS online emulator

This is the command hocplan9 that can be run in the OnWorks free hosting provider using one of our multiple free online workstations such as Ubuntu Online, Fedora Online, Windows online emulator or MAC OS online emulator



hoc - interactive floating point language


hoc [ file ... ] [ -e expression ]


Hoc interprets a simple language for floating point arithmetic, at about the level of
BASIC, with C-like syntax and functions.

The named files are read and interpreted in order. If no file is given or if file is hoc
interprets the standard input. The -e option allows input to hoc to be specified on the
command line, to be treated as if it appeared in a file.

Hoc input consists of expressions and statements. Expressions are evaluated and their
results printed. Statements, typically assignments and function or procedure definitions,
produce no output unless they explicitly call print.

Variable names have the usual syntax, including the name by itself contains the value of
the last expression evaluated. The variables E, PI, PHI, GAMMA and DEG are predefined;
the last is 59.25..., degrees per radian.

Expressions are formed with these C-like operators, listed by decreasing precedence.

^ exponentiation

! - ++ --

* / %

+ -

> >= < <= == !=



= += -= *= /= %=

Built in functions are abs, acos, asin, atan (one argument), cos, cosh, exp, int, log,
log10, sin, sinh, sqrt, tan, and tanh. The function read(x) reads a value into the
variable x and returns 0 at EOF; the statement print prints a list of expressions that may
include string constants such as "hello\n".

Control flow statements are if-else, while, and for, with braces for grouping. Newline
ends a statement. Backslash-newline is equivalent to a space.

Functions and procedures are introduced by the words func and proc; return is used to
return with a value from a function.


func gcd(a, b) {
temp = abs(a) % abs(b)
if(temp == 0) return abs(b)
return gcd(b, temp)
for(i=1; i<12; i++) print gcd(i,12)



Use hocplan9 online using onworks.net services

Free Servers & Workstations

Download Windows & Linux apps

  • 1
    ExpressLuke GSI
    ExpressLuke GSI
    This SourceForge download page was to
    grant users to download my source built
    GSIs, based upon phhusson's great
    work. I build both Android Pie and
    Android 1...
    Download ExpressLuke GSI
  • 2
    PyQt is the Python bindings for
    Digia's Qt cross-platform
    application development framework. It
    supports Python v2 and v3 and Qt v4 and
    Qt v5. PyQt is avail...
    Download PyQt
  • 3
    Gambas3* coding tools and examples for
    use in SMB or other organizations that
    make internal programs. E.g. from
    database fields to class sourcecode with
    Download garlic3
  • 4
    Sardi is a complete restyling and
    optimisation of svg code. 6 choices for
    your applications and 10 kind of folders
    to use in your file manager. The sardi
    Download Sardi
  • 5
    LMMS Digital Audio Workstation
    LMMS Digital Audio Workstation
    LMMS is a free cross-platform software
    which allows you to produce music with
    your computer. If you like this project
    consider getting involved in the project
    Download LMMS Digital Audio Workstation
  • 6
    FreeRTOS Real Time Kernel (RTOS)
    FreeRTOS Real Time Kernel (RTOS)
    FreeRTOS is a market-leading real-time
    operating system (RTOS) for
    microcontrollers and small
    microprocessors. Distributed freely
    under the MIT open source lice...
    Download FreeRTOS Real Time Kernel (RTOS)
  • 7
    Avogadro is an advanced molecular
    editor designed for cross-platform use
    in computational chemistry, molecular
    modeling, bioinformatics, materials
    science and ...
    Download Avogadro
  • More »

Linux commands