<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Recent changes to KarlLanguage</title><link>https://sourceforge.net/p/madara/wiki/KarlLanguage/</link><description>Recent changes to KarlLanguage</description><atom:link href="https://sourceforge.net/p/madara/wiki/KarlLanguage/feed" rel="self"/><language>en</language><lastBuildDate>Fri, 04 May 2018 17:19:16 -0000</lastBuildDate><atom:link href="https://sourceforge.net/p/madara/wiki/KarlLanguage/feed" rel="self" type="application/rss+xml"/><item><title>KarlLanguage modified by James Edmondson</title><link>https://sourceforge.net/p/madara/wiki/KarlLanguage/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v17
+++ v18
@@ -1,5 +1,5 @@
 &lt;b&gt;C++ Guide Series&lt;/b&gt;
-[Architecture](MadaraArchitecture) | [Knowledge Base](InteractingWithTheKnowledgeBase) | [Networking](InteractingWithTheTransport) | [Containers](KnowledgeContainers) | [Threads](WorkingWithThreads) | [Optimizations](OptimizingKaRL) | KaRL | [Encryption](Encryption)
+[Architecture](MadaraArchitecture) | [Knowledge Base](InteractingWithTheKnowledgeBase) | [Networking](InteractingWithTheTransport) | [Containers](KnowledgeContainers) | [Threads](WorkingWithThreads) | [Optimizations](OptimizingKaRL) | KaRL | [Encryption](Encryption) | [Checkpointing](Checkpointing)

 ----
 [TOC]
&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">James Edmondson</dc:creator><pubDate>Fri, 04 May 2018 17:19:16 -0000</pubDate><guid>https://sourceforge.net501457b637175f288756aabf4b2377445ed3d363</guid></item><item><title>KarlLanguage modified by James Edmondson</title><link>https://sourceforge.net/p/madara/wiki/KarlLanguage/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v16
+++ v17
@@ -1,5 +1,5 @@
 &lt;b&gt;C++ Guide Series&lt;/b&gt;
-[Architecture](MadaraArchitecture) | [Knowledge Base](InteractingWithTheKnowledgeBase) | [Networking](InteractingWithTheTransport) | [Containers](KnowledgeContainers) | [Threads](WorkingWithThreads) | [Optimizations](OptimizingKaRL) | [KaRL](KarlLanguage) | [Encryption](Encryption)
+[Architecture](MadaraArchitecture) | [Knowledge Base](InteractingWithTheKnowledgeBase) | [Networking](InteractingWithTheTransport) | [Containers](KnowledgeContainers) | [Threads](WorkingWithThreads) | [Optimizations](OptimizingKaRL) | KaRL | [Encryption](Encryption)

 ----
 [TOC]
&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">James Edmondson</dc:creator><pubDate>Sat, 21 Apr 2018 01:18:44 -0000</pubDate><guid>https://sourceforge.net64fc6835b147f3034bb3599a3aa91ea27e75d241</guid></item><item><title>KarlLanguage modified by James Edmondson</title><link>https://sourceforge.net/p/madara/wiki/KarlLanguage/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v15
+++ v16
@@ -1,3 +1,4 @@
+&lt;b&gt;C++ Guide Series&lt;/b&gt;
 [Architecture](MadaraArchitecture) | [Knowledge Base](InteractingWithTheKnowledgeBase) | [Networking](InteractingWithTheTransport) | [Containers](KnowledgeContainers) | [Threads](WorkingWithThreads) | [Optimizations](OptimizingKaRL) | [KaRL](KarlLanguage) | [Encryption](Encryption)

 ----
&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">James Edmondson</dc:creator><pubDate>Sat, 21 Apr 2018 01:18:19 -0000</pubDate><guid>https://sourceforge.net74a98999616a7132168faee225c3c00cba9c38dc</guid></item><item><title>KarlLanguage modified by James Edmondson</title><link>https://sourceforge.net/p/madara/wiki/KarlLanguage/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v14
+++ v15
@@ -1,4 +1,4 @@
-[Main Site](http://madara.sourceforge.net) | [Wiki Home](Home) | [Encryption](Encryption)
+[Architecture](MadaraArchitecture) | [Knowledge Base](InteractingWithTheKnowledgeBase) | [Networking](InteractingWithTheTransport) | [Containers](KnowledgeContainers) | [Threads](WorkingWithThreads) | [Optimizations](OptimizingKaRL) | [KaRL](KarlLanguage) | [Encryption](Encryption)

 ----
 [TOC]
&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">James Edmondson</dc:creator><pubDate>Sat, 21 Apr 2018 01:17:34 -0000</pubDate><guid>https://sourceforge.nete0aad0d25baa93d91be2b9bdb0627017830436e2</guid></item><item><title>KarlLanguage modified by James Edmondson</title><link>https://sourceforge.net/p/madara/wiki/KarlLanguage/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v13
+++ v14
@@ -1,4 +1,4 @@
-[Main Site](http://madara.sourceforge.net) | [Wiki Home](Home)
+[Main Site](http://madara.sourceforge.net) | [Wiki Home](Home) | [Encryption](Encryption)

 ----
 [TOC]
&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">James Edmondson</dc:creator><pubDate>Sat, 21 Apr 2018 01:15:35 -0000</pubDate><guid>https://sourceforge.netf238f413a167655681a3e9a64076a53cb7a9786e</guid></item><item><title>KarlLanguage modified by James Edmondson</title><link>https://sourceforge.net/p/madara/wiki/KarlLanguage/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v12
+++ v13
@@ -131,10 +131,32 @@

 ``karl -m "239.255.0.1:4150" -c -y 1 -ky -wy 5 -w 60 "mission.failure"``

+----
+
+## KaRL interpreter can load and save from binary knowledge base checkpoints
+
+MADARA provides the ability to save knowledge bases to and from checkpoints with the KnowledgeBase::save_context and KnowledgeBase::load_context methods. The KaRL interpreter includes the ability to load an initial context from such a binary knowledge base checkpoint and also to save a new checkpoint after modifications are made to the knowledge base through the command line.
+
+Consider the following examples, which create some knowledge, save the knowledge to a fast, binary format, and then load the knowledge from the saved file.
+
+Creating a simple knowledge base and saving it to `my_data.kb`
+``karl -sb my_data.kb -k ".location=[1,2,3] ; .status='happy'" ``
+
+Loading the knowledge base, changing it and saving it again to `my_new_data.kb`
+``karl -0b my_data.kb -sb my_new_data.kb -k ".status='irritated'" ``
+
+To print the contents of what we saved in `my_data.kb` and `my_new_data.kb`, we read the contents of the knowledge bases using the `-0b` parameter, which means the 0-state binary or initial binary. `-k` means print the final knowledge.
+``karl -0b my_data.kb -k``
+``karl -0b my_new_data.kb -k``
+
+Consequently, use `-sb` or `--save-binary` to save knowledge as binary. Use `-0b` or `--init-bin` to load knowledge as binary.
+
+----

 # Examples

 Other projects that use MADARA have used KaRL to do things like waiting on knowledge to reach a certain state or to monitor state in running distributed applications.

+* [Distance check](https://sourceforge.net/p/madara/code/ci/master/tree/examples/logic)
 * [Line Intersection example](https://github.com/jredmondson/gams/blob/master/resources/karl/line_intersection/karl_zone_coverage_check.mf)
 * [Setting up location variables for GAMS](https://github.com/jredmondson/gams/blob/master/resources/karl/line_intersection/agents_init_failure_1.mf)
&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">James Edmondson</dc:creator><pubDate>Fri, 23 Jun 2017 21:19:46 -0000</pubDate><guid>https://sourceforge.netea9372e15525219e25c71094adfd1f2250709be3</guid></item><item><title>KarlLanguage modified by James Edmondson</title><link>https://sourceforge.net/p/madara/wiki/KarlLanguage/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v11
+++ v12
@@ -138,4 +138,3 @@

 * [Line Intersection example](https://github.com/jredmondson/gams/blob/master/resources/karl/line_intersection/karl_zone_coverage_check.mf)
 * [Setting up location variables for GAMS](https://github.com/jredmondson/gams/blob/master/resources/karl/line_intersection/agents_init_failure_1.mf)
-* 
&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">James Edmondson</dc:creator><pubDate>Mon, 08 Feb 2016 03:14:08 -0000</pubDate><guid>https://sourceforge.netcc0eb721ab23a9c20c34602c3cd6f98152f4c4bb</guid></item><item><title>KarlLanguage modified by James Edmondson</title><link>https://sourceforge.net/p/madara/wiki/KarlLanguage/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v10
+++ v11
@@ -136,6 +136,6 @@

 Other projects that use MADARA have used KaRL to do things like waiting on knowledge to reach a certain state or to monitor state in running distributed applications.

-* [Line Intersection example] (https://github.com/jredmondson/gams/blob/master/resources/karl/line_intersection/karl_zone_coverage_check.mf)
-* [Setting up location variables for GAMS] (https://github.com/jredmondson/gams/blob/master/resources/karl/line_intersection/agents_init_failure_1.mf)
+* [Line Intersection example](https://github.com/jredmondson/gams/blob/master/resources/karl/line_intersection/karl_zone_coverage_check.mf)
+* [Setting up location variables for GAMS](https://github.com/jredmondson/gams/blob/master/resources/karl/line_intersection/agents_init_failure_1.mf)
 * 
&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">James Edmondson</dc:creator><pubDate>Mon, 08 Feb 2016 03:13:32 -0000</pubDate><guid>https://sourceforge.net34cbfdba661e1ae4d9352c872303ed995e57e568</guid></item><item><title>KarlLanguage modified by James Edmondson</title><link>https://sourceforge.net/p/madara/wiki/KarlLanguage/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v9
+++ v10
@@ -19,6 +19,45 @@

 # Basics of KaRL
 Just like any language, a KaRL script is a collection of constants, variables, functions and operations.However, the intent of KaRL was to manipulate knowledge and also to wait on knowledge to change state. Because of this, KaRL has some unique properties.
+
+----
+
+## Local variables
+
+In KaRL, local variables start with a period ("."). These variables will not be disseminated over a network transport. Global variables that need to be disseminated after they are modified start with any letter. 
+
+```c
+knowledge.evaluate ("
+// local variables start with period
+.my_x = 10;
+.my_y = 20;
+
+/**
+ * global variables start with alphabet characters.
+ * these will be sent over the network when modified
+ **/
+my_state = 'waiting'
+");
+```
+
+----
+
+## Arrays
+
+KaRL supports arrays of integers and doubles in an intuitive way.
+
+```c
+knowledge.evaluate ("
+// Setup a position array with latitude, longitude and an altitude set to 3
+.latitude = 42.0;
+.longitude = 70.1;
+position = [.latitude, .longitude, 3];
+
+// change array values
+position[0] = get_latitude();
+position[1] = get_longitude();
+");
+```

 ----

@@ -92,3 +131,11 @@

 ``karl -m "239.255.0.1:4150" -c -y 1 -ky -wy 5 -w 60 "mission.failure"``

+
+# Examples
+
+Other projects that use MADARA have used KaRL to do things like waiting on knowledge to reach a certain state or to monitor state in running distributed applications.
+
+* [Line Intersection example] (https://github.com/jredmondson/gams/blob/master/resources/karl/line_intersection/karl_zone_coverage_check.mf)
+* [Setting up location variables for GAMS] (https://github.com/jredmondson/gams/blob/master/resources/karl/line_intersection/agents_init_failure_1.mf)
+* 
&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">James Edmondson</dc:creator><pubDate>Mon, 08 Feb 2016 03:08:53 -0000</pubDate><guid>https://sourceforge.net029a26681c760a75d09980acb3817f9915d6af63</guid></item><item><title>KarlLanguage modified by James Edmondson</title><link>https://sourceforge.net/p/madara/wiki/KarlLanguage/</link><description>&lt;div class="markdown_content"&gt;&lt;pre&gt;--- v8
+++ v9
@@ -38,7 +38,7 @@
 latitude = 42 ;&amp;gt;
 longitude = 70 ;&amp;gt;

-is_gps_in_the_us (latitude, longitude))
+is_gps_in_the_us (latitude, longitude)");
 ```

 The above wait statement above would initialize latitude and longitude to 42 and 70, respectively. It would then return the value of ``is_gps_in_the_us``, which would be a custom function created by a user and attached to a knowledge base with the ``define_function`` call. Contrast that to the following code example.
@@ -49,7 +49,7 @@
 latitude = 42 ;
 longitude = 70 ;

-is_gps_in_the_us (latitude, longitude))
+is_gps_in_the_us (latitude, longitude)");
 ```

 The above code would return the maximum of latitude, longitude, and the return value of ``is_gps_in_the_us`` which would almost certainly be a zero or one (false or true), meaning that the resulting evaluation would always be 70 (the longitude initialization), since the semi-colon operator returns the maximum of the left and right evaluations.
&lt;/pre&gt;
&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">James Edmondson</dc:creator><pubDate>Mon, 08 Feb 2016 02:55:39 -0000</pubDate><guid>https://sourceforge.net0de5cf2d2e9eab85575bfd857e341c0a6414ea72</guid></item></channel></rss>