These are chat archives for evhub/coconut

31st
Jan 2019
terrdavis
@terrdavis
Jan 31 17:12

I have a similar issue to @leetschau. I've tried all the commands listed in the docs with the same result each time:

CoconutWarning: kernel install failed on command': 'ipython kernelspec install c:\\python37\\lib\\site-packages\\coconut\\icoconut\\coconut --replace'
CoconutWarning: kernel install failed on command': 'ipython kernelspec install c:\\python37\\lib\\site-packages\\coconut\\icoconut\\coconut2 --replace'
CoconutWarning: kernel install failed on command': 'ipython kernelspec install c:\\python37\\lib\\site-packages\\coconut\\icoconut\\coconut3 --replace'
Exiting due to Jupyter error.

Running Coconut: Version 1.4.0 [Ernest Scribbler] running on Python 3.7.2

This is my first time using functional syntax though, and I'm loving it!
Matthew Huie
@mphuie
Jan 31 18:16
Good morning - im running into a weird issue where piping an object to filter seems to be changing my object. I have a list of resources im trying to filter. However once it goes through the first filter, the list length gets set to 0.
``` resources = Resource.select().where(Resource.resource_type == 'ec2')
# has correct tag and is running!
syseng_managed = resources \
  |> filter$((resource) -> 'syseng-managed' in resource.tags and resource.tags['syseng-managed']) \
  |> filter$((resource) -> resource.metadata['state']['Name'] == 'running')

syseng_managed |> list |> len |> print

ssh_keys_applied = syseng_managed \
  |> filter$((resource) -> 'syseng-login-user' in resource.tags) \
  |> filter$((resource) -> resource.tags['syseng-login-user'] in ['ubuntu', 'root', 'ec2-user'])

syseng_managed |> list |> len |> print```
Matthew Huie
@mphuie
Jan 31 18:31
This is the output 49\n 0
I would think the print statements would both return 49 but it looks like the variable being piped into filter$ is getting changed somehow?
Matthew Huie
@mphuie
Jan 31 18:40
A runnable example
l = [1,2,3,4,5]
m = l |> filter$((i) -> i < 4)

m |> list |> len  |> print

n = m |> filter$((i) -> i < 2)

m |> list |> len |> print
in this case the first print statements returns m with a length of 3 , but after piping to filter, the 2nd print incidates the length of m is now 0