for 2,

a better option (IMO) than returning empty for a side effect function is to 
return y.  This lets you insert side-effects into any "composition".



________________________________
From: "Dabrowski, Andrew John" <[email protected]>
To: "[email protected]" <[email protected]> 
Sent: Friday, December 1, 2017 8:04 PM
Subject: [Jprogramming] Three Simple Questions



1. How does one test whether an object is string?


2. I now know that J doesn't support nullary functions.  It also seems 

that J doesn't allow functions that don't return any value (i.e. for the 

side effects), correct?


3. Suppose I want to define a dyadic function in which the y variable 

contains three values: a number, a vector, and a string. One way to do 

this would be to have y be a list of three boxes, say y = 13 ; 2 3 4 ; 

'abcd' and parse y by


fun =: dyad define

'num vec str' =. y

num =. > num

vec =. > vec

str =. > str

...

)


Is this the idiomatic way to do it?  Is there a better way?

----------------------------------------------------------------------

For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to