User:Angusg/APL

From Rosetta Code

Proper divisors

We borrow the solution from Factors of an integer, but drop the number itself.

<lang APL> PDIVISORS←{¯1↓(0=(⍳⍵)|⍵)/⍳⍵}

⍝ Print a table of proper divisors ⍉({(⍕⍵),':'}¨⍳10) ,[0.5]PDIVISORS¨⍳10 </lang>

Tokenize a string

<lang APL>

     S←'Hello,How,Are,You,Today'
     1⎕CR T←(~S=',') ⊂ S

'Hello' 'How' 'Are' 'You' 'Today'

     {⍺,'.',⍵}/T ⍝ Note there are spaces at the start and end of the output here...
Hello.How.Are.You.Today 

</lang>