Git Product home page Git Product logo

guac's People

Contributors

jadengeller avatar sasmith avatar

Stargazers

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

Watchers

 avatar  avatar  avatar

guac's Issues

Doesn't seem to work with pypy3 either...

Your example doesn't work with CPython, but it doesn't seem to work with pypy3 either:

dionyziz@puppy ~ % pypy3 4.py
Traceback (most recent call last):
  File "4.py", line 29, in <module>
    print(make_change(27, [1, 5, 10, 25]))
  File "/usr/local/Cellar/pypy3/7.3.1_1/libexec/site-packages/guac/monad.py", line 102, in monadic_context
    return monad._run(f(*args, **kwargs))
  File "/usr/local/Cellar/pypy3/7.3.1_1/libexec/site-packages/guac/monad.py", line 49, in _run
    return step(next(computation), computation)
  File "/usr/local/Cellar/pypy3/7.3.1_1/libexec/site-packages/guac/monad.py", line 47, in step
    return self.bind(monadic_value, proceed)
  File "/usr/local/Cellar/pypy3/7.3.1_1/libexec/site-packages/guac/instances.py", line 32, in bind
    result += f(elem)
  File "/usr/local/Cellar/pypy3/7.3.1_1/libexec/site-packages/guac/monad.py", line 40, in proceed
    invocation = copy.deepcopy(continuation) # Requires Pypy!
  File "/usr/local/Cellar/pypy3/7.3.1_1/libexec/lib-python/3/copy.py", line 180, in deepcopy
    y = _reconstruct(x, memo, *rv)
  File "/usr/local/Cellar/pypy3/7.3.1_1/libexec/lib-python/3/copy.py", line 274, in _reconstruct
    y = func(*args)
  File "/usr/local/Cellar/pypy3/7.3.1_1/libexec/lib-python/3/copyreg.py", line 88, in __newobj__
    return cls.__new__(cls, *args)
TypeError: object.__new__(generator) is not safe, use generator.__new__()

I'm using this version:

Python 3.6.9 (?, Apr 18 2020, 02:46:07)
[PyPy 7.3.1 with GCC 4.2.1 Compatible Apple LLVM 11.0.3 (clang-1103.0.32.59)]

Does it work?

$ ipython
Python 3.7.2 (default, Feb 10 2019, 16:01:44)
Type 'copyright', 'credits' or 'license' for more information
IPython 7.3.0 -- An enhanced Interactive Python. Type '?' for help.

In [1]: from guac import *
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-1-2744c8a09bb7> in <module>
----> 1 from guac import *

~/.virtualenvs/monads-3hJ3DB7g/lib/python3.7/site-packages/guac/__init__.py in <module>
      1 from .monad import *
      2 from .instances import *
----> 3 from .functions import *

~/.virtualenvs/monads-3hJ3DB7g/lib/python3.7/site-packages/guac/functions.py in <module>
      1 from .monad import *
      2
----> 3 @monadic
      4 def bind(m, f):
      5     """

~/.virtualenvs/monads-3hJ3DB7g/lib/python3.7/site-packages/guac/monad.py in monadic(instance)
    103         return monadic_context
    104
--> 105     if issubclass(instance, Monad):
    106         return lambda f: wrap(f, monad=instance)
    107     elif not callable(instance):

~/.virtualenvs/monads-3hJ3DB7g/lib/python3.7/abc.py in __subclasscheck__(cls, subclass)
    141         def __subclasscheck__(cls, subclass):
    142             """Override for issubclass(subclass, cls)."""
--> 143             return _abc_subclasscheck(cls, subclass)
    144
    145         def _dump_registry(cls, file=None):

TypeError: issubclass() arg 1 must be a class

In [2]: %debug
> /Users/paul/.virtualenvs/monads-3hJ3DB7g/lib/python3.7/abc.py(143)__subclasscheck__()
    141         def __subclasscheck__(cls, subclass):
    142             """Override for issubclass(subclass, cls)."""
--> 143             return _abc_subclasscheck(cls, subclass)
    144
    145         def _dump_registry(cls, file=None):

ipdb> cls
<class 'guac.monad.Monad'>
ipdb> subclass
<function bind at 0x10934b730>
ipdb> u
> /Users/paul/.virtualenvs/monads-3hJ3DB7g/lib/python3.7/site-packages/guac/monad.py(105)monadic()
    103         return monadic_context
    104
--> 105     if issubclass(instance, Monad):
    106         return lambda f: wrap(f, monad=instance)
    107     elif not callable(instance):

ipdb> instance
<function bind at 0x10934b730>
ipdb> issubclass(instance, Monad)
*** TypeError: issubclass() arg 1 must be a class
ipdb> u
> /Users/paul/.virtualenvs/monads-3hJ3DB7g/lib/python3.7/site-packages/guac/functions.py(3)<module>()
      1 from .monad import *
      2
----> 3 @monadic
      4 def bind(m, f):
      5     """

ipdb>
$ pip freeze | grep guac
guac==1.0.0

Still doesn't work

ython 3.5.3 (a39af0be3a22, Jun 05 2017, 20:18:00)
[PyPy 5.8.0-beta0 with GCC 6.2.0 20160901] on linux
Type "help", "copyright", "credits" or "license" for more information.
And now for something completely different: ``why there is no "PyPy 1.4
released" in topic any more?''
>>>> guac.py
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'guac' is not defined
>>>> execfile("guac.py")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
NameError: name 'execfile' is not defined
>>>> exec(open("guac.py").read(),globals())
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<string>", line 158, in <module>
  File "<string>", line 103, in monadic_context
  File "<string>", line 50, in _run
  File "<string>", line 48, in step
  File "<string>", line 129, in bind
  File "<string>", line 41, in proceed
  File "/home/user/pypy3/lib-python/3/copy.py", line 182, in deepcopy
    y = _reconstruct(x, rv, 1, memo)
  File "/home/user/pypy3/lib-python/3/copy.py", line 292, in _reconstruct
    y = callable(*args)
  File "/home/user/pypy3/lib-python/3/copyreg.py", line 88, in __newobj__
    return cls.__new__(cls, *args)
TypeError: object.__new__(generator) is not safe, use generator.__new__()

@JadenGeller I'm using pypy3.

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.