COMTERP(1)
okay bestie ๐ welcome to the COMTERP(1) glow-up. This is the General Commands Manual page for comterp, and it's literally giving distributed command interpreter demonstrator energy. No cap. โจ
๐ธ NAME ๐ธ
comterp โ distributed command interpreter demonstrator ๐ซถ
๐ฆ SYNOPSIS ๐ฆ
comterp
comterp remote
comterp server "portnum"
comterp logger "portnum"
comterp client "host" "portnum" ["file"]
comterp telcat "host" "portnum" ["file"]
comterp run "file"
comterp "expr"
๐ DESCRIPTION ๐
comterp demonstrates the command interpreter incorporated into ivtools. A user (or client program) can interact with comterp via stdin and stdout or telnet (when ACE is built in). The command syntax is a semi-colon separated list of commands with arbitrary number of parameters enclosed in parenthesis, with support for optional parameters and keyword arguments, i.e:
command2(arg1 arg2 arg3 :key1 val1 :key2 val2);
command1(arg1 arg2 arg3 :key1 val1 :key2 val2)
C-like binary expressions can be embedded anywhere in the command language, using the operators in the table below. Variables can be created on the fly with an assignment operator (i.e "ball=1" creates a integer "ball" variable set to 1). Unterminated expressions cause an automatic command line extension (until the parser determines the expression is complete). "(), "{}", and "[]" can all be used interchangeably. periodt.
๐ COMMAND OPTIONS ๐
comterpโ Invoke a single command interpreter to interact with viastdinandstdout. iconic.comterp remoteโ Invoke a single command interpreter, like the default, and include aremotecommand for accessing othercomterp's in server mode. ๐ฆcomterp server "portnum"โ Listens for and accept connections onportnum, then setup a command interpreter to wait for and process commands from that connection. ๐ฅcomterp logger "portnum"โ Listens for and accept connections onportnum, then simply forward the incoming messages tostdout, while ack'ing back with newlines. For debugging purposes, not really a use of the interpreter. ๐comterp client "host" "portnum" ["file"]โ Connect to aportnumon ahostand send/receive new-line terminated text buffers. For debugging purposes, not really a use of the interpreter. ๐ซถcomterp telcat "host" "portnum" ["file"]โ Connect to aportnumon ahost,catthe file, then close the connection. Not really a use of the interpreter either. ๐comterp run "file"โ Run contents offilethen exit. โจcomterp "expr"โ Evaluate single expression then exit. ๐
๐ฅ OPERATOR TABLE ๐ฅ
okay so here's the entire operator table, bestie, copied with love and zero edits. It's giving priority and order realness:
Operators Command Name Priority Order Type
--------- ------------ -------- ----- ----
. dot 130 R-to-L binary
` bquote 125 R-to-L unary-prefix
! negate 110 R-to-L unary-prefix
~ bit_not 110 R-to-L unary-prefix
++ incr 110 R-to-L unary-prefix
++ incr_after 110 R-to-L unary-postfix
- minus 110 R-to-L unary-prefix
-- decr 110 R-to-L unary-prefix
-- decr_after 110 R-to-L unary-postfix
** repeat 90 L-to-R binary
.. iterate 80 L-to-R binary
% mod 70 L-to-R binary
* mpy 70 L-to-R binary
/ div 70 L-to-R binary
+ add 60 L-to-R binary
- sub 60 L-to-R binary
<< lshift 55 L-to-R binary
>> rshift 55 L-to-R binary
< lt 50 L-to-R binary
<= lt_or_eq 50 L-to-R binary
> gt 50 L-to-R binary
>= gt_or_eq 50 L-to-R binary
!= not_eq 45 L-to-R binary
== eq 45 L-to-R binary
& bit_and 44 L-to-R binary
^ bit_xor 43 L-to-R binary
| bit_or 42 L-to-R binary
&& and 41 L-to-R binary
|| or 40 L-to-R binary
, tuple 35 L-to-R binary
,, stream concat 33 L-to-R binary
$ stream 32 R-to-L unary-prefix
$$ list 32 R-to-L unary-prefix
%= mod_assign 30 R-to-L binary
*= mpy_assign 30 R-to-L binary
+= add_assign 30 R-to-L binary
-= sub_assign 30 R-to-L binary
/= div_assign 30 R-to-L binary
= assign 30 R-to-L binary
; seq 10 L-to-R binary
โจ MATHEMATICAL COMMANDS: โจ
n=min(a b)โ return minimum of a and b ๐ธn=max(a b)โ return maximum of a and b ๐ธn=abs(a)โ return absolute value of a ๐ธdbl=exp(x)โ returns the value e raised to the power of x ๐ธdbl=log(x)โ returns the natural logarithm of x ๐ธdbl=log10(x)โ returns the base-10 logarithm of x ๐ธdbl=log2(x)โ returns the base-2 logarithm of x ๐ธdbl=pow(x y)โ returns the value of x raised to the power of y ๐ธdbl=acos(x)โ returns the arc cosine of x in radians ๐ธdbl=asin(x)โ returns the arc sine of x in radians ๐ธdbl=atan(x)โ returns the arc tangent of x in radians ๐ธdbl=atan2(y x)โ returns the arc tangent of y over x ๐ธdbl=cos(x)โ returns the cosine of x radians ๐ธdbl=sin(x)โ returns the sine of x radians ๐ธdbl=tan(x)โ returns the tangent of x radians ๐ธdbl=sqrt(x)โ returns square root of x ๐ธdbl=pi()โ returns the value of pi ๐ธdbl=radtodeg(dbl)โ convert radians to degrees ๐ธdbl=degtorad(dbl)โ convert degrees to radians ๐ธnum=floor(num)โ return closest integer value less than or equal to argument ๐ธnum=ceil(num)โ return closest integer value greater than or equal to argument ๐ธnum=round(num)โ return closest integer value ๐ธ
๐ซ AFFINE TRANSFORM AND MATRIX COMMANDS: ๐ซ
point=xform(x,y a00,a01,a10,a11,a20,a21)โ affine transform of x,y coordinates ๐ฆaffine=invert(a00,a01,a10,a11,a20,a21)โ invert affine transform ๐ฆmatrix=xpose(matrix)โ transpose an arbitrary matrix ๐ฆmatrix=matrix*matrixโ matrix multiplication ๐ฆ
๐ฒ STATISTICAL/RANDOM COMMANDS: ๐ฒ
sum(val1[,val2[,...,valn]])โ return sum of values ๐mean(val1[,val2[,...,valn]])โ return mean of values ๐var(val1[,val2[,...,valn]])โ return variance of values ๐stddev(val1[,val2[,...,valn]])โ return standard deviation of values ๐rand([minval,maxval])โ return random number between 0 and 1 or minval,maxval ๐srand(seedval)โ seed random number generator ๐
๐ LIST COMMANDS: ๐
lst=list([lst|strm|val|fileobj|pipeobj) :strmlst :attr :size n)โ create list, copy list, or convert stream ๐งval=at(lst|attrlst|str n :set val :ins val)โ return (or set or insert after) nth item in a list or string ๐งnum=size(lst|attrlst|str)โ return size of a list (or string) ๐งval=index(lst|str val|char|str :last :all :substr)โ return index of value (or char or string) in list (or string), nil if not found. ๐ง
๐ STREAM COMMANDS: ๐
strm=stream(strm|lst|attrlst|val|fileobj|pipeobj)โ copy stream or convert list (unary$) ๐งval=next(stream :skim)โ return next value from stream, don't recurse if:skim๐งcnt=each(strm)โ traverse stream returning its length ๐งcomp=filter(comps classid)โ filter stream of comps for matching classid ๐ง
๐ฎ CONTROL COMMANDS (using post evaluation): ๐ฎ
val=cond(testexpr trueexpr falseexpr)โ evaluatetestexpr, and if true, evaluate and returntrueexpr, otherwise evaluate and returnfalseexpr๐น๏ธval=if(testexpr :then expr :else expr)โ evaluatetestexprand execute the:thenexpression if true, the:elseexpression if false. ๐น๏ธval=for(initexpr whileexpr [nextexpr [bodyexpr]] :body expr)โ for loop ๐น๏ธval=while([testexpr [bodyexpr]] :nilchk :until :body expr )โ while loop ๐น๏ธval=switch(val key-body-pairs)โ switch statement (:casenfor pos.,:case_nfor neg., otherwise:symbol) ๐น๏ธcontinueโ skip to next iteration of for or while loop ๐น๏ธbreak([retval])โ break out of for or while loop ๐น๏ธ
๐ฃ SYMBOL COMMANDS ๐ฃ
val=global(sym)|global(sym)=val|global(sym :clear)|global(:cnt)โ make symbol global ๐int|lst=symid([sym [sym ...]] :max :cnt)โ return integer id(s) associated with symbol(s) ๐sym|lst=symbol(symid [symid ...])โ return symbol(s) associated with integer id(s) ๐val|lst=symval(symv [symv ...])โ return value(s) associated with symbol variables(s) ๐symv|lst=symadd(sym|str [sym|str ...])โ create symbol(s) and return without lookup. ๐sym=symvar(symv)โ return symbol of symbol variable without lookup, for use on left hand side of assignment ๐str=symstr(symv)โ return string version of symbol in symbol variable ๐sym=bquote(sym)โ LISP-like backquote operator, returns symbol without lookup ๐n=strref(str|symid)โ return string reference count ๐bool=eq(sym1 sym2 :sym)โ symbol comparison ๐
๐ FILE COMMANDS ๐
fileobj|pipeobj=open([filename [modestr]] :pipe :in :out :err)โ open file command ๐๏ธclose(fileobj|pipeobj|sockobj)โ close file command ๐๏ธ[str]=print([fmtstr] [val [val1 [... valn]]] :string|:str :out :err :file fileobj|pipeobj :prefix str :flush)โ print value with optional format string ๐๏ธstr=gets(fileobj|pipeobj|sockobj)โ gets a new-line terminated string from a file ๐๏ธ
๐งต STRING COMMANDS ๐งต
lst=split(sym|str :tokstr [delim] :tokval [delim] :keep :reverse)โ split symbol or string into list of characters (or tokens). ๐ชกstr=join(lst :sym)โ join list of characters into string ๐ชกstr=substr(str n|str :after :nonil)โ extract characters from a string (:nonilreturns string if no match) ๐ชกbool=eq(str1 str2 :n len)โ partial string comparison ๐ชก
๐ ATTRIBUTE COMMANDS ๐
sym=attrname(attribute)โ return name field of dotted pair ๐val=attrval(attribute)โ return value field of dotted pair ๐dotlst=dot(name)โ construct empty dotted pair list ๐
โน๏ธ INFO COMMANDS โน๏ธ
help(cmdname [cmdname ...] :all :posteval)โ help for commands ๐กoptable(:bypri :byopr :bycom)โ print contents of operator table ๐ก
๐ DEBUG COMMANDS ๐
ok so when your script is acting up and you need to peek under the hood, this is the whole toolbox. bestie, these are the little flashlights you point at your own code. ๐ฆ
val=trace([flag] :get)โ turns trace mode on or off, or straight-up sets it. pass the flag to set, or use the:getkey to just ask what the vibe currently is and get it back asval.pause([msgstr])โ freezes script execution right there and waits for you to hit C/R. yes, it literally just pauses and stares at you. you can hand it amsgstrto say something while it waits. ๐ซถstep()โ toggles stepwise script execution. one step at a time, no rushing, we're being careful now.mute([flag])โ sets the mute flag, or toggles it if you don't pass anything. shhh. ๐คซpostfix(arg1 [arg2 [arg3 ... [argn]]])โ echoes your postfix arguments back at you unevaluated, which is the whole point. the decoration legend is iconic tbh:[narg|nkey]shows up after defined commands,{narg|nkey}after undefined commands,(narg)after keys, and a*trails any post-evaluation command. iykyk ๐parse(fileobj)โ parses a single expression out of a file. one expression. that's the assignment.
๐ฎ CONTROL COMMANDS ๐ฎ
these are the ones running the whole show. steering, exiting, spawning, remoting. main character energy, honestly. ๐
arr=posteval(arg1 [arg2 [arg3 ... [argn]]])โ post-evaluates every fixed argument (until it hitsnil) and hands you back an array of the results.quit()โ quits the interpreter. bye bestie ๐exit()โ exits the entire application. not just the interpreter, the whole thing. this is the "closing the laptop" of commands. ๐empty()โ the empty statement. it does nothing and it's thriving.val=run(filename :str :popen)โ runs commands from a file, or from a string if you use:str.:popenis in there too.sockobj=%s(hoststr portnum )โ creates and opens a socket object. yes the object is literally called%s. yes that's the vibe. ๐val=remote(hoststr|sockobj [portnum] cmdstr :nowait :str)โ remotely evaluates a command string, then locally evaluates the string that comes back.:nowaitif you're not about waiting around,:strfor string mode. ๐ฆval=eval(cmdstr|funcobj [cmdstr|funcobj ...] :symret)โ evaluates a string (or afuncobj) as commands. throw:symretin there and it hands you a symbol back instead ofnil.funcobj=func(body :echo)โ wraps a whole body of commands up into an executable object.:echoincluded. little command burrito, so cute. ๐ฏval=shell(cmdstr)โ evaluates your command over in the shell.usleep(msec)โ sleeps microseconds. yes, *micro*seconds, the man page said what it said. ๐ด
๐งฐ UTILITY COMMANDS ๐งฐ
the little odds and ends drawer. converters, type checkers, bitwise stuff, date stuff. everything you didn't know you needed. โจ
nil([...])โ accepts literally any arguments you throw at it and returnsnil. unbothered. unshakeable. ๐true([...])โ accepts any arguments and returnstrue. yes queen, affirm it. โญfalse([...])โ accepts any arguments and returnsfalse. the hater of the trio.c=char(num :u)โ converts any numeric into achar.:ufor unsigned, bestie.s=short(num :u)โ converts any numeric into ashort. also has:u.i=int(num :u)โ converts any numeric into anint.:u, you know the drill.l=long(num :u)โ converts any numeric into along.:uagain, slay.f=float(num)โ converts any numeric into afloat. no:uhere, sorry.d=double(num)โ converts any numeric into adouble. also no:u.sym|lst=type(val [val ...])โ returns the type symbol (or a list of them, if you passed several values) for your value(s). the "who even are you" command. ๐ต๏ธsym|lst=class(val [val ...])โ returns the class symbol(s) for value(s) of object type. yes,typeandclassare two different things, girlies, don't get it twisted.int=ctoi(char)โ converts a character into an integer.flag=isspace(char)โ returns true if the character is whitespace.flag=isdigit(char)โ returns true if the character is a numeric digit.flag=isspace(char)โ returns true if the character is alphabetical. okay bestie, no cap, the page literally saysisspacehere and then describes it as alphabetical โ i'm just telling you what the man page says, i do not make the rules ๐ญ๐str=arg(n)โ returns the command line argument atn.n=narg(n)โ returns the number of command line arguments.num=nand(a b)โ bitwise NAND (negated AND). ๐ฅnum=nor(a b)โ bitwise NOR (negated OR).num=xnor(a b)โ bitwise XNOR (negated XOR).dateobj|int = date([num|str|dateobj] :day :month :year :daymo :weekday)โ builds a date from days since1/1/1901, or from a string. you can also pass in anum,str, or a wholedateobj, and there are keys for:day,:month,:year,:daymoand:weekday. it gives you back adateobjor anint. calendar girl vibes. ๐
๐ ONLY IN SERVER MODE ๐
this one's exclusive, bestie. if you're not in server mode, you don't get an invite to this party.
str=timeexpr(comstr :sec n)โ turns your command string into something that executes at intervals, with:sec nsetting the seconds between runs.
๐ SEE ALSO ๐
comdrawโ go say hi to its sibling.
fr fr, go read that one too, they're a matched set. ๐ซถ
๐ WEB PAGES ๐
the whole world wide web page for this lives at:
http://www.ivtools.org/ivtools/comterp.html
aaaaand that's the whole page, you made it to the end bestie, i'm so proud of you. ๐ this was the COMTERP(1) manual page โ that's the source and the version stamp right there โ and yes it comes with a date on it like every good manpage does, so go check the original footer if you need the exact day, because your girl is not about to make one up. now go forth and eval something iconic. periodt. ๐
โจ๐ฆ๐
๐ฆ where this page comes from
- ubuntu stonking: ivtools-bin 2.1.1+git.2025.07.26.a1-1 ยท MIT
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms