Git Product home page Git Product logo

nimrod-vectors's People

Contributors

blamestross avatar

Watchers

 avatar  avatar

Forkers

apense

nimrod-vectors's Issues

workaround for static[int]

consider using something like this, to get around static[int] not working in types, instead a vector of two would be Vector[range[0..1]] and length becomes a static property

type
  Vector[R] = object
    deltas: array[R, float]


proc initVector* (len:static[int]): auto =
  return Vector[range[0 .. <len]]()

proc `[]`* [R] (vec:Vector[R]; idx:R): float = 
  vec.deltas[idx]
proc `[]=`*[R] (vec:var Vector[R]; idx:R; val:float) = 
  vec.deltas[idx] = val

proc `$`* [R] (vec:Vector[R]): string =
  result = "["
  for idx,it in vec.deltas.pairs:
    result.add($it)
    if idx < vec.deltas.high: result.add ", "
  result.add "]"

when isMainModule:
  var v = initVector(2)
  v[0] = 0.5
  v[1] = 1.0
  echo v

You have won a FREE new documentation website!

Congratulations!!!

The GitHub(notreally) team has awarded you with the needed website of the week. If you want to win a lot of FAME and rock EVERYWHERE you go, please follow these steps to claim your new and FREE documentation website:

  • Install gh_nimrod_doc_pages typing babel install gh_nimrod_doc_pages.
  • $ cd path/to/your/git/checkout
  • $ git checkout --orphan gh-pages
  • $ git rm -rf .
  • $ gh_nimrod_doc_pages -b
  • Modify the gh_nimrod_doc_pages.ini file to contain the following lines:
["gh-pages"]
update_html=index.html
doc_dir=docs
branches="""
master
"""
  • $ gh_nimrod_doc_pages -c .
  • $ git add . && git commit -v
  • $ git push --set-upstream origin gh-pages

Enjoy your new FREE website for your project!!!

Disclaimers:

  • FREE website offer valid only until stocks last.
  • AWESOME prize instructions only verified under MacOSX.

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.