For Programmers: Free Programming Magazines  


Home > Archive > APL > October 2005 > Re: Where's APL going?









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: Where's APL going?
Björn Helgason

2005-10-10, 7:55 am

NB. Define some names with operations

plus=:+
minus=:-
sum=:+/
mean=:sum divide count
divide=:%
count=:#
lowerthan=:<

NB. create a verb and use just names

f=: verb define
test=.y.
if. test lowerthan 5 do. res=.'lower'
elseif. test lowerthan 11 do. res=.'between'
elseif. 1 do. res=.'higher'
end.
res
)

NB. call the verb with 4 8 and 18

f 4
lower

f 8
between

f 18
higher

NB. I do not think anyone can call this very ugly and you can do
similar coding for years

mean 2 3 4 6 11 3 2
4.42857
sum 2 3 4 6 11 3 2
31
count 2 3 4 6 11 3 2
7

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com