Sum multiples of 3 and 5: Difference between revisions

Joy version
(Re-edited my previous submission to use compile-time metaprogramming.)
(Joy version)
Line 2,376:
100000000 -> 2333333316666668</pre>
 
=={{header|Joy}}==
<syntaxhighlight lang="jq">
DEFINE divisor == rem 0 = ;
mul3or5 == [3 divisor] [5 divisor] cleave or ;
when == swap [] ifte .
 
"The sum of the multiples of 3 or 5 below 1000 is " putchars
 
0 999 [0 =] [pop]
[
[dup rollup + swap] [mul3or5] when
pred
] tailrec .
</syntaxhighlight>
{{Out}}
<pre>
The sum of the multiples of 3 or 5 below 1000 is 233168
</pre>
=={{header|jq}}==
<syntaxhighlight lang="jq">
Line 2,391 ⟶ 2,409:
 
10e20 | task(3;5) # => 2.333333333333333e+41</syntaxhighlight>
 
 
=={{header|Julia}}==
357

edits