Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Rich H.J for C programmers.2006.pdf
Скачиваний:
18
Добавлен:
23.08.2013
Размер:
1.79 Mб
Скачать

46. Error Messages

When J encounters an error executing a sentence it stops and displays the sentence. The interpreter removes any excess spaces from the sentence and then adds three spaces before the word whose execution triggered the error. For example:

 

2 3 + 0 1 2 * 3 4 5

|length

error

1 2*3 4 5

|

2 3

+0

The error occurred during the execution of the + verb.

The errors you are most likely to encounter are:

control error If the error is detected when a script is loaded, you have an incomplete control structure, for example an if. without matching do./else./elseif. and end. or, notoriously, the sequence if./elseif./else., which is not allowed (use elseif. instead of that last else.). If the error is detected when a script is executed, you have an if. block whose last line does not produce a noun result, like if. undefname do. .

domain error An operand has a value that is not allowed, for example a string operand to an arithmetic operation, or an out-of-range numeric left operand to dyad o. . One common source of domain error is trying to execute a verb when no definition exists for the valence (monadic or dyadic) that you are trying to execute.

Errors encountered during execution of wd are reported as domain errors.

file name error You specified a file name that is invalid, or attempted to read a nonexistent file.

file number error You specified a number that is not the number of an open file.

ill-formed name You used an illegal name, such as name_1ff_ (illegal because 1ff is not a valid locale name)

ill-formed number You used an illegal number such as 14h . A word that starts with a numeric character must be a valid number, and vice versa.

index error You attempted to access an element outside the bounds of an array.

length error You used a dyadic verb with operands that did not agree (i. e. one frame was not a prefix of the other). Or, a verb expected an operand of a certain length and you gave an incorrect length (for example 1 2 3 {. 5 5)

limit error You exceeded one of J's limits, for example by specifying a comparison tolerance greater than 2^_34 . The most common cause of a limit error is an infinite recursion that exhausts the available stack space.

nonce error You tried to do something reasonable, but the system doesn't support it yet. So, for the nonce, find another way to do it.

open quote Your sentence contains an unmatched single-quote.

250

out of memory The interpreter asked the operating system for enough memory to fulfill your request, but the operating system refused. You need to use smaller nouns, or have a bigger virtual-memory swap file, or close other programs that are competing for virtual memory space.

rank error You specified an operand with an invalid rank.

spelling error You typed an erroneous . or : to produce a meaningless word like +.. or fred. .

syntax error Your sentence contains an invalid sequence of parts of speech, as in 5 + . Or, you have an explicitly-defined verb whose last-executed sentence gives a result that is not a noun: that would make the verb have a non-noun result, which is intolerable.

value error You have asked the interpreter to evaluate a name that has not been defined. There is more to this definition than meets the eye. A noun, adverb, or conjunction is evaluated when it is encountered during the right-to-left execution of a sentence. A verb is evaluated when (a) it is executed with its noun operand(s) or (b) when the name of the verb is typed as the only word in a sentence, at which time the verb is evaluated for display purposes. For example, the sentence

undefname

will result in a value error, because you are asking the interpreter to display the value of the undefined name. However, the sentence

name =: undefname

will not fail, because name is defined to be a reference to undefname, and undefname does not have to be evaluated (the undefined name is assumed to refer to a verb of infinite rank that will be defined later). Subsequently,

name undefname

name is defined, but if we force the interpreter to use it:

 

name 5

|value error: undefname

|

name 5

the underlying undefined name is exposed.

An important case is: undefname1 undefname2

undefname1 undefname2

Note that this did not result in a value error. Recall that undefined names are assumed to be verbs; we defined a hook from the two presumed verbs and then asked the interpreter to display the hook. The interpreter was able to do that without evaluating either name. Either name by itself would produce a value error.

251

47. Index

- dyad · 54

!

!dyad · 93, 190

!monad · 94, 184 !. · 59, 213 !: · 125

"

" · 37

".dyad · 128, 131

".monad · 156

": dyad · 127

#

#dyad · 57, 207

#monad · 30

#.dyad · 93

#.monad · 33 #: dyad · 93 #: monad · 33

#^:_1 dyad · 207

$

$ dyad · 25 $ monad · 27 $. dyad · 188

$. monad · 188 $: · 208

%

% dyad · 54 %: dyad · 93

%: monad · 94

*

*dyad · 54

*monad · 55 *: monad · 94

,

,dyad · 44, 103

,monad · 62

,. dyad · 59 ,: dyad · 60 ,: monad · 64

.

Apply On All Subarrays conjunction · 149

Apply On Partitions conjunction · 145 Apply On Selected Partitions

conjunction · 146

Apply On Subarray conjunction · 148

. dyad · 55, 190 -. dyad · 57

. monad · 184 -. monad · 55 u;.3 and u · 149 u · 148 u;.1and u · 146 u;.1 and u · 145

/

-/ .* · 184 /: dyad · 61

/: monad · 63

252

:

:dyad · 61 -: dyad · 62

:monad · 63 -: monad · 94

;

;dyad · 101

;monad · 102 ;: dyad · 161 ;: monad · 107

;:^:_1 monad · 207

?

? · 188

[

[ · 84 [: · 112

]

] · 84

^

^dyad · 54

^monad · 94 ^. dyad · 54 ^. monad · 94

{

{dyad · 56 details · 104

{monad · 209 {. dyad · 58 {. monad · 63 {: monad · 63 {:: dyad · 107

|

| dyad · 54

| monad · 55, 184 |. dyad · 60

|. monad · 63 |.!.f monad · 213 |: dyad · 214

|: monad · 63

}

}.dyad · 58

}.monad · 63 }: monad · 63

~

~ · 68

~. monad · 143 ~: dyad · 54, 55 ~: monad · 143

+

+dyad · 54

+monad · 184 +. dyad · 55, 190 +. monad · 184 +/ .* · 184

+: monad · 94

<

<dyad · 54

<monad · 76 <. dyad · 55 <. monad · 55 <: dyad · 55 <: monad · 55

=

= dyad · 54, 55

253

>

> dyad · 54

>.dyad · 55

>.monad · 55 >: dyad · 55 >: monad · 55

1

128!:2 dyad · 155 128!:3 · 216

8

8!:n · 129

9

9!:18 · 213 9!:19 · 213

A

A.dyad · 192

A.monad · 192 a: · 77

addons · 189

agreement of operands · 45 aliasing · 135

Amend adverb } · 164 Anagram Index verb A. · 192 anonymous entity · 7 Antilog verb ^ · 94

Append verb , · 44, 103

Apply At Level conjunction L: · 211 Apply On Subsets adverb /. · 143 Apply Under Transformation

conjunction &. · 114 Apply Under Transformation

conjunction &.: · 115 Apply verb 128!:2 · 155 array · 22

assignment · 10 multiple · 103

private · 170 public · 171

atom · 23

atomic representation · 99 axis · 24

order · 24

B

Behead verb }. · 63

bitwise Boolean functions · 210 bitwise left rotate · 210

bitwise signed left shift · 210 bitwise unsigned left shift · 210 Boolean Functions verb m b. · 210 Box verb < · 76

boxing · 76

C

C

belittled · ii derided · 51

J equivalent for class · 170 structure equivalent in J · 79

C. dyad · 192 C. monad · 191

C.!.2 monad · 192 calculus · 186

polynomials · 187 calling a DLL · 133 Cartesian product · 209 cd verb · 133

cell · 23

character constants · 9, 25 comments in code · 113 comparison tolerance !. · 54, 213 complex numbers · 184 compound adverbs · 234 compound verb · 80

Constant verb m"n · 64 control error · 250 control structures · 167

assert. · 169 catcht. throw. · 168 for. do. end. · 167

254

if. do. else. elseif. end. · 167 return. · 169

select. case. end. · 168 try. catch. end. · 168

while. whilst. do. end. · 167 conversions · 135

copula · 10 Copy verb # · 57

CRC calculation · 216 Curtail verb }: · 63 Cycle verb C. · 191

D

Deal verb ? · 188 defnouns · 40 defverbs · 40 derivative · 186

approximate · 187 partial · 186

derived entity · 7 derived verb · 80 Do verb ". · 156 domain error · 250

DoWhile conjunction u^:v^:_ · 98 Drop verb }. · 58

E

e. dyad · 58 E. dyad · 147

Element Of verb e. · 58 empty cells · 89

empty operands · 87 Enfile verb , · 62 entity · 6

error handling · 126, 168 Extended integers · 190 Extended Precision verb x: · 191

Extracting variable-length records · 150

F

f. · 236

Factorial verb ! · 94, 184 fast searches · 216

Fetch verb {:: · 107 FFT addon · 189 file name error · 250

file number error · 250 fill · 77

framing · 40 verb · 59

with empty operands · 87 Find Insertion Point verb I. · 58 Find Sequence verb E. · 147 Fit conjunction !. · 59

Flatten adverb · 236 fndisplay · 40

Foreign conjunction !: · 125 form editor · 216

format for printing · 127, 129 frame · 23, 34, 42

From verb { · 56

G

generalized hypergeometric function · 188

gerund · 99

Grade verbs /: \: · 63 Graphics

command summary · 202 creating an isigraph · 200 drawing graphics · 201 drawing surface · 202 drawing text · 201 example · 200

graphics blocks · 205 Grid Control · 206 isigraph events · 205 OpenGL · 206

screen addressing · 201 selecting an isigraph · 201

Greatest Common Divisor verb +. · 190

H

Head verb {. · 63 hypergeometric function · 188

255

I

i.dyad · 57 i.!.0 · 58, 213

I. dyad · 58 i. monad · 30

I. monad · 165 i: · 214

identity element · 68 Identity verbs [ ] · 84 If conjunction ^: · 97 ill-formed name · 250 ill-formed number · 250 index error · 250

Index Of verb i. · 57 Indexes verb I. · 165 Infix adverb · 91 input and output · 125

integrated rank support · 121 interrupting execution · 14 inverse of verb · 114

Invoke Gerund conjunction `: · 154 item · 24

Itemize verb ,: · 64

J

J Forum · 16 j. dyad · 184 j. monad · 184

L

L. monad · 108 L: · 211

Labs · 15

Laminate verb ,: · 60 LAPACK addon · 189 length error · 250 Level verb L. · 108 limit error · 250

Link verb ; · 101 list · 24

load verb · 13 locale

changing current · 172

current · 170 defined · 170 locative · 170 name lookup · 171 search path · 171

used for modular programming · 175 z · 175

Log verb ^. · 94

Lowest Common Multiple verb . · 190

M

m :n · 110 m b. · 210 m D. n · 187 m H. n · 188 m"n · 64 m&i. · 216

m&v dyad · 240 m&v monad · 85 m@.v · 100 m`:6 · 154

m} dyad · 164 m} monad · 207 mapped files · 126 Match verb -: · 62 matrix verbs · 184

memory management · 134 mema · 134

memf · 134 memr · 135 memw · 134

modification in place · 166, 207 modifier · 7

user-defined · 177 Modifier

order of execution · 66 Modify adverb } · 164 modular code · 170 multinomials · 185

N

name · 7

nonce error · 250 nouns in forks · 231

256

Nub Sieve verb ~: · 143 Nub verb ~. · 143

Number Of Combinations verb ! · 93, 190

Numbers verb ". · 131

O

o. (trigonometric function) · 55 obverse of verb · 114

defined by u :.v · 116 discussed under ^: · 114

open quote error · 250 operand passing

by name · 179 by value · 179

order of execution in implied loops · 49 out of memory error · 251

P

p. dyad · 185 p. monad · 185 p.. dyad · 187 p.. monad · 187 p: monad · 191 Partitions

implied · 145 multidimensional · 148 specified · 146

parts of speech · 6

passing a verb as an argument · 153 performance measurement · 118 Performance Monitor · 122 permutation parity · 192 permutations

direct representation · 191 standard cycle representation · 191

Permute verb C. · 192 Plot

annotation · 195 captions · 195 colors · 194 data · 195

fonts · 194 functions · 197

labels · 195 options · 194 parametric · 199 printing · 199

starting and ending · 196 steps verb · 197

title · 195

Plot Package · 193

Polynomial Derivative verb p.. · 187 Polynomial Integral verb p.. · 187 Polynomial verb p. · 185 polynomials · 185

calculus · 187

Power conjunction ^: · 96 a: as operand · 150

Prime Exponents verb q: · 191 Prime Factors verb q: · 191 Primes verb p: · 191 primitive · 7

printf · 131

priority of number representation · 190 Profile · 15

punctuation · 7

Q

q: dyad · 191 q: monad · 191

R

r. dyad · 184 r. monad · 184

random numbers · 188 rank · 22, 27, 30, 34, 111

negative · 41

Rank conjunction " · 37 rank error · 251 Rational numbers · 190 Ravel verb , · 62

Raze verb ; · 102 recursion · 208 Remove verb -. · 57 removing a name · 15

result to produce no typeout · 28 Reverse verb |. · 63

257

Right Shift verb |.!.f · 213 Roll verb ? · 188

Root verb %: · 93 Roots verb p. · 185 Rotate Left verb |. · 60

S

s

monad and dyad · 215 S: · 211

scalar · 23 scripts

supplied with J · 189 sentence · 7

Sequential machine · 161 setfnform · 40

shape · 22

Shift Left verb |.!.f · 60 sockets · 138

datagrams · 141 IP addresses · 139 sdaccept · 141 sdasync · 138 sdbind · 141 sdcleanup · 142 sdclose · 140 sdconnect · 140

sdgethostbyaddr · 139 sdgethostbyname · 139 sdgethostname · 139 sdgetpeername · 139 sdgetsockets · 142 sdgetsockopt · 142 sdioctl · 142

sdlisten · 141 sdrecv · 140 sdrecvfrom · 141 sdselect · 138 sdsend · 140 sdsendto · 141 sdsocket · 138 setsockopt · 142 socket options · 141 socket_handler · 139

Sort Using verb /: \: · 61

Sort verb /: \: · 61 sparse arrays · 188

special code in the interpreter · 120 spelling error · 251

Spread verb #^:_1 · 207 Square Root verb %: · 94 steps verb · 197

Stitch verb ,. · 59 string matching · 215 Suicide verb [: · 112 symbols · 215 syntax error · 251

T

Table adverb / · 208 tacit adverbs · 234 tacit programming

anonymous verb · 222 explicit-to-tacit converter · 239 fork · 220

forks and hooks · 231 improving readability · 236 introduction · 218

parsing and execution · 222 parsing table · 225 summary of execution · 225 trains · 220

Tail verb {: · 63 Take verb {. · 58 Taylor series · 187 Tie conjunction ` · 99

Transpose verb |: · 63, 214 type · 23

U

u ::v · 126 u :v · 112 u d. n · 186 u D. n · 186 u D: n · 187 u\ dyad · 91

u f`g`h} y · 240 u\ monad · 90 u t. · 187

258

u T. n · 187 u t: · 187 u"n · 37 u&.:v · 115 u&.v · 114 u&:v · 116

u&n dyad · 240 u&n monad · 85 u&v · 116

u\. dyad · 92 u\. monad · 91 u/ dyad · 208 u/ monad · 66 u/. dyad · 143 u@:v dyad · 80 u@v dyad · 81 u\\. monad

for performance · 120 u^:_1 (obverse) · 114 u^:n · 96

u^:v · 97 u`v · 99

undefined names · 230 Unicode verb u: · 216

V

valence · 9, 112 value error · 251 verb

definition · 110

W

window driver · 216 word · 6, 8

X

x: dyad · 191 x: monad · 191

259