{"id":17086531,"url":"https://github.com/junjihashimoto/th-cas","last_synced_at":"2025-04-12T21:41:11.657Z","repository":{"id":30152377,"uuid":"33702604","full_name":"junjihashimoto/th-cas","owner":"junjihashimoto","description":"Compile time CAS(Computer Algebra System) for Haskell","archived":false,"fork":false,"pushed_at":"2019-11-27T17:30:11.000Z","size":174,"stargazers_count":17,"open_issues_count":0,"forks_count":1,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-26T15:48:15.255Z","etag":null,"topics":["algebra","cas","computer-algebra","haskell"],"latest_commit_sha":null,"homepage":"","language":"Haskell","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/junjihashimoto.png","metadata":{"files":{"readme":"README.md","changelog":"ChangeLog.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-04-10T01:54:39.000Z","updated_at":"2023-09-05T13:46:38.000Z","dependencies_parsed_at":"2022-09-09T16:21:57.799Z","dependency_job_id":null,"html_url":"https://github.com/junjihashimoto/th-cas","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/junjihashimoto%2Fth-cas","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/junjihashimoto%2Fth-cas/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/junjihashimoto%2Fth-cas/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/junjihashimoto%2Fth-cas/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/junjihashimoto","download_url":"https://codeload.github.com/junjihashimoto/th-cas/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248637832,"owners_count":21137538,"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":["algebra","cas","computer-algebra","haskell"],"created_at":"2024-10-14T13:28:53.870Z","updated_at":"2025-04-12T21:41:11.616Z","avatar_url":"https://github.com/junjihashimoto.png","language":"Haskell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# th-cas : Compile-time CAS(Computer Algebra System)\n\n[![Hackage version](https://img.shields.io/hackage/v/th-cas.svg?style=flat)](https://hackage.haskell.org/package/th-cas)  [![Build Status](https://travis-ci.org/junjihashimoto/th-cas.png?branch=master)](https://travis-ci.org/junjihashimoto/th-cas)\n\nCAS(Computer Algebra System) operations like diff are done at compile-time.\nCompile time operations is done in TemplateHaskell.\n\n## Interactive Usage\n\n```th-cas``` supports interactive usage like mathematica.\nTo start repl, type \"stack ghci\".\n\nVariables are defined by ```V``` of data-constructor.\n\nA example of intertative usage is below.\n\n```\n$ stack ghci\n...\n*Algebra.CAS\u003e \n*Algebra.CAS\u003e let x = V \"x\" \n*Algebra.CAS\u003e let y = V \"y\" \n*Algebra.CAS\u003e x^2 + 2*x + x^2\n2*x + 2*(x^2)\n*Algebra.CAS\u003e diff (x^2 + 2*x + x^2) x\n2 + 4*x\n*Algebra.CAS\u003e linsolve [x+y=:2,x-y=:3]\nJust [(x,5/2),(y,-1/2)]\n*Algebra.CAS\u003e subst [(x,1)] $ diff (x^2 + 2*x + x^2) x\n6\n```\n\n## Usage at compile time\n\nWrite ```diff function var``` with Quotes of TemplateHaskell.\n```diff``` makes a diffirential of the function at compile-time.\nSo there is no overhead at execution-time.\n\nA example is below.\n\nWrite following code with quotes.\n\n```\nimport Algebra.CAS.TH\n\nmyfunc :: Int -\u003e Int\nmyfunc x = $(diff [|x*x+2*x+1|] [|x|])\n```\n\nAt compile time, the quotes is translated to ```2*x+2```.\n\n```\nimport Algebra.CAS.TH\n\nmyfunc :: Int -\u003e Int\nmyfunc x = 2*x+2\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjunjihashimoto%2Fth-cas","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjunjihashimoto%2Fth-cas","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjunjihashimoto%2Fth-cas/lists"}