Katakanlah saya punya

block: [a 1 b 2 c 3]

Saya ingin

[1 2 3]

Sesuatu seperti ini kikuk dan tidak berfungsi karena saya menggunakan tipe kata (saya ingin memilikinya kata dengan kata bukan string):

  block: [a 1 b 2 c 3]
  block2: []

  counter: -1
  foreach 'element block [
    counter: negate counter
    if counter append block2 element
  ]
0
user310291 17 November 2017, 20:56

1 menjawab

Jawaban Terbaik

Fungsi EXTRACT harus sesuai dengan tagihan di sini:

>> extract/index [a 1 b 2 c 3] 2 2
== [1 2 3]

Ini cukup serbaguna untuk hal semacam ini.

>> help extract
USAGE:
     EXTRACT series width

DESCRIPTION: 
     Extracts a value from a series at regular intervals. 
     EXTRACT is a function! value.

ARGUMENTS:
     series       [series!] 
     width        [integer!] "Size of each entry (the skip)".

REFINEMENTS:
     /index       => Extract from an offset position.
        pos          [integer!] "The position".
     /into        => Provide an output series instead of creating a new one.
        output       [series!] "Output series".
6
rgchris 17 November 2017, 18:40