From 26be49f79f00a2af25d78cb5fac192183f8635df Mon Sep 17 00:00:00 2001 From: Brian Guarraci Date: Mon, 24 Jul 2023 17:20:07 -0600 Subject: [PATCH] update README with timer and version --- README.md | 38 ++++++++++++++++++++++++++++++++++++++ setup.py | 2 +- 2 files changed, 39 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index f3527f6..268e532 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,7 @@ KlongPy is a powerful language for high performance data analysis and distribute * __Array Programming__: KlongPy supports array programming, which makes it a great tool for mathematical and scientific computing. You can manipulate entire arrays of data at once, enabling efficient data analysis and manipulation. * __Compatibility__: KlongPy is designed to be compatible with Python, allowing you to leverage existing Python libraries and frameworks in conjunction with KlongPy. This seamless integration enhances KlongPy's usability and adaptability. * __Web server__: Includes a web server, making it easy to build sites backed by KlongPy capabilities. +* __Timers__: Includes periodic timer facility to periodically perform tasks. At its heart, KlongPy is about infusing Python's flexibility with the compact Klong array language, allowing you to tap into the performance of NumPy while writing code that's concise and powerful. @@ -488,6 +489,43 @@ $ curl "http://localhost:8888" [100] ``` +# Timer + +KlongPy includes periodic timer capabilities: + +``` +cb::{.p("hello")} +th::.timer("greeting";1;cb) +``` + +To stop the timer, it can be closed via: + +``` +.timerc(th) +``` + +The following example will create a timer which counts to 5 and then +terminates the timer by return 0 from the callback. + +``` +counter::0 +u::{counter::counter+1;.p(counter);1} +c::{.p("stopping timer");0} +cb::{:[counter<5;u();c()]} +th::.timer("count";1;cb) +``` + +which displays: + +``` +1 +2 +3 +4 +5 +stopping timer +`` + # Performance diff --git a/setup.py b/setup.py index aeaa804..f0b92da 100644 --- a/setup.py +++ b/setup.py @@ -9,7 +9,7 @@ setup( name='klongpy', packages=['klongpy', 'klongpy.web'], - version='0.4.0', + version='0.4.1', description='Python implementation of Klong language.', author='Brian Guarraci', license='MIT',