There's lots of looping done under the covers, but loops are hardly ever used because (as you suggest) we can process lists with verbs and adverbs.

q)1 2 3+1 1 1 /the verb + works on lists

2 3 4

q)(+/)til 4 /and advervs like over (/) make verbs that usually take two nouns reduce a list.

6

Your example is a good test to see how much we can reduce an expression to it's essential parts:

q)x:til 10;sum x where ((0=x mod 3) or (0=x mod 5))

23

q)x:til 10;sum x where (0=x mod 3) or (0=x mod 5)

23

q)x:til 10;sum x where (or/)(0=x mod 3;0=x mod 5)

23

q)x:til 10;sum x where (or/)0=(x mod 3;x mod 5)

23

q)x:til 10;sum x where (or/)0=(x mod/: 3 5)

23

q)x:til 10;sum x where (or/)(0=x mod/:3 5)

23

q)k)x:!10;+/&|/(0=x .q.mod/:3 5)

23

! is til, +/ is sum, & is where, |/ is (or/)

k doesn't have a primitive mod verb, so use q's (.q.mod)

On 26/07/2016 1:46 AM, "Ryan Gonzalez" <

rymg19@gmail.com> wrote:

UNTESTED:

Something like this should work:

sum x where {~&/x mod 3 5} each x:til `int$read0 0

--

Ryan

[ERROR]: Your autotools build scripts are 200 lines longer than your program. Something’s wrong.

http://kirbyfan64.github.io/