These are chat archives for evhub/coconut
@prepattern, I simply reversed the order of the matches, which also makes me wonder why you implemented
@prepatternin the first place. Anyway, the following works perfectly (which prints the first 10 primes)! Thanks!
def sieve([head] :: tail) = [head] :: sieve(n for n in tail if n % head) @addpattern(sieve) def sieve((||)) = (||) primes = count(2) |> sieve primes$[:10] |> list |*> print
@evhub On a separate not, I think your example in your documentation for Chain may be off. It works, but I’m guessing it’s not what you intended:
def N(n=0): return (0,) :: N(n+1) # no infinite loop because :: is lazy
I think you meant
return (n,), not
return (0,), no?
prepattern, you're right that it really isn't that useful, although it's occasionally nice for composing with pattern functions defined in other modules.
python src/runner.py. As for why they're in different repos--honestly, they really shouldn't be. That was how I did it when I was first setting everything up, but really I should move the tests back into the main repository.
@evhub Cool. I’ll give it a shot. Aside from pulling cocotest into the main repo, would you be up for refactoring the test using a testing framework, such as pytest (with possibly a mix of others, if/where it makes sense)? The reason I suggest this is that long lists of bare asserts may be a bit less descriptive/intuitive. Of course, I don’t want to make it overly complex, but one clear problem is that using bare asserts doesn’t allow for useful reporting/collections of multiple test failures. As soon as one fails, none of the following asserts are executed, so you only see one failure at a time.
Anywho, I’ll start with getting the existing tests running for myself before I do anything else. :-)
@evhub Coconut failed when compiling cocotest:
(cocotest) $ coconut --force . Coconut: Compiling extras.coco ... Coconut: Compiled to extras.py . Coconut: Compiling runner.coco ... Coconut: Compiled to runner.py . Coconut: Compiling __init__.coco ... Coconut: Compiled to __init__.py . Coconut: Compiling main.coco ... CoconutParseError: parsing failed (line 93) global (glob_a, glob_b) = (x, x) ^
This happens with Python 2.7 and Python 3.5.
@evhub Also, there appear to be undocumented dependencies, as there is no requirements file in the repo, but I got the following when attempting to run
python extras.py (yes, I tried to run even though the full compilation failed, as shown in the previous message):
(cocotest) $ python extras.py Traceback (most recent call last): File "extras.py", line 30, in <module> from coconut.icoconut import CoconutKernel File "/Users/charlie/miniconda3/envs/cocotest/lib/python2.7/site-packages/coconut/icoconut/__init__.py", line 19, in <module> from .root import * File "/Users/charlie/miniconda3/envs/cocotest/lib/python2.7/site-packages/coconut/icoconut/root.py", line 24, in <module> from ipykernel.kernelbase import Kernel ImportError: No module named ipykernel.kernelbase
What are all of the dependencies?
developCoconut instead of
masterCoconut, since that test is for in-line
nonlocalstatements, support for which is only in develop right now. The second error is because
jupyterkernel, which requires
jupyterto be installed. And I also completely agree about using
pytestinstead of just
toxor anything to determine what commands to run, I generate them using coconut-travis-generator, which is really derpy.