Code Monkey home page Code Monkey logo

bool's People

Contributors

minond avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

wade-welles

bool's Issues

Using a returned sequence as an argument results in bad environment in sub computation

Here's an example where as soon as an expression is returned from a gate and then used again, it fails to evaluate:

$ bool
> .paste
< paste mode: on

gate Adder (a, b, c) = [sum, carry]
  where s_ab is a ⊕ b
    and c_ab is a ∧ b
    and c_ac is a ∧ c
    and c_bc is b ∧ c
    and carry is c_ab ∨ c_ac ∨ c_bc
    and sum is c ⊕ s_ab

gate Add8 (x, y) = sum
  where b07 is Adder(x(7), y(7), 0)
    and b06 is Adder(x(6), y(6), b07(1))
    and b05 is Adder(x(5), y(5), b06(1))
    and b04 is Adder(x(4), y(4), b05(1))
    and b03 is Adder(x(3), y(3), b04(1))
    and b02 is Adder(x(2), y(2), b03(1))
    and b01 is Adder(x(1), y(1), b02(1))
    and b00 is Adder(x(0), y(0), b01(1))
    and sum is [b00(0), b01(0), b02(0), b03(0), b04(0), b05(0), b06(0), b07(0)]

one is [0, 0, 0, 0, 0, 0, 0, 1]
two is Add8(one, one)

one
= Seq[8]{0, 0, 0, 0, 0, 0, 0, 1}

two
= Seq[8]{0, 0, 0, 0, 0, 0, 1, 0}

three is Add8(one, two)
three
< error: Cannot evaluate expression due to errors:
< error: Undefined gate `Adder`
< error: Undefined gate `Adder`
< error: Undefined gate `Adder`
< error: Undefined gate `Adder`
< error: Undefined gate `Adder`
< error: Undefined gate `Adder`
< error: Undefined gate `Adder`
< error: Undefined gate `Adder`
< error: Undefined gate `Adder`
< error: Undefined gate `Adder`
< error: Undefined gate `Adder`
< error: Undefined gate `Adder`
< error: Undefined gate `Adder`
< error: Undefined gate `Adder`
< error: Undefined gate `Adder`
< error: Undefined gate `Adder`
< error: Undefined gate `Adder`
< error: Undefined gate `Adder`
< error: Undefined gate `Adder`
< error: Undefined gate `Adder`
< error: Undefined gate `Adder`

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.