{"id":15860231,"url":"https://github.com/arabian9ts/convol","last_synced_at":"2025-04-01T20:32:15.077Z","repository":{"id":117469669,"uuid":"261720985","full_name":"arabian9ts/convol","owner":"arabian9ts","description":"functional convolution written in go.","archived":false,"fork":false,"pushed_at":"2020-05-06T10:06:43.000Z","size":8,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2023-03-06T12:49:16.742Z","etag":null,"topics":["convolutional","functions","golang","job"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/arabian9ts.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-05-06T10:06:22.000Z","updated_at":"2024-06-19T10:12:06.946Z","dependencies_parsed_at":"2023-07-17T14:38:03.628Z","dependency_job_id":null,"html_url":"https://github.com/arabian9ts/convol","commit_stats":null,"previous_names":[],"tags_count":0,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arabian9ts%2Fconvol","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arabian9ts%2Fconvol/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arabian9ts%2Fconvol/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arabian9ts%2Fconvol/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/arabian9ts","download_url":"https://codeload.github.com/arabian9ts/convol/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246709921,"owners_count":20821296,"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":["convolutional","functions","golang","job"],"created_at":"2024-10-05T21:43:07.788Z","updated_at":"2025-04-01T20:32:15.025Z","avatar_url":"https://github.com/arabian9ts.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Convol - functional convolution pkg writen in go.\n\n## What is Convol\nConvol implements functional convolution.\n\u003cdiv align=\"center\"\u003e\n  \u003cimg src=\"github/expr.png\" /\u003e\n\u003c/div\u003e\n\n## Why Convol ?\nWe offten writes early return with golang as following.\n\n```go\nfunc something() (err error) {\n  err = DoFuncA()\n  if err != nil {\n    return err\n  }\n\n  err = DoFuncB()\n  if err != nil {\n    return err\n  }\n\n  ...\n}\n```\n\nToo long function body reduces readability, but we should do it to ensure integrity.  \nConvol supports multi-functionals convolution writing.\n\n## Example\nWith Convol, you implement ConvolFunc as following.\n```go\nfunc handler(*convol.ConvolCtx) error {\n\tlog.Println(\"handler\")\n\treturn fmt.Errorf(\"error occurred\")\n}\n```\n\nAnd Chain handlers.\n```go\ncnvl := convol.New()\ncnvl.Add(\"handler1\", handler_1)\ncnvl.Add(\"handler2\", handler_2)\ncnvl.Add(\"handler3\", handler_3)\n```\n\nThen build functions and run.\n```go\ncnvl.Build()\nerr := cnvl.Do()\nfmt.Printf(\"err: %s\\n\", err)\ncnvl.DumpAllStatus()\n```\n\n## Run Order\nConvol runs functions in reverse order of adding.  \nIn this case, convol evaluate `g` first, then `f`.\n```go\ncnvl.Add(\"f\", handler_f)\ncnvl.Add(\"g\", handler_g)\n```\n\n## Run Level\nNow, Convol supports `StrictLevel` and `PermissiveLevel`.  \nBy default, Convol uses `StrictLevel` that cancels all later functions if err occured.  \nIf you want to run all functions regardless of errors, `PermissiveLevel` is good.\n\n## Result Propagation\nAfter evaluation of $g(x)$, $f(x)$ that run next can use result of $g(x)$.  \nTo use result of some function, you should use `Store` in `ConvolCtx`\n```go\nfunc g(ctx *ConvolCtx) error {\n  ctx.Store[\"prod-g\"] = \"result of g\"\n  return nil\n}\n\nfunc f(ctx *ConvolCtx) error {\n  gResult := ctx.Store[\"prod-g\"]\n  err := dosomething(gResult)\n  return err\n}\n```\n\nThen, add functions in reverse order of running.\n```go\ncnvl := convol.New()\ncnvl.Add(\"f\", f)\ncnvl.Add(\"g\", g)\ncnvl.Build()\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farabian9ts%2Fconvol","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Farabian9ts%2Fconvol","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farabian9ts%2Fconvol/lists"}