Skip to main content

Python's little programming language.

Project description

Capylang

Capylang is a pretty simple language.

Regular Examples

from capylang import capy
mycapy = capy(id="MyCapy",printinst=True) # ID is for identification of Capylang Instances, and printinst prints the ID
print(mycapy.__doc__) # Returns help
a = 4
b = 3
print(str(mycapy.add(a,b))) # Prints 7 (also uses the add function)
print(str(mycapy.minus(a,b))) # Prints 1 (also uses the subtract function)
print(str(mycapy.multi(a,b))) # Prints 12 (also uses the multiply function)
print(str(mycapy.div(a,b))) # Prints 2.3 (average, also uses the divide function)
print(str(mycapy.hyp(a,b))) # It returns the hypotenuse of opp, and adj
print(str(mycapy.opp(a,b))) # Try this yourself for more info, check mycapy.__doc__
print(str(mycapy.adj(a,b))) # Try this yourself for more info, check mycapy.__doc__

Mean, Median, and Mode

import cpaylang
arr = [1,2,3,4,5]
# AIML means AI Machine Learning (AIML.)
capylang.aiml.mean(arr)
capylang.aiml.median(arr)
capylang.aiml.mode(arr)

Decorators (Make your own Capylang if you feel lazy or want to!)

import capylang
@capylang.decorators.add # Equivalent to mycapy.add
def myadd(a,b,c):
  return a,b,c # The decorator does it all for ya.

print(myadd(1,2,3))
# Basicallly everything above. Add, minus, multi, div, hyp, opp, and adj. Fibonacci is here.

DateTime alternative

import capylang
date = "1/16/1921" # MM/DD/YYYY (January 16th 1921)
mydate = capylang.date.new(date)
print(mydate)
print(mydate.text())
#

Clearing on Terminals

import capylang
capylang.terminal.os_clear() # Clear with the os module
capylang.terminal.replit_clear() # Clear with the replit module

Fibonacci Sequence

from capylang import capy
# The fibonacci sequence function returns numbers in the fibonacci sequence, it contains 2 args:
# num_of_nums: the number of sequence numbers you'd like to generate (required)
# index: to return a specific number in the sequence (optional)
fibo = capy(printinst=True,id="Fibonacci Sequence")
print(fibo.nacci(num_of_nums=10,index=6))

Math string evaluation

# Coming in decorators soon.
from capylang import capy
eval = capy(printinst=True,id="Evaluation")
print(eval.calc("6/2*(1+2)")) # 9

Old, used to be deprecated, but revived capy.log

# Coming in decorators soon.
from capylang import capy
eval = capy(printinst=True,id="Evaluation")
eval.log("The prophecy is true!!!")

Did you know you could use "deprecated" syntax?

from capylang import capy
capy.log("You don't even need to initialize the module!")

String occurrences

import capylang

mystr = "I am an Apple."
mystr = capylang.string.init(mystr)
print(mystr.freq()["Apple."])

String occurrences to lower

import capylang

mystr = "I am an Apple."
mystr = capylang.string.init(mystr)
print(mystr.lowfreq()["apple."])

Binary searching in an array

import capylang
hi = [1,3,5,7,9]
print(capylang.capi.binary_search(hi,3)) # Returns the index of 3 in hi. Otherwise, returns None.
print(capylang.capi.binary_search(hi,-1)) # Returns None because -1 is not in the array.

Color sets

import capylang
print(capylang.color.set["classic"]) # ROYGBP
print(capylang.color.set["full"]) # ROYGBIV
print(capylang.color.set["full_bip"]) # ROYGBIP
# Useful for color sorting.

That's pretty much it for a basic tutorial of Capylang.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

capylang-2.2.0.tar.gz (13.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

capylang-2.2.0-py3-none-any.whl (7.0 kB view details)

Uploaded Python 3

File details

Details for the file capylang-2.2.0.tar.gz.

File metadata

  • Download URL: capylang-2.2.0.tar.gz
  • Upload date:
  • Size: 13.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.11 CPython/3.8.12 Linux/5.15.0-1025-gcp

File hashes

Hashes for capylang-2.2.0.tar.gz
Algorithm Hash digest
SHA256 461289ee1e5884f41449debe6e3b66c46d417419a747e8d2c208da378a97c02f
MD5 5fe7313c78577d88b19a3e6a11ac2c5e
BLAKE2b-256 e59d1c16c1da9f1895e310e9dbda642f4dc36f7feea44e1817065d602e769bc8

See more details on using hashes here.

File details

Details for the file capylang-2.2.0-py3-none-any.whl.

File metadata

  • Download URL: capylang-2.2.0-py3-none-any.whl
  • Upload date:
  • Size: 7.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.11 CPython/3.8.12 Linux/5.15.0-1025-gcp

File hashes

Hashes for capylang-2.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7c3a856714eb8d6382b8c54b11d445245bf429c2f619a834f1fdb356a251058e
MD5 1d65bf02de9915e9525128ce0cfc939a
BLAKE2b-256 2311d4a4a1e1557ef92f1470b29f60ac5af5fc648394e9d7de91400f4a25c34d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page