Hijacks the Python 3.10+ standard library for Nim.
A whole new standard library becomes usable for Nim, without Nim having to spend any resources.
Showcases the easy and transparent interoperability of Nim (Python's CTypes is a lot harder, etc).
Nim is also likely less verbose than Python (files are <200 lines each).
Code is very simple and easy to hack for new users, no complex Macros, just DRY templates.
Each file is completely self-contained standalone,
you can copy just 1 file on your project and use it, steal the code.
Same API as Python standard library, same function names,
same argument names, same module filenames, same imports,
any Python documentation becomes a documentation you can use with Nim.
It is also a place to pile up "Nim-ified" Python stuff,
anything that people are interested in can be added in the future (games?, science?, etc),
if you are interested, Pull Requests are welcome !.
This draws a star in a GUI window, meant for kids or people learning programming:
import cpython/turtle
title "Nim Turtle"
shape "turtle"
shapesize 2, 2, 8
color "green", "yellow"
speed "fast"
beginFill()
while true:
forward 200
left 170
if position() < (1.0, 1.0):
break
endFill()
mainLoop()
Thank you for reading
Whats the rule that dictates that a programming language can only have 1 standard library?,
lets break it..., lets have 2, why 2?, lets have 4!,
maybe in the future there can be a standard library optimized for JavaScript,
a standard library optimized for working with Python, etc lets keep cool stuff incoming...
Name: CPython
Author: Juan Carlos
Posting:
Hijacks the Python 3.10+ standard library for Nim.
A whole new standard library becomes usable for Nim, without Nim having to spend any resources.
Showcases the easy and transparent interoperability of Nim (Python's CTypes is a lot harder, etc). Nim is also likely less verbose than Python (files are <200 lines each).
Code is very simple and easy to hack for new users, no complex Macros, just DRY templates.
Each file is completely self-contained standalone, you can copy just 1 file on your project and use it, steal the code.
Same API as Python standard library, same function names, same argument names, same module filenames, same imports, any Python documentation becomes a documentation you can use with Nim.
It is also a place to pile up "Nim-ified" Python stuff, anything that people are interested in can be added in the future (games?, science?, etc), if you are interested, Pull Requests are welcome !.
Arbitrary precision big Decimals
No limits on the size, only limited by memory capacity.
Decimals have all the math operators, like
-
,+
,<
,<=
,==
,>
,>=
,!=
,*
,div
,**
,shl
,shr
,inc
,dec
, etcInput can be a Nim
string
,float
,int
, etc.math
modules are available.You can get back a Nim type in the end using
toFloat
ortoInt
ortoUint
etc.os and sys modules work too.
Pet the Turtle
Thank you for reading
Whats the rule that dictates that a programming language can only have 1 standard library?, lets break it..., lets have 2, why 2?, lets have 4!, maybe in the future there can be a standard library optimized for JavaScript, a standard library optimized for working with Python, etc lets keep cool stuff incoming...