List comprehensions: Difference between revisions
Content deleted Content added
omit C |
Added Oz example. |
||
Line 261: | Line 261: | ||
etc.. |
etc.. |
||
=={{header|Oz}}== |
|||
Oz does not have list comprehension. |
|||
However, there is a list comprehension package available [http://oz-code.googlecode.com/files/ListComprehension.zip here]. It uses the <em>unofficial and deprecated</em> macro system. Usage example: |
|||
<lang oz>functor |
|||
import |
|||
LazyList |
|||
Application |
|||
System |
|||
define |
|||
fun {Pyth N} |
|||
<<list [X Y Z] with |
|||
X <- {List.number 1 N 1} |
|||
Y <- {List.number X N 1} |
|||
Z <- {List.number Y N 1} |
|||
where X*X + Y*Y == Z*Z |
|||
>> |
|||
end |
|||
{ForAll {Pyth 20} System.show} |
|||
{Application.exit 0} |
|||
end</lang> |
|||
=={{header|Perl}}== |
=={{header|Perl}}== |