The equivalent to f += 1 in J is f =: f + 1 . That is, there is no syntactic shortcut. The grammatical reason for this is =: is fundamentally different from verbs like + (or any other part of speech).
The conceptual reasons for this (J's design) are various, but one way to look at it is that J is a data-flow language, and assignment is much rarer than in other languages. So there is less reason to make it convenient. In J, assignment is sort of a "special event", and captures much higher level concepts than the f+=1 of other languages. So the J equivalent of f+=1 is unwieldy precisely because it's an unnatural concept in J. The true J analog of += 1 is just >: . In J you describe and manage (anonymous) data, not names. Using J, eventually you will start thinking in terms of (anonymous) data (flow), and stop thinking in terms of temp vars, and consequently you'll stop feeling the need for operators like += . So, in short, J doesn't have it, but once you know J, you won't miss it. -Dan ------Original Message------ From: Richard Kubina Sender: programming-boun...@jsoftware.com To: J Programming ReplyTo: J Programming Subject: [Jprogramming] f += 1 Sent: Apr 21, 2010 11:33 AM f=:3 (=: >:) f |syntax error | (=:>:)f Why is this not allowed? ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm Please excuse typos; composed on a handheld device. ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm