{"id":13862554,"url":"https://github.com/zk-phi/rpn-calc","last_synced_at":"2025-04-14T13:05:58.548Z","repository":{"id":27395482,"uuid":"30871795","full_name":"zk-phi/rpn-calc","owner":"zk-phi","description":"Handy RPN calculator for hackers","archived":false,"fork":false,"pushed_at":"2021-03-06T04:26:46.000Z","size":874,"stargazers_count":12,"open_issues_count":0,"forks_count":3,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-08-05T06:06:02.048Z","etag":null,"topics":["emacs"],"latest_commit_sha":null,"homepage":"","language":"Emacs Lisp","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zk-phi.png","metadata":{"files":{"readme":"Readme.org","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-02-16T14:29:41.000Z","updated_at":"2024-01-19T10:20:34.000Z","dependencies_parsed_at":"2022-09-02T04:52:53.010Z","dependency_job_id":null,"html_url":"https://github.com/zk-phi/rpn-calc","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zk-phi%2Frpn-calc","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zk-phi%2Frpn-calc/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zk-phi%2Frpn-calc/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zk-phi%2Frpn-calc/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zk-phi","download_url":"https://codeload.github.com/zk-phi/rpn-calc/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223634003,"owners_count":17176871,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["emacs"],"created_at":"2024-08-05T06:01:47.281Z","updated_at":"2024-11-08T04:35:08.060Z","avatar_url":"https://github.com/zk-phi.png","language":"Emacs Lisp","funding_links":[],"categories":["Emacs Lisp"],"sub_categories":[],"readme":"* rpn-calc.el\n\nプログラマ向け RPN 電卓\n\nquick RPN calculator for hackers\n\n** Screencast\n\n[[img/screencast.gif]]\n\n** NOTE: Breaking changes in the latest version\n*** Quote (') behavior for symbols are changed\n\n|                 | NOT quoted (foo)           | quoted ('foo)  | function-quoted (#'foo) |\n|-----------------+----------------------------+----------------+-------------------------|\n| last version    | variable \"foo\"             | function \"foo\" | symbol \"foo\"            |\n| current version | function or variable \"foo\" | symbol \"foo\"   | symbol \"foo\"           |\n\nPros: functions also can be called without prefixing quotes ('), and\nfunction quote (#') is no longer required to push raw symbols\n\nCons: if a name is both defined as function and variable, it's not\npossible to refer the variable definition\n\n- Function call examples\n  - last version\n\n    : random   -\u003e ERROR: void variable \"random\"\n    : 'random  -\u003e 12345\n    : #'random -\u003e random\n\n  - current version\n\n    : random   -\u003e 12345\n    : 'random  -\u003e random\n\n- Variable reference examples\n  - last version\n\n    : default-directory   -\u003e \"~/\"\n    : 'default-directory  -\u003e void function \"default-directory\"\n    : #'default-directory -\u003e default-directory\n\n  - current version\n\n    : default-directory   -\u003e \"~/\"\n    : 'default-directory  -\u003e default-diectory\n\n** Advantages\n\n=rpn-calc= is designed to be a handy tool for daily programming\nuse.\n\n- =rpn-calc= uses popup instead of making a new window, and you don't\n  need to move your eyes between the edit point and the calculator\n  window\n\n- =rpn-calc= displays hints like binary representation of numbers,\n  which may be useful for programmers\n\n- =rpn-calc= is designed to be used with minimal key presses.\n\n- =rpn-calc= is easy to customize. You can add/remove some operators\n  with just one or two lines of Emacs Lisp\n\n- You can push not only numbers but any Emacs Lisp objects to the\n  stack, and you can apply any Emacs Lisp function to them. So\n  =rpn-calc= can also be used as an interactive, RPN version of\n  =eval-expression=\n\nSee also \"Other Features\" section.\n\n** Installation\n\nRequire this script\n\n: (require 'rpn-calc)\n\nand invoke with =M-x rpn-calc=.\n\n** Tutorial\n\n1. You can push objects by pressing =[SPC]= after entering an\n   S-expression (try: =120[SPC]=). You can also push more complex\n   expressisons like =(buffer-name (current-buffer))[SPC]=, or quoted\n   expressions\n\n   Pro tip: in Emacs, =#xFF= = =#b11111111= = =255=\n\n2. When you enter an operator name, top elements in the stack are\n   popped and applied to the operator (try: =1[SPC]sin=). List of\n   built-in operators are listed in the section below. You can add\n   some operators by pushing list like =(NAME ARITY . FUNCTION)= to\n   =rpn-calc-operator-table=\n\n   : (push '(\"twice\" 1 . (lambda (x) (* x 2))) rpn-calc-operator-table)\n\n3. You can also push a function name to call it (try:\n   =10[SPC]number-to-string[SPC]=), or a variable name to refer it\n   (try =most-positive-fixnum[SPC]=). If the function accepts =\u0026rest=\n   arguments, all elements in the stack are passed (try:\n   =10[SPC]20[SPC]30[SPC]list[SPC]=). This behavior can be changed via\n   =rpn-calc-apply-rest-args=. Note that if a symbol is both defined\n   as function and variable, function definition takes precedence\n\n** Built-in Operators\n\n- math\n  - + :: pop =y=, =x= and push =(+ x y)=\n  - -- :: pop =y=, =x= and push =(- x y)=\n  - / :: pop =y=, =x= and push =(/ x y)=\n  - * :: pop =y=, =x= and push =(* x y)=\n  - % :: pop =y=, =x= and push =(mod x y)= (modulo)\n  - sin :: pop =x= and push =(sin x)= (sine)\n  - cos :: pop =x= and push =(cos x)= (cosine)\n  - tan :: pop =x= and push =(tan x)= (tangent)\n  - ln :: pop =x= and push =(log x)= (natural log)\n  - lg :: pop =x= and push =(log x 10)= (log base 10)\n  - log :: pop =y=, =x= and push =(log y x)= (log base x)\n\n- bitwise\n  - \u0026 :: pop =y=, =x= and push =(logand x y)= (bitwise and)\n  - | :: pop =y=, =x= and push =(logor x y)= (bitwise or)\n  - ^ :: pop =y=, =x= and push =(logxor x y)= (bitwise xor)\n  - ~ :: pop =x= and push =(lognot x)= (bitwise not)\n  - \u003c\u003c :: pop =y=, =x= and push =(ash x y)= (shift left)\n  - \u003e\u003e :: pop =y=, =x= and push =(ash x (- y))= (shift right)\n\n- int \u003c-\u003e float\n  - float :: pop =x= and push =(float x)= (int -\u003e float)\n  - int :: pop =x= and push =(truncate x)= (float -\u003e int)\n  - trunc :: pop =x= and push =(truncate x)= (round toward zero)\n  - floor :: pop =x= and push =(floor x)= (largest integer \u003c x)\n  - ceil :: pop =x= and push =(ceil x)= (smallest integer \u003e x)\n  - round :: pop =x= and push =(round x)= (nearest integer to x)\n\n- stack manipulation\n  - \u003cBackspace\u003e :: pop an item\n  - : :: pop =x=, and push =x= twice (duplicate)\n  - \\ :: pop =x=, =y= and push =y=, =x= (swap)\n\n** Features\n\n- Implicit \"SPC\"\n\n  rpn-calc automatically pushes the input (without pressing \"SPC\") to\n  reduce keypresses, when :\n\n  - non-digit character is entered after a number ::\n\n    Example: =1evenp[SPC]= is equivalent to =1[SPC]evenp[SPC]=.\n\n  - outer-most closing paren is entered ::\n\n    Example: =(1+ (point))= is equivalent to =(1+ (point))[SPC]=.\n\n  - build-in operator name is completed ::\n\n    Example: =1sin= is equivalent to =1[SPC]sin[SPC]=.\n\n- Display hints for inserted objects\n\n  - hex/binary representation of integers\n\n  - IEEE754 representation of floating-point numbers\n\n  - arglist of functions\n\n  - variable value of symbols\n\n- Push buffer string to the stack\n\n  You can push expressions in a buffer to the stack by selecting the\n  expression before invoking =rpn-calc=\n\n- Insert result to the buffer\n\n  You can insert the result by pressing =RET= in =rpn-calc=\n\n- Push items into middle of the stack.\n\n  You can move cursor with =rpn-calc-next= (bound to =C-n= by default)\n  and =rpn-calc-previous= (=C-p= resp.) while in =rpn-calc=, to insert\n  items into middle of the stack (try: =1[SPC]2[SPC]3[C-n][SPC]=)\n\n** Dependencies\n\n- popup.el\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzk-phi%2Frpn-calc","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzk-phi%2Frpn-calc","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzk-phi%2Frpn-calc/lists"}