Giter Site home page Giter Site logo

juno's People

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

pwueje

juno's Issues

Function naming in type_set

#Member functions in type_set have confusing names and ideally (some of them) should be renamed. Here is how function currently map to mathematical concepts, starting with creation of sets.

  • let A be an empty set : using A = type_set<>
  • let A be set containing elements E and F : using A = type_set<E, F>
  • is A a subset of B ? B.is_in<A>()
  • is E an element of B ? B.is_in_setof<E>() (it is a shortcut for B.is_in<type_set<E>>())
  • are all of E, F, G elements of B ? B.is_in_setof<E, F, G>() (a shortcut for B.is_in<type_set<E, F, G>>())
  • is an empty set an element of B ? (guaranteed to be true, also when B is an empty set) B.is_in<type_set<>>() or B.is_in_setof<>()
  • is there a non-empty intersection of sets A and B ? (or in other words, is any of elements of B also in A) B.is_any<A>()(or reverse, obviously; note B.is_any<type_set<>>() is guaranteed to be false)
  • is any of elements E, F, G in B ? B.is_any_setof<E, F, G>() (it is a shortcut for B.is_any<type_set<E, F, G>>() ; note B.is_any_setof<>() are guaranteed to be false)
  • let C be an union of sets A and B : using C = decltype(A.join<B>()) (or typedef decltype(A.join<B>()) C, or reverse, obviously)
  • let C be an union of set A and an unnamed set with elements E and F: using C = decltype(A.join_setof<E, F>()) (it is a shortcut for using C = decltype(A.join<type_set<E, F>>()))
  • let C be an intersection of sets A and B : using C = decltype(A.cross<B>()) (or reverse, obviously)
  • let C be an intersection of set A and an unnamed set with elements E and F: using C = decltype(A.cross_setof<E, F>()) (it is a shortcut for using C = decltype(A.cross<type_set<E, F>>()))
  • let C be a relative complement of B in A : using C = decltype(A.less<B>())
  • let C be a relative complement of B in an unnamed set with elements E and F: using C = decltype(A.less_setof<E, F>()) (it is a shortcut for using C = decltype(A.less<type_set<E, F>>()))

Other function names seem OK, as they are consistent with other C++ libraries, for example:

  • are sets A and B equal: B.is_same<A>() (std::is_same is similar although lower-level concept)
  • is set A empty: A.empty()
  • number of elements in set A: A.size()

The challenge here is that I insist on names which are:

  1. consistent with other libraries (hence is_same , size and empty should stay) and
  2. which are concise (i.e. little typing involved) and
  3. internally consistent with other functions in type_set.

Functions which produce a new set should be verbs or mathematical terms. Last but not least, the function names should make sense mathematically, even if strict terminology is not followed (currently some of them do not make sense, e.g. is_in is in fact reverse to implied meaning).

There is no helping to verbosity of syntax when using the library, i.e. sharp brackets or keywords using ... decltype to return result from a function. This an unfortunate side effect of compile-time programming being an ugly duckling in the C++ language.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.