Counter and Theme Toggle - J Typing CST Test
Loading…
Counter and Theme Toggle — J Code
Demonstrates a simple counter with theme toggling using J variables and verbs.
count =: 0
isDark =: 0
updateUI =: 3 : 0
'Counter: ', ": count
'Theme: ', (if. isDark do. 'Dark' else. 'Light')
)
increment =: 3 : 0
count = count + 1
updateUI ''
)
decrement =: 3 : 0
count = count - 1
updateUI ''
)
reset =: 3 : 0
count = 0
updateUI ''
)
toggleTheme =: 3 : 0
isDark = 1 - isDark
updateUI ''
)
'Simulate actions'
updateUI ''
increment ''
increment ''
toggleTheme ''
decrement ''
reset ''J Language Guide
J is a high-level, general-purpose, array-oriented programming language designed for concise and expressive code. It emphasizes functional programming, tacit programming (point-free style), and powerful array operations, making it ideal for mathematical, statistical, and data-intensive computations.
Primary Use Cases
- ▸Mathematical and statistical computing
- ▸Array and matrix processing
- ▸Algorithm prototyping
- ▸Financial modeling and quantitative analysis
- ▸Data analysis and transformation
Notable Features
- ▸Array-oriented programming
- ▸Functional and tacit programming
- ▸Concise symbolic syntax
- ▸Interactive REPL for experimentation
- ▸High expressivity for algorithms
Origin & Creator
J was created by Kenneth E. Iverson and Roger Hui in the early 1990s as a successor to APL, incorporating modern programming concepts and improving keyboard independence.
Industrial Note
J is used in financial modeling, statistical analysis, algorithm research, and scientific computing. Its array-oriented design allows rapid prototyping of mathematical algorithms and data manipulation tasks.