You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import std/[strformat, sequtils]
import comprehension
const
n =15let
numList =1.. n
numSeq = numList.toSeq
rightAngleTriangleSides: seq[tuple[a, b, c: int]] =
comp[for idx, sideA in numSeq:
for sideB in sideA .. n:
for sideC in sideB .. n:
if sideA*sideA + sideB*sideB == sideC*sideC:
(sideA, sideB, sideC)]
echo&"numList of type {$type(numList)} = {numList}"echo&"numSeq of type {$type(numSeq)} = {numSeq}"echo&"rightAngleTriangleSides of type {$type(rightAngleTriangleSides)} (seq[SEQ_TYPE]) = {rightAngleTriangleSides}"
Hello,
I started out trying to translate some
lc
(which is now deprecated) examples tocomp
, but I am completely lost where to begin.There are my
lc
examples: https://scripter.co/notes/nim/#lc-deprecatedIs it possible to write the equivalent using
comp
? If so, can you please add few examples to the README?Thanks.
The text was updated successfully, but these errors were encountered: