Re: list comprehension

2019-02-24 Thread Brian Duggan
Yes, +1 and we have this documented on the py-to-perl6 nutshell page: https://docs.perl6.org/language/py-nutshell#List_comprehensions On Friday, February 22, Lucas Buchala wrote: > Hello folks. Did I understand correctly that this thread is about list > comprehension syntax in Perl 6? :

Re: list comprehension

2019-02-22 Thread Lucas Buchala
Hello folks. Did I understand correctly that this thread is about list comprehension syntax in Perl 6? :-) I don't if it was mentioned, but I think this syntax just simply works already. See an example: > say ($_~$_ if $_ %% 2 for ^10).Set set(00 22 44 66 88) > say ($_.item if $_

Re: list comprehension

2019-02-21 Thread Joan Pujol Tarrés
El Monday, 11 de February del 2019 a les 17:04, Brad Gilbert va escriure: >Actually I would suggest NOT adding Perl6, because the best way to >create a Set is not to use “list comprehension”, but to just call >`.Set` Ups :O .Thanks for the conceptual clarification. :D I will leave P

Re: list comprehension

2019-02-11 Thread Brad Gilbert
Actually I would suggest NOT adding Perl6, because the best way to create a Set is not to use “list comprehension”, but to just call `.Set` That whole page is about Set Builder Notation, but Perl6 doesn't actually have such a thing. You create a Set through a method call, or a subroutine call

Re: list comprehension

2019-02-11 Thread mimosinnet
Dear Brad, Thanks very much for the answer. I have been playing with your examples in the code below (and learned a lot!). Based on your insight, I would suggest these solutions to be added to the wikipedia: https://en.wikipedia.org/wiki/Set-builder_notation#Parallels_in_programming_languages

Re: list comprehension

2019-02-10 Thread Brad Gilbert
In {l for l in L} The reason it is in `{}` is to create a Set from iterating over `L`. > In Python, the set-builder's braces are replaced with square brackets, > parentheses, or curly braces, giving list, generator, and set objects, > respectively. So in Python: [ l for l in L ]

list comprehension

2019-02-10 Thread mimosinnet
Hi all, I wonder what would be the Perl notation for 'set-builders', as exposed in this wikipedia article: https://en.wikipedia.org/wiki/Set-builder_notation#Parallels_in_programming_languages This is the Python notation: Example 1: {l for l in L} Example 2: {(k, x) for k in K for x in X