nth-unsafe ( n seq -- elt )
Factor documentation > Factor handbook > The language > Collections > Sequence operations > Sequence protocol
Prev:nth ( n seq -- elt )
Next:set-nth ( elt n seq -- )


Vocabulary
sequences.private

Inputs and outputs
nan integer
seqa sequence
eltan object


Generic word contract
Unsafe variant of nth that does not perform bounds checks.

Definition
IN: sequences.private

GENERIC: nth-unsafe ( n seq -- elt ) flushable


Methods
USING: accessors alien.c-types elf sequences.private
specialized-arrays.instances.elf.Elf32_Phdr ;

M: Elf32_Phdr-array nth-unsafe
underlying>> \ Elf32_Phdr alien-element ; inline


USING: accessors alien.c-types elf sequences.private
specialized-arrays.instances.elf.Elf32_Shdr ;

M: Elf32_Shdr-array nth-unsafe
underlying>> \ Elf32_Shdr alien-element ; inline


USING: accessors alien.c-types elf sequences.private
specialized-arrays.instances.elf.Elf32_Sym ;

M: Elf32_Sym-array nth-unsafe
underlying>> \ Elf32_Sym alien-element ; inline


USING: accessors alien.c-types elf sequences.private
specialized-arrays.instances.elf.Elf64_Phdr ;

M: Elf64_Phdr-array nth-unsafe
underlying>> \ Elf64_Phdr alien-element ; inline


USING: accessors alien.c-types elf sequences.private
specialized-arrays.instances.elf.Elf64_Shdr ;

M: Elf64_Shdr-array nth-unsafe
underlying>> \ Elf64_Shdr alien-element ; inline


USING: accessors alien.c-types elf sequences.private
specialized-arrays.instances.elf.Elf64_Sym ;

M: Elf64_Sym-array nth-unsafe
underlying>> \ Elf64_Sym alien-element ; inline


USING: arrays kernel math sequences.private ;

M: array nth-unsafe [ integer>fixnum ] dip array-nth ; inline


USING: bit-arrays bit-arrays.private kernel math
sequences.private ;

M: bit-array nth-unsafe bit-index nth-unsafe swap bit? ; inline


USING: accessors kernel math math.bits sequences.private ;

M: bits nth-unsafe number>> swap bit? ; inline


USING: accessors alien alien.c-types combinators kernel math
math.blas.matrices math.blas.vectors math.blas.vectors.private
sequences.private ;

M: blas-matrix-rowcol-sequence nth-unsafe
{
[
[ rowcol-jump>> ]
[ parent>> element-type heap-size ]
[ parent>> underlying>> ] tri [ * * ] dip
<displaced-alien>
]
[ rowcol-length>> ]
[ inc>> ]
[ parent>> ]
} cleave (blas-vector-like) ;


USING: accessors alien.c-types benchmark.nbody-simd
sequences.private
specialized-arrays.instances.benchmark.nbody-simd.body ;

M: body-array nth-unsafe underlying>> \ body alien-element
; inline


USING: accessors alien.c-types gpu.demos.bunny
sequences.private
specialized-arrays.instances.gpu.demos.bunny.bunny-vertex-struct
;

M: bunny-vertex-struct-array nth-unsafe
underlying>> \ bunny-vertex-struct alien-element ; inline


USING: alien.accessors byte-arrays kernel math
sequences.private ;

M: byte-array nth-unsafe
swap integer>fixnum alien-unsigned-1 ; inline


USING: cpu.architecture generic kernel math.vectors.simd
math.vectors.simd.intrinsics math.vectors.simd.private
sequences.private ;

M: char-16 nth-unsafe
swap \ char-16-rep
[ (simd-select) ]
[ M\ char-16 nth-unsafe (call-next-method) ] vx->x-op ;
inline


USING: accessors alien.c-types sequences.private
specialized-arrays.instances.alien.c-types.char ;

M: char-array nth-unsafe underlying>> \ char alien-element
; inline


USING: accessors assocs kernel sequences.private tools.memory
tools.memory.private ;

M: code-blocks nth-unsafe
[ cache>> ] [ blocks>> ] bi
[ nth-unsafe <code-block> ] curry cache ; inline


USING: accessors kernel math.combinatorics sequences.private ;

M: combinations nth-unsafe [ seq>> ] [ k>> ] bi combination ;


USING: sequences.complex-components
sequences.complex-components.private sequences.private ;

M: complex-components nth-unsafe
complex-components@ nth-unsafe complex-component ;


USING: accessors alien.c-types alien.complex sequences.private
specialized-arrays.instances.alien.complex.complex-double ;

M: complex-double-array nth-unsafe
underlying>> \ complex-double alien-element ; inline


USING: accessors alien.c-types alien.complex sequences.private
specialized-arrays.instances.alien.complex.complex-float ;

M: complex-float-array nth-unsafe
underlying>> \ complex-float alien-element ; inline


USING: kernel math math.functions sequences.complex
sequences.complex.private sequences.private ;

M: complex-sequence nth-unsafe
complex@ [ nth-unsafe ] [ [ 1 + ] dip nth-unsafe ] 2bi
rect> ;


USING: accessors alien.c-types chipmunk.ffi sequences.private
specialized-arrays.instances.chipmunk.ffi.cpContact ;

M: cpContact-array nth-unsafe
underlying>> \ cpContact alien-element ; inline


USING: accessors alien.c-types chipmunk.ffi sequences.private
specialized-arrays.instances.chipmunk.ffi.cpPolyShapeAxis ;

M: cpPolyShapeAxis-array nth-unsafe
underlying>> \ cpPolyShapeAxis alien-element ; inline


USING: accessors alien.c-types chipmunk.ffi sequences.private
specialized-arrays.instances.chipmunk.ffi.cpVect ;

M: cpVect-array nth-unsafe
underlying>> \ cpVect alien-element ; inline


USING: accessors alien.data.map.private combinators math
sequences.private ;

M: data-map-param nth-unsafe
{
[ iter-length>> * >fixnum ]
[ bytes>> ]
[ count>> ]
[ c-type>> ]
} cleave <displaced-direct-array> ; inline


USING: cpu.architecture generic kernel math.vectors.simd
math.vectors.simd.intrinsics math.vectors.simd.private
sequences.private ;

M: double-2 nth-unsafe
swap \ double-2-rep
[ (simd-select) ]
[ M\ double-2 nth-unsafe (call-next-method) ] vx->x-op ;
inline


USING: accessors alien.c-types math.vectors.simd.cords
sequences.private
specialized-arrays.instances.math.vectors.simd.cords.double-4 ;

M: double-4-array nth-unsafe
underlying>> \ double-4 alien-element ; inline


USING: accessors alien.c-types sequences.private
specialized-arrays.instances.alien.c-types.double ;

M: double-array nth-unsafe
underlying>> \ double alien-element ; inline


USING: accessors arrays assocs kernel sequences.private ;

M: enum nth-unsafe dupd seq>> nth-unsafe 2array ; inline


USING: accessors alien.c-types sequences.private
specialized-arrays.instances.unix.linux.epoll.epoll-event
unix.linux.epoll ;

M: epoll-event-array nth-unsafe
underlying>> \ epoll-event alien-element ; inline


USING: accessors kernel math sequences.extras sequences.private
;

M: evens nth-unsafe [ 2 * ] [ seq>> nth-unsafe ] bi* ; inline


USING: kernel sequences.private ;

M: f nth-unsafe nip ; inline


USING: accessors alien.c-types macho sequences.private
specialized-arrays.instances.macho.fat_arch ;

M: fat_arch-array nth-unsafe
underlying>> \ fat_arch alien-element ; inline


USING: accessors alien.c-types math.vectors.simd
sequences.private
specialized-arrays.instances.math.vectors.simd.float-4 ;

M: float-4-array nth-unsafe
underlying>> \ float-4 alien-element ; inline


USING: cpu.architecture generic kernel math.vectors.simd
math.vectors.simd.intrinsics math.vectors.simd.private
sequences.private ;

M: float-4 nth-unsafe
swap \ float-4-rep
[ (simd-select) ]
[ M\ float-4 nth-unsafe (call-next-method) ] vx->x-op ;
inline


USING: accessors alien.c-types sequences.private
specialized-arrays.instances.alien.c-types.float ;

M: float-array nth-unsafe
underlying>> \ float alien-element ; inline


USING: accessors alien.c-types game.loop.benchmark
sequences.private
specialized-arrays.instances.game.loop.benchmark.game-loop-benchmark
;

M: game-loop-benchmark-array nth-unsafe
underlying>> \ game-loop-benchmark alien-element ; inline


USING: accessors growable sequences.private ;

M: growable nth-unsafe underlying>> nth-unsafe ; inline


USING: accessors alien.c-types math.floats.half
sequences.private
specialized-arrays.instances.math.floats.half.half ;

M: half-array nth-unsafe underlying>> \ half alien-element
; inline


USING: cpu.architecture generic kernel math.vectors.simd
math.vectors.simd.intrinsics math.vectors.simd.private
sequences.private ;

M: int-4 nth-unsafe
swap \ int-4-rep
[ (simd-select) ]
[ M\ int-4 nth-unsafe (call-next-method) ] vx->x-op ;
inline


USING: accessors alien.c-types sequences.private
specialized-arrays.instances.alien.c-types.int ;

M: int-array nth-unsafe underlying>> \ int alien-element ;
inline


USING: kernel sequences sequences.private ;

M: iota-tuple nth-unsafe drop ; inline


USING: accessors game.input.dinput.keys-array sequences.private
;

M: keys-array nth-unsafe underlying>> nth-unsafe >key ;


USING: accessors alien.c-types libusb sequences.private
specialized-arrays.instances.libusb.libusb_iso_packet_descriptor
;

M: libusb_iso_packet_descriptor-array nth-unsafe
underlying>> \ libusb_iso_packet_descriptor alien-element ;
inline


USING: accessors alien.c-types sequences.private
specialized-arrays.instances.alien.c-types.long ;

M: long-array nth-unsafe underlying>> \ long alien-element
; inline


USING: cpu.architecture generic kernel math.vectors.simd
math.vectors.simd.intrinsics math.vectors.simd.private
sequences.private ;

M: longlong-2 nth-unsafe
swap \ longlong-2-rep
[ (simd-select) ]
[ M\ longlong-2 nth-unsafe (call-next-method) ] vx->x-op ;
inline


USING: accessors alien.c-types sequences.private
specialized-arrays.instances.alien.c-types.longlong ;

M: longlong-array nth-unsafe
underlying>> \ longlong alien-element ; inline


USING: accessors math.matrices.simd sequences.private ;

M: matrix4 nth-unsafe columns>> nth-unsafe ; inline


USING: sequences.modified sequences.private ;

M: modified nth-unsafe modified-nth ;


USING: nibble-arrays nibble-arrays.private sequences.private ;

M: nibble-array nth-unsafe nibble@ nth-unsafe get-nibble ;


USING: accessors alien.c-types macho sequences.private
specialized-arrays.instances.macho.nlist ;

M: nlist-array nth-unsafe
underlying>> \ nlist alien-element ; inline


USING: accessors alien.c-types macho sequences.private
specialized-arrays.instances.macho.nlist_64 ;

M: nlist_64-array nth-unsafe
underlying>> \ nlist_64 alien-element ; inline


USING: accessors kernel math sequences.extras sequences.private
;

M: odds nth-unsafe [ 2 * 1 + ] [ seq>> nth-unsafe ] bi* ;
inline


USING: accessors alien.c-types fluids sequences.private
specialized-arrays.instances.fluids.particle_t ;

M: particle_t-array nth-unsafe
underlying>> \ particle_t alien-element ; inline


USING: accessors math.combinatorics sequences.private ;

M: permutations nth-unsafe seq>> permutation ;


USING: accessors kernel math persistent.vectors
sequences.private ;

M: persistent-vector nth-unsafe
2dup tail-offset >= [ tail>> ] [ root>> body-nth ] if
node-nth ;


USING: benchmark.tuple-arrays sequences.private
tuple-arrays.private ;

M: point-array nth-unsafe tuple-slice \ point read-tuple ;
inline


USING: accessors alien.c-types benchmark.struct-arrays
sequences.private
specialized-arrays.instances.benchmark.struct-arrays.point ;

M: point-array nth-unsafe
underlying>> \ point alien-element ; inline


USING: accessors quotations sequences.private ;

M: quotation nth-unsafe array>> nth-unsafe ;


USING: accessors kernel math math.ranges sequences.private ;

M: range nth-unsafe [ step>> * ] keep from>> + ; inline


USING: accessors kernel math sequences sequences.private
sequences.repeating ;

M: repeats nth-unsafe
[ length>> / ] [ seq>> [ length * >integer ] keep nth ] bi
;


USING: accessors kernel sequences sequences.private ;

M: repetition nth-unsafe nip elt>> ; inline


USING: accessors kernel math project-euler.059.private
sequences sequences.private ;

M: rollover nth-unsafe seq>> [ length mod ] keep nth-unsafe ;


USING: accessors alien.c-types macho sequences.private
specialized-arrays.instances.macho.section ;

M: section-array nth-unsafe
underlying>> \ section alien-element ; inline


USING: accessors alien.c-types macho sequences.private
specialized-arrays.instances.macho.section_64 ;

M: section_64-array nth-unsafe
underlying>> \ section_64 alien-element ; inline


USING: sequences sequences.private ;

M: sequence nth-unsafe nth ; inline


USING: accessors kernel math sequences sequences.private
sequences.shifted ;

M: shifted nth-unsafe
[ n>> neg + ] [ underlying>> ] [ ] tri 2over bounds-check?
[ drop nth-unsafe ] [ 2nip fill>> ] if ;


USING: cpu.architecture generic kernel math.vectors.simd
math.vectors.simd.intrinsics math.vectors.simd.private
sequences.private ;

M: short-8 nth-unsafe
swap \ short-8-rep
[ (simd-select) ]
[ M\ short-8 nth-unsafe (call-next-method) ] vx->x-op ;
inline


USING: accessors alien.c-types sequences.private
specialized-arrays.instances.alien.c-types.short ;

M: short-array nth-unsafe
underlying>> \ short alien-element ; inline


USING: accessors alien.c-types sequences.private
specialized-arrays.instances.alien.c-types.size_t ;

M: size_t-array nth-unsafe
underlying>> \ size_t alien-element ; inline


USING: grouping.private sequences.private ;

M: slice-chunking nth-unsafe group@ <slice-unsafe> ; inline


USING: kernel math sequences.private strings strings.private ;

M: string nth-unsafe [ integer>fixnum ] dip string-nth ; inline


USING: accessors kernel sequences.private xml.data ;

M: tag nth-unsafe [ children>> ] call \ nth-unsafe execute ;


USING: accessors alien.c-types ogg.theora sequences.private
specialized-arrays.instances.ogg.theora.th-quant-ranges ;

M: th-quant-ranges-array nth-unsafe
underlying>> \ th-quant-ranges alien-element ; inline


USING: accessors alien.c-types sequences.private
specialized-arrays.instances.unix.time.timeval unix.time ;

M: timeval-array nth-unsafe
underlying>> \ timeval alien-element ; inline


USING: accessors alien.c-types math.vectors.simd
sequences.private
specialized-arrays.instances.math.vectors.simd.uchar-16 ;

M: uchar-16-array nth-unsafe
underlying>> \ uchar-16 alien-element ; inline


USING: cpu.architecture generic kernel math.vectors.simd
math.vectors.simd.intrinsics math.vectors.simd.private
sequences.private ;

M: uchar-16 nth-unsafe
swap \ uchar-16-rep
[ (simd-select) ]
[ M\ uchar-16 nth-unsafe (call-next-method) ] vx->x-op ;
inline


USING: accessors alien.c-types sequences.private
specialized-arrays.instances.alien.c-types.uchar ;

M: uchar-array nth-unsafe
underlying>> \ uchar alien-element ; inline


USING: accessors alien.c-types sequences.private
specialized-arrays.instances.tools.disassembler.udis.ud_operand
tools.disassembler.udis ;

M: ud_operand-array nth-unsafe
underlying>> \ ud_operand alien-element ; inline


USING: accessors alien.c-types math.vectors.simd
sequences.private
specialized-arrays.instances.math.vectors.simd.uint-4 ;

M: uint-4-array nth-unsafe
underlying>> \ uint-4 alien-element ; inline


USING: cpu.architecture generic kernel math.vectors.simd
math.vectors.simd.intrinsics math.vectors.simd.private
sequences.private ;

M: uint-4 nth-unsafe
swap \ uint-4-rep
[ (simd-select) ]
[ M\ uint-4 nth-unsafe (call-next-method) ] vx->x-op ;
inline


USING: accessors alien.c-types sequences.private
specialized-arrays.instances.alien.c-types.uint ;

M: uint-array nth-unsafe underlying>> \ uint alien-element
; inline


USING: accessors alien.c-types sequences.private
specialized-arrays.instances.alien.c-types.uintptr_t ;

M: uintptr_t-array nth-unsafe
underlying>> \ uintptr_t alien-element ; inline


USING: accessors alien.c-types sequences.private
specialized-arrays.instances.alien.c-types.ulong ;

M: ulong-array nth-unsafe
underlying>> \ ulong alien-element ; inline


USING: cpu.architecture generic kernel math.vectors.simd
math.vectors.simd.intrinsics math.vectors.simd.private
sequences.private ;

M: ulonglong-2 nth-unsafe
swap \ ulonglong-2-rep
[ (simd-select) ]
[ M\ ulonglong-2 nth-unsafe (call-next-method) ] vx->x-op ;
inline


USING: accessors alien.c-types sequences.private
specialized-arrays.instances.alien.c-types.ulonglong ;

M: ulonglong-array nth-unsafe
underlying>> \ ulonglong alien-element ; inline


USING: cpu.architecture generic kernel math.vectors.simd
math.vectors.simd.intrinsics math.vectors.simd.private
sequences.private ;

M: ushort-8 nth-unsafe
swap \ ushort-8-rep
[ (simd-select) ]
[ M\ ushort-8 nth-unsafe (call-next-method) ] vx->x-op ;
inline


USING: accessors alien.c-types sequences.private
specialized-arrays.instances.alien.c-types.ushort ;

M: ushort-array nth-unsafe
underlying>> \ ushort alien-element ; inline


USING: sequences sequences.private ;

M: virtual-sequence nth-unsafe virtual@ nth-unsafe ; inline


USING: accessors sequences.private vlists ;

M: vlist nth-unsafe vector>> nth-unsafe ;


USING: accessors alien.c-types sequences.private
specialized-arrays.instances.alien.c-types.void* ;

M: void*-array nth-unsafe
underlying>> \ void* alien-element ; inline


USING: accessors kernel sequences.private xml.data ;

M: xml-chunk nth-unsafe [ seq>> ] call \ nth-unsafe execute ;


USING: accessors kernel sequences.private xml.data ;

M: xml nth-unsafe [ body>> ] call \ nth-unsafe execute ;


USING: accessors arrays kernel sequences.private
sequences.zipped ;

M: zipped nth-unsafe
[ keys>> nth-unsafe ] [ values>> nth-unsafe ] 2bi 2array ;