Skip to content

A sets library that provides notations of set theory (discrete math) by Nim

Notifications You must be signed in to change notification settings

nim-meta/math_sets

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

math-sets

Desc

A sets library that provides notations of set theory (discrete math)

Features

You can write set expression following (Assuming A, B are sets, R is a relation):

  • A ∩ B A ∪ B A ⊕ B
  • A × B
  • ran A, dom A, fld A
  • P(A)
  • R[A]
  • A/R
  • card A

A compile-time interpreter

Assuming you're in this current directory and ` is a source file written in math-like syntax (see below), you can run the interpreter with:

  • Unix: tools/interpreter.nims <setsStmtFile> (maybe after chmod +x tools/interpreter.nims)
  • Windows: tools\nimr <setsStmtFile>

in fact you can call it a rewriter or preprocessor instead of a interpreter

examples/simple_ex.nim.txt is a simple example for <setsStmtFile>.

interpreter-syntax

In short,

  • write as you do in mathematics: no need to write declaration via let or var
  • don't forget to freely use Nim syntax: e.g. echo A

About

A sets library that provides notations of set theory (discrete math) by Nim

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published