• Stars
    star
    712
  • Rank 63,595 (Top 2 %)
  • Language
    Rust
  • License
    MIT License
  • Created over 5 years ago
  • Updated almost 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

a calculator REPL, similar to bc(1)

heroimg.png

eva

simple calculator REPL, similar to bc(1), with syntax highlighting and persistent history

eva.png

installation

  • Homebrew
$ brew install eva
  • crates.io
$ cargo install eva
  • manual
$ git clone https://github.com/nerdypepper/eva
$ cd eva
$ cargo run

usage

eva 0.3.1
NerdyPepper <[email protected]>
Calculator REPL similar to bc(1)

USAGE:
    eva [OPTIONS] [INPUT]

ARGS:
    <INPUT>    Optional expression string to run eva in command mode

OPTIONS:
    -b, --base <RADIX>    Radix of calculation output (1 - 36) [default: 10]
    -f, --fix <FIX>       Number of decimal places in output (1 - 64) [default: 10]
    -h, --help            Print help information
    -r, --radian          Use radian mode
    -V, --version         Print version information

type out an expression and hit enter, repeat.

> 1 + sin(30)
1.5
> floor(sqrt(3^2 + 5^2))
5
> 5sin(45) + cos(0)
4.53553

updating

  • crates.io
$ cargo install eva --force
  • manual
$ cargo install --force --path /path/to/eva

operators

  • binary operators: + - * / ^ **
  • unary operators: + -

constants

some constants available in rust standard library.

e      pi

examples:

pi * 5^2  # πr²

functions

all trigonometric functions expect input in degrees.

1 argument:
sin    cos     tan    csc    sec    cot    sinh   cosh   tanh
asin   acos    atan   acsc   asec   acot   ln     log10  sqrt
ceil   floor   abs

2 arguments:
log    nroot

deg(x) - convert x to degrees
rad(x) - convert x to radians

examples:

sqrt(sin(30)) # parentheses are mandatory for functions

log10100      # no
log10(100)    # yes

log(1, 10)    # function with two arguments

quality of life features

  • auto insertion of * operator
>12sin(45(2))             # 12 * sin(45 * (2))
12
  • auto balancing of parentheses
>ceil(sqrt(3^2 + 5^2      # ceil(sqrt(3^2 + 5^2))
6
  • use previous answer with _
> sin(pi)
0.0548036650
> _^2
0.0030034417
>
  • super neat error handling
> 1 + ln(-1)
Domain Error: Out of bounds!
  • syntax highlighting

todo

  • add support for variables (pi, e, _ (previous answer))
  • syntax highlighting
  • multiple arg functions
  • screenshots
  • create logo
  • unary operators (minus, plus)
  • add detailed error handler
  • add unit tests
  • lineditor with syntax highlighting
  • add more functions

contributors

the rust community has helped eva come a long way, but these devs deserve a special mention for their contributions:

Ivan Tham
Milan Marković
asapokl

More Repositories

1

dijo

scriptable, curses-based, digital habit tracker
Rust
2,679
star
2

scientifica

tall, condensed, bitmap font for geeks
Vim Script
1,773
star
3

statix

lints and suggestions for the nix programming language
Rust
391
star
4

dotfiles

files that define my GNU/Linux box.
Vim Script
349
star
5

taizen

curses based mediawiki browser
Rust
289
star
6

pista

a simple {bash, zsh} prompt for programmers
Rust
193
star
7

curie

An upscaled version of scientifica.
183
star
8

fondant

macro based configuration management library
Rust
60
star
9

chestnut.vim

Minimal syntax highlighting for 16-color terminals.
Vim Script
31
star
10

nerdypepper.github.io

CSS
29
star
11

lotus

simple money and number formatting for rust
Rust
28
star
12

cutlass

experimental auto-currying for rust functions
Rust
27
star
13

site

my site and its generator
Shell
24
star
14

agila.vim

a port of the agila vs code colorscheme for vim
Vim Script
19
star
15

xcursorlocate

cursor location indicator for x11
Rust
16
star
16

lien

Screenshot / File uploader program
Shell
12
star
17

obi

the 1-bit image format
Rust
11
star
18

isostatic

minimal url shortner
Rust
8
star
19

nanoid

A single header nanoid implementation in C
C
6
star
20

aksh

an interactive shell
Rust
6
star
21

SongMonger

C++ program to view and play music
C++
6
star
22

orpheus

Read short stories in a super slick GUI
Rust
6
star
23

prompt

rewrite of pista with a fork of libps1
Rust
4
star
24

aoc

my solutions to AoC '19, in guile scheme
Scheme
3
star
25

unipack

vim plugin manager, for usage on outdated university PCs
Shell
3
star
26

nixos

nerdypepper's nixos configuration (mirrored from git.peppe.rs)
Nix
2
star
27

website-theme

Pelican theme for my website
CSS
2
star
28

rt-bench

Rust
2
star
29

conversations

nix flake to build conversations.im
Nix
2
star
30

rosetta-rs

a copy of my rust tasks for rosettacode.org
Rust
1
star
31

cursed_game

a curses based game-of-life universe
Rust
1
star
32

forma

format floating points to arbitrary bases
Rust
1
star
33

styles

CSS for some websites
CSS
1
star
34

spoiler

my solutions to problems on projecteuler.net
Rust
1
star
35

mush

an mpd repl
Rust
1
star