WASDEV(The AI WorkShop)Docs Website Download

Chapter 1 · GAD language

Library and modules

What GAD gives without asking, what it gives only when the program asks with sèvi ak, and the library families.

Capabilities: sèvi ak

Pure calculation is always there: mathematics, text, lists, dictionaries and time. Everything that gives the program a power over the outside world must be asked for at the top of the file.

sèvi ak vizyon      # open a window, draw on the screen
sèvi ak simbi       # network: HTTP, JSON, server
sèvi ak depo        # data that stays
sèvi ak fichye      # read and write files
sèvi ak sekirite    # random tokens, passwords
sèvi ak pon         # call C, C++ or Rust code
  • You read the top of a file and you know what the program can do.
  • A file that does not write sèvi ak simbi cannot send your data on the internet: the engine refuses.
  • Your own file is used with its path: sèvi ak "pataje/modèl.gad".

The library families

Language Libraries: the GAD tab lists the keywords and the functions
Language Libraries: the GAD tab lists the keywords and the functions
  1. Click Language Libraries in the left bar.
  2. Click the tab Bibliotek GAD.
  3. Choose GAD keywords or GAD functions in the list, then double-click a line to insert it in the file.
FamilyWhat it holds
nonbnumbers and mathematics
tèkstext, base64, hashes
lislists: sort, filter, group
diksyonèdictionaries
tandates and time
json, csv, toml, yaml, xmldata formats
regexregular expressions
fichye, chemenfiles, zip, paths
simbiHTTP client, TCP, UDP, WebSocket
depo, sqlbuilt-in database
sekiritepasswords, tokens
matrismatrix calculation for neural networks
imaj, sonPNG images, WAV sound
gwo, desimalintegers without limit, exact decimals
bit, petwoexact 32-bit words, memory blocks
paralèlseveral cores, with messages
  • A function has a short form and a clear form: won(2.6) and nonb.won(2.6) are the same.

An SQL database and exact numbers

b = sql.louvri(":memwa:")
sql.egzekite(b, "CREATE TABLE pwodui (id INTEGER PRIMARY KEY, non TEXT NOT NULL, pri REAL)")
sql.egzekite(b, "INSERT INTO pwodui (non, pri) VALUES (?, ?)", ["Kafe", 250])
sql.egzekite(b, "INSERT INTO pwodui (non, pri) VALUES (?, ?)", ["Diri", 480])
sql.egzekite(b, "INSERT INTO pwodui (non, pri) VALUES (?, ?)", ["Lwil", 900])
pou chak p nan sql.egzekite(b, "SELECT non, pri FROM pwodui WHERE pri < ? ORDER BY pri", [500])
    montre "{p.non} : {p.pri} goud"
fini
montre gwo.pisans(2, 128)
montre desimal.ajoute("0.1", "0.2")
Kafe : 250 goud
Diri : 480 goud
340282366920938463463374607431768211456
0.3
  • ":memwa:" is a database that lives only while the program runs. A file path keeps it on disk.

Draw an image

sèvi ak fichye

im = imaj.nouvo(300, 180, "#00209f")
imaj.ranpli(im, 0, 90, 300, 90, "#d21034")
imaj.ranpli(im, 120, 60, 60, 60, "#ffffff")
imaj.ekri(im, "drapo.png")
The PNG file written by this program
The PNG file written by this program