This is part of the HicEst documentation
$: Index to Facilitate Array and String Operations
When working with arrays or strings $ is the left-hand side linear array index for InlineLoop use.
⇾Home
⇾Contents
⇾more Programming
⇾ Examples
Bookmarks:
⇾block_array
⇾factorial_n
⇾matrix_to_vector
⇾string_index_operations
⇾unity_matrix
⇾vector_elements
When working with
Arrays
$ is the left-hand side linear array index for
InlineLoop
use
The (global) variable $ is initially set to 1 when a script line is executed
The loop terminates at array end or any other error condition
The
block_array
operation array = F($, ...) is equivalent to
DO
$ = 1, len_array
array($) = F($, ...)
ENDDO
vector_elements
= f(element index):
vector = $
! evaluates to vector = (1,2,3,4,....)
vector = ($ - 1) * 1.001
! set vector to (0.000, 1.001, 2.002, 3.003, ...)
factorial_n
( execution sequence is $ = 1, 2, 3, ... )
REAL
:: factorials(n)
factorials = *(1:$)
! factorials set to (1, 2, 6, 24, 120, ..., n! )
factorial = *(1:n)
! == n!
matrix_to_vector
$ operations:
DIMENSION
vec(100), mtx(4, 4)
mtx = $
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
vec = mtx($, $)
vec = mtx($, $+1)
vec = mtx($+1, $)
1
6
11
16
*
*
...
2
7
12
*
*
*
...
5
10
15
*
*
*
...
(* marked elements of vec are out of the $ loop scope, and will not be changed)
unity_matrix
:
REAL
:: n=33, matrix(n, n)
matrix =
MOD
($, n+1) == 1
matrix =
$R
==
$C
! same result, less code
string_index_operations
in expressions like string = F($, ...), e.g:
CHARACTER
sample_string*20
sample_string =
CHAR
( $ + 64 )
sets sample_string to "ABCDEFGHIJKLMNOPQRST"
sample_string = "+"($ == $)
! $ to force
InlineLoop
to execute
LEN
(sample_string) times, ($==$) is always = 1
sets sample_string to "++++++++++++++++++++"
sample_string(10*$ -9 : 10*$) = "....+...." //
CHAR
(48+$)
sets sample_string to "....+....1....+....2"
⇾
Support HicEst
⇾
Impressum
©2000-2019 Georg Petrich, HicEst Instant Prototype Computing. All rights reserved.