Code Monkey home page Code Monkey logo

random-js's People

Contributors

jrus avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

random-js's Issues

Value "state" has no method 'isArray'

Thanks for making this, I need it!

It doesn't run for me. I tried compiling (coffee -c) and just plain running. Same error (below). Unfortunately I'm a total CoffeeScript/JS newb so I can't provide a helpful bug report. I'm on OSX 10.6.

> coffee --version             ~/Documents/dev/coffeescript-tests
CoffeeScript version 1.3.1
> coffee random.coffee             ~/Documents/dev/coffeescript-tests
TypeError: In random.coffee, Object 
Splat
  Value "state" has no method 'isArray'
    at Param.names (/usr/local/lib/node_modules/coffee-script/lib/coffee-script/nodes.js:1907:24)
    at Code.paramNames (/usr/local/lib/node_modules/coffee-script/lib/coffee-script/nodes.js:1819:39)
    at Code.compileNode (/usr/local/lib/node_modules/coffee-script/lib/coffee-script/nodes.js:1708:20)
    at Code.compile (/usr/local/lib/node_modules/coffee-script/lib/coffee-script/nodes.js:48:21)
    at Assign.compileNode (/usr/local/lib/node_modules/coffee-script/lib/coffee-script/nodes.js:1519:24)
    at Assign.compile (/usr/local/lib/node_modules/coffee-script/lib/coffee-script/nodes.js:48:21)
    at Block.compileNode (/usr/local/lib/node_modules/coffee-script/lib/coffee-script/nodes.js:311:23)
    at Block.compileWithDeclarations (/usr/local/lib/node_modules/coffee-script/lib/coffee-script/nodes.js:395:19)
    at Code.compileNode (/usr/local/lib/node_modules/coffee-script/lib/coffee-script/nodes.js:1800:35)
    at Code.compile (/usr/local/lib/node_modules/coffee-script/lib/coffee-script/nodes.js:48:21)

@choice([1]) takes > 1 minute while @choice([1,2]) takes less than a second

I'm using Random.choice() to select from a list of one or more items generated at random. Quite frequently the lists were of length 1, but the script would stall on the choice. I can work around it by adding a length check, and taking the [0] of the list if it is length 1 and otherwise using choice, but it seems like an issue the library might face a lot.

I think any function that depends upon @_randbelow will suffer from this problem too.

I've already forked and started writing a fix. Is there a test script?

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.