Common Patterns: Difference between revisions

From The K Language Wiki
Content added Content deleted
(Add common patterns page)
 
No edit summary
Line 1: Line 1:
This page is intended as a list of commonly used snippets and functions that can be used in K code.
This page is intended as a list of commonly used snippets and functions that can be used in K code.


If you would like to add to this list, modify the template given in [[Format: Common Pattern]].
If you would like to add to this list, modify the template given in [[Format: Common Pattern]] and paste it in.


== Patterns ==
== Patterns ==


==== Sum ====
=== Sum ===
<code>+/</code>
<code>+/</code>



Revision as of 07:50, 28 July 2021

This page is intended as a list of commonly used snippets and functions that can be used in K code.

If you would like to add to this list, modify the template given in Format: Common Pattern and paste it in.

Patterns

Sum

+/

Description: function to sum an array. Can be used with initial value.

Examples +/1 2 3 4 5 -> 15 +/(1 2;2 3) -> 3 5

Dialects: all

Primitives: plus, over