Skip to content

nim wrapper for Heng Li's kexpr math expression evaluator library

License

Notifications You must be signed in to change notification settings

brentp/kexpr-nim

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

kexpr-nim

nim wrapper for Heng Li's kexpr math expression library

badge

var e = expression("5*6+x > 20")
e["x"] = 10
echo e.int
e["x"] = 20
echo e.int64
assert e.error() == 0

e = expression("(sample1 > 20 & sample2 > 10 & sample3 < 40")
# missing paren
assert e.error() != 0
e.clear()

e = expression("(sample1 > 20) & (sample2 > 10) & (sample3 < 40)")
e["sample1"] = 21; e["sample2"] = 65; e["sample3"] = 20
echo e.int # 1
e["sample1"] = 0
echo e.int # 0
assert e.error() == 0
echo e.float # 0.0

installation

If you have nimble installed you can do:

nimble install kexpr

nimble

About

nim wrapper for Heng Li's kexpr math expression evaluator library

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published