タグ

関連タグで絞り込む (2)

タグの絞り込みを解除

programming-languageとlist-comprehensionに関するnabinnoのブックマーク (2)

  • リスト内包表記 - Wikipedia

    リスト内包表記とは、一部のプログラミング言語で使用可能な構文構造であり、既存のリストから新たなリストを作成するために用いられるものである。 これは、 map関数やfilter関数などとは異なり、数学における集合内包表記 (en:Set-builder notation) に準拠したものである。 次の集合内包表記の例を考える。 あるいは この表記は、「は、が自然数の集合 () の元であり、かつの二乗がより大きいようなすべての『の2倍』なる数」を意味する。 最小の自然数x=1は、条件x2>3を満たさない(12>3は偽)ため、2・1はSに含まれない。次の自然数2は、条件を満たす(22>3)。他のすべての自然数も同様である。 したがって、xは 2, 3, 4, 5... で構成される。集合Sは「xの2倍」なるすべての数値で構成されるため、S = {4, 6, 8, 10...} で与えられる。言い

  • List comprehension - Wikipedia

    A list comprehension is a syntactic construct available in some programming languages for creating a list based on existing lists. It follows the form of the mathematical set-builder notation (set comprehension) as distinct from the use of map and filter functions. Consider the following example in mathematical set-builder notation. or often This can be read, " is the set of all numbers "2 times "

  • 1