Picolab / Picolab/pico-engine

It would be really handy to have `math:hash` that could be used as an operator

Open
#604 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
TypeScript
Stars
51
Forks
10
Avg merge
4m
Merged PRs (30d)
1

Description

If we just rearranged the arguments, math:hash could be used as an operator. Put the string-to-be-hashed first, so that it is operated upon.

For example, instead of having to write:

      source_krl = http:get(url){"content"}
      source_hash = math:hash("sha256",source_krl)

we could use this one-liner:

      source_hash = http:get(url){"content"}.math:hash("sha256")

Granted, the current code could be written as a one-liner:

      source_hash = math:hash("sha256",http:get(url){"content"})

But that has to be read inside-out, which is not as convenient as the operator notation.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading the existing math:hash documentation and the KRL examples in the issue, then locate the parser or expression handling for operator notation in the pico-engine. Done means the string-first math:hash form works with the shown http:get(url){"content"} example while the existing function form remains supported.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
compilers
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.