Skip to content

Repeat ​

Generated from the engine's own definition: compute-engine's symbol, which we neither extend nor document by hand.

Produce a sequence by repeating a single value. With 1 argument, returns an infinite sequence; with 2 arguments (value, count), returns a finite list of count copies.

✓ checked against that system · ! checked, with disagreements (hover a chip)FungrimRepeatWolfram LanguageConstantArray!
Repeat(value: any, count: integer?) -> listas compute-engine declares it
Typed signatures
TypePackageApplies
(value: any, count: integer?) -> listcompute-enginealways

Domain: Compute engine

Examples

Basic #

Repeats a symbol ten times

live ↗
InRepeat(c,10)\mathrm{Repeat}(c, 10)Out[c,c,c,c,c,c,c,c,c,c]\bigl\lbrack c, c, c, c, c, c, c, c, c, c\bigr\rbrack
Scope #

A list of ten zeros

live ↗
InRepeat(0,10)\mathrm{Repeat}(0, 10)Out[0,0,0,0,0,0,0,0,0,0]\bigl\lbrack0, 0, 0, 0, 0, 0, 0, 0, 0, 0\bigr\rbrack

A list of ten ones, handy as a weight vector

live ↗
InRepeat(1,10)\mathrm{Repeat}(1, 10)Out[1,1,1,1,1,1,1,1,1,1]\bigl\lbrack1, 1, 1, 1, 1, 1, 1, 1, 1, 1\bigr\rbrack
Applications #

A symbolic length makes the repeat empty, so the dot stays unevaluated with an empty list

live ↗
InDot(list,Repeat(1,Length(list)))\mathrm{Dot}(\mathrm{list}, \mathrm{Repeat}(1, \mathrm{Length}(\mathrm{list})))OutDot(list,[])\mathrm{Dot}(\mathrm{list}, \bigl\lbrack\bigr\rbrack)
Properties #
live ↗
InShape(Repeat(c,dims))\mathrm{Shape}(\mathrm{Repeat}(c, \mathrm{dims}))OutShape(Repeat(c,dims))\mathrm{Shape}(\mathrm{Repeat}(c, \mathrm{dims}))
About
Examples5
Checked againstWolfram Language 4 agree1 differ
CrosswalkFungrimWolfram Language