7:33 AM
How do you print a value in oK? I searched for 'print' and 'output' in github.com/JohnEarnest/ok/blob/gh-pages/docs/Manual.md but didn't see anything.
7:50 AM
8:20 AM
My oK solution to https://projecteuler.net/problem=2 ("By considering the terms in the Fibonacci sequence whose values do not exceed four million, find the sum of the even-valued terms"):
`nf:{(x@1),(*x)+(x@1)}`
`z@&~2!z:{*x}'{4000001>x@1}nf\1 1`
Anyone see a way to shorten it or otherwise improve it?
`nf:{(x@1),(*x)+(x@1)}`
`z@&~2!z:{*x}'{4000001>x@1}nf\1 1`
Anyone see a way to shorten it or otherwise improve it?
Trying to get my code to work in the k that comes with the current q from kx systems. (What's a less verbose way to refer to this version of k?) How do I do mod (remainder) in that version of k? And how would I look this up for myself?
I think I figured out the answer to my earlier question about
{*x}'a
vs *'a
. The "each" operator (a'b
) behaves differently depending on whether a
is monadic or dyadic. I guess it's defaulting to dyadic even when there's no left hand argument.
This seems to contradict the manual, which says: "Verbs behave as dyads if there is a noun immediately to their left, and otherwise they behave as a monad." There's nothing to the left of the
*
in *'(1 2;3 4)
and yet the verb seems to behave as a dyad.
9:19 AM
9:56 AM
@jordancurve in k4 you can plug a
0N!
in an expression to print an intermediate value, but unfortunately neither kona or oK support it
@jordancurve i too was wondering about that. i asked people who work on k and they mentioned (1, 2) consistency and k's need to know the valence of verbs in advance
in my implementation i chose to differ -
*'(1 2;3 4)
works like *:'(1 2;3 4)
, though *'
in isolation would still create projections
5 hours later…
3:42 PM
@jordancurve now i notice i forgot to explain this. that statement from the manual is true. the verb in this case is a derivative one - a combination of something+adverb. adverbs are always postfix. verbs are infix or prefix. there is nothing to the left of
*'
so indeed, its only argument becomes (1 2;3 4)
. how '
applies its *
is a different matter.
« first day (724 days earlier) ← previous day next day → last day (1931 days later) »