#!/bin/sh
#
# pcalc - python calc
#
# ---
# see: https://ruderich.org/simon/config/
# source: https://ruderich.org/simon/gitweb/

set -eu

exec python3 -i -c '

# math functions.
from math import *

def ld(x):
    return log(x)/log(2)
def lg(x):
    return log10(x)

def binom(n,k):
    return reduce(lambda a,b: a*(n-b)/(b+1),xrange(k),1)

# convert number to scientific notation (e.g. 5e6).
def s(x):
    print("%e" % x)

# time/date functions.
import time

# convert time in seconds since epoch to readable string.
def stime(seconds):
    print(time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(seconds)))

print("Welcome to the ultimate calculator.")'
