Skip to main content

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.

Metadata

Release files for capylang 2.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for capylang 2.2.0
File Size Uploaded
capylang-2.2.0.tar.gz 13.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for capylang 2.2.0
File Interpreter ABI Platform
capylang-2.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 20.1 kB

Release files / capylang-2.2.0.tar.gz

Download URL capylang-2.2.0.tar.gz
Size 13.1 kB
Tags Source
SHA-256 checksum
How to use checksums
461289ee1e5884f41449debe6e3b66c46d417419a747e8d2c208da378a97c02f
BLAKE2b-256 checksum
How to use checksums
e59d1c16c1da9f1895e310e9dbda642f4dc36f7feea44e1817065d602e769bc8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.11 CPython/3.8.12 Linux/5.15.0-1025-gcp

Release files / capylang-2.2.0-py3-none-any.whl

Download URL capylang-2.2.0-py3-none-any.whl
Size 7.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7c3a856714eb8d6382b8c54b11d445245bf429c2f619a834f1fdb356a251058e
BLAKE2b-256 checksum
How to use checksums
2311d4a4a1e1557ef92f1470b29f60ac5af5fc648394e9d7de91400f4a25c34d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.11 CPython/3.8.12 Linux/5.15.0-1025-gcp

Release history Release notifications | RSS feed

This release

2.2.0 This release

2 release files

2.1.0

2 release files

2.0.0

2 release files

1.4.0

2 release files

1.3.7

2 release files

1.3.6

2 release files

1.3.5

2 release files

1.3.4

2 release files

1.3.3

2 release files

1.3.2

2 release files

1.3.1

2 release files

1.3.0

2 release files

1.2.0

2 release files

1.1.1

2 release files

1.1.0

2 release files

1.0.8

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.12.0

2 release files

0.11.0

2 release files

0.10.8

2 release files

0.10.7

2 release files

0.10.4

2 release files

0.10.3

2 release files

0.10.2

2 release files

0.10.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page