From J Wiki
Jump to: navigation, search

iOS (iPhones and iPads)

Also see this exciting news about J on Android!

General Approach

Informal announcement


An iPad landscape view

Showing 2 trigonometric plots in the Html (or "dot") window


Showing the J Vocabulary in the Html (or "dot") window

Also showing the results of doubling the default font size Iosvocab2.png

An iPad portrait view

Showing how to access a valuable "Lab" (interactive tutorial)



  • Log window: This is where text output is presented, and a text line can be touched and resubmitted
  • Html window: This is where graphical results are presented via Html
  • Edit window: This is where script files can be created and edited -- Tap the "E" button



Online help for J


Press the "?" icon in the bottom line of the iOS screen.
Or type 'Hall' (without the quotes) in the Entry field at the bottom of the iOS device screen,
and then press the Return icon to the right of the Entry field.




The mail/copy/paste method

Due to Appstore restrictions, it is not yet easy to transfer files between iOS devices and desktops. Until more streamlined methods can be developed the following files and instructions are provided. The JAL system, pacman, provides rather elegant downloads of J libraries to desktop directories (~addons/) directly from, but no such direct method is yet available for iOS devices. For now, any such addons must first be downloaded to a desktop computer first, and then further transfered to iOS platforms.

Following is the jt.ijs script. File:Jt.ijs

      • ~temp/jt.ijs (should be installed on Desktop computer)
0 : 0
transfer text file from desktop to iPad:
 load '~temp/jt.ijs'
 jattach '... file to move to iPad ...'
 send email to yourself with attachment ~temp/jattach.html

 read email on iPad
 tap jattach.html - show attachment in browser
 tap textarea     - show keyboard and enter edit mode
 touch-hold-release textarea
 tap Select All
 tap Copy

 switch to J
 jcbtof '~temp/t.ijs' NB. put clipboard data in file
     or to edit immediately
 je jcbtof '~temp/t.ijs'

transfer text file from iPad to desktop:
 je '..... script'
 tap Select All
 tap Copy
 send email with pasted contents
 read email on desktop
 normal methods to copy/paste data to file

Verb jt creates a single text file from a folder (similar to tar).
 jt '' NB. jt help
 jt 'c';'~/t.jt';'~addons/math';'misc' NB. create t.jt with addons
 jattach '~t.jt'

  transfer single file to iPAD

  jcbtof 't.jt'
  jt 'x';'t.jt';'~addons/math'


NB. write file y wrapped in html to file x (default ~temp/jattach.html)
jattach_z_=: 3 : 0
'~temp/jattach.html' jattach y
t=. '<html><head>'
t=. t,'<meta http-equiv="Content-type" content="text/html;charset=UTF-8">'
t=. t,'<title>TITLE</title></head><body><div><h1>NB. TITLE</h1>'
t=. t,'<textarea name="ta" rows="20" cols="20">DATA</textarea>'
t=. t,'</body></html>'
t=. t rplc 'TITLE';y
d=. toJ fread y
d=. d rplc '&';'&'
d=. d rplc '<';'<'
d=. d rplc LF;'<br>',LF
t=. t rplc 'DATA';d
t fwrite x

jt_z_=: 3 : 0
if. ''-:y do.
 smoutput'jt packs/unpacks text files'
 smoutput'jt ''c'';''~temp/test.jt'';''~system'';''util'''
 smoutput'jt ''t'';''~temp/test.jt'''
 smoutput'jt ''x'';''~temp/test.jt'';''~temp/test'''
 i.0 0
t=. >{.y
f=. >1{y
a=. LF,'NB. ********** jta '
z=. LF,'NB. ********** jtz '
r=. ''
select. {.>{.y
case. 'c' do.
 assert 4=#y['needs 4 paramters'
 'file path folder'=. }.y
 assert 2=ftype path['path must exist'
 '' fwrite file
 path=. jpath path
 base=. path,'/',folder
 d=. {."1 dirtree base
 files=. (>:#path)}.each d
 for_f. files do.
 f=. >f
 d=. toJ fread path,'/',f
 if. +./((32{.a.)-.TAB,CRLF)e.d do.
  smoutput 'file with non-char bytes ignored: ',f
  d=. ((a,f,LF),d,z,f,LF) fappend file
fcase. 'x' do.
 assert 3=#y['x needs 3 parameters'
 path=. >{:y
 y=. }:y
case. 't' do.
 assert 2<:#y['t needs 2 parameters'
 d=. toJ fread f
 while. d do.
 i=. (a E. d)i.1
 if. i=#d do. r return. end.
 d=. i}.d
 d=. (#a)}.d
 i=. d i. LF
 f=. i{.d
 r=. r,<f
 d=. }.i}.d
 i=. ((z,f,LF) E. d)i.1
 if. i=#d do. r return. end.
 fd=. i{.d
 d=. i}.d
 if. t='x' do.
  p=. path,'/',f
  for_n. I. p='/' do. 1!:5 :: [ <jpath n{.p end.
  assert (#fd)=fd fwrite p
case.     do.
 assert 0['unsupported feature'

The following clarifies somewhat the transfer of file directories.

Use jt to transfer a folder of files. jt is similar to tar. It creates a
single file with the info necessary to recreate a folder.

On desktop
   jt '' NB. jt help
   jt 'c';'~/t.jt';'~addons/math';'misc' NB. create single t.jt file
from addon/math misc folder
   send email with t.jt attachement

On iPad
   read email and follow single file example to copy to clipboard

   jcbtof 't.jt' NB. put clipboard contents to file t.jt (at root for less
name typing)
   jt 'x';'t.jt';'~addons/math' NB. extract contents of t.jt

The iExplorer way

Just install and play with iExplorer from

This product lets you mount your iPx as an external drive on your Windows or Mac desktop.

The product costs $35 and is well worth it if you make non-trivial use of J iOS.

iPhone pacman

Pacman is NOT in the J iX(iPhone/iPad) install, but that users can install it themselves with 'the following steps. It will also upgrade the base library and addons to J804.

  • email yourself the content of this text file as in-line text, do not add any extra spaces, footer or signature. (if your email client clutters the text, then send it as an attachment.)
  • read email on iPhone/iPad
   tap tap textarea
   tap Select All
   tap Copy
  • switch to J
 0!:0 jfromcb''
  • restart J to take effect.
  • verify the upgraded version
load 'pacman'
'update' jpkg ''
'showinstalled' jpkg 'all'
  • Note that the iOS JAL/pacman interface is a console interface. See package manager documentation.


  • Phone
  • Tablet


  • Phone
  • Tablet

Idiosyncrasies (relative to other J versions)

  • To retrieve the last input, swipe left in the text entry field
  • To advance to the next Lab, press the 'return' button
  • No package manager for ~addons (see FileTransfers)
  • Limited keyboard means no 'modifier' keys like Control, Alt