?? Type System Reference

Complete guide to Ifá-Lang data types

Overview

Ifá-Lang is dynamically typed — variables can hold any type and types are checked at runtime. The language has 6 fundamental types:

Type Ogbe.type() Result Example Values
Number "number" 42, 3.14, -100
String "string" "Hello", "Ifá"
Boolean "boolean" otito, iro
List "list" [1, 2, 3], []
Map "map" {"a": 1}
Nil "nil" nil

Number

Integers and Floats

Numbers in Ifá-Lang are 64-bit floating point internally (like JavaScript).

ayanmo integer = 42;
ayanmo float = 3.14159;
ayanmo negative = -100;
ayanmo scientific = 1e10;  // 10 billion

// All arithmetic works as expected
ayanmo sum = 10 + 5;      // 15
ayanmo diff = 10 - 5;     // 5
ayanmo prod = 10 * 5;     // 50
ayanmo quot = 10 / 4;     // 2.5
ayanmo remainder = 10 % 3; // 1

String

Text Values

Strings are sequences of Unicode characters, enclosed in double quotes.

ayanmo greeting = "Kaabo!";
ayanmo yoruba = "?l?´run";  // Supports diacritics
ayanmo empty = "";

// String length
ayanmo len = Ika.len(greeting);  // 6

// Concatenation
ayanmo full = "Hello, " + "World!";  // "Hello, World!"

// String to number
ayanmo num = Ogbe.parse_int("42");  // 42

Boolean

True and False

Boolean values have Yoruba and English names:

// Yoruba
ayanmo yes = otito;  // true
ayanmo no = iro;     // false

// English
ayanmo active = true;
ayanmo hidden = false;

// Comparison produces booleans
ayanmo result = 5 > 3;    // otito/true
ayanmo equal = "a" == "b"; // iro/false

List

Ordered Collections

Lists can hold any mix of types and are zero-indexed.

// Create lists
ayanmo numbers = [1, 2, 3, 4, 5];
ayanmo mixed = [42, "hello", otito, nil];
ayanmo empty = [];

// Access elements (0-indexed)
ayanmo first = Ogunda.first(numbers);  // 1
ayanmo last = Ogunda.last(numbers);    // 5
ayanmo third = Ogunda.get(numbers, 2); // 3

// List operations
ayanmo len = Ogunda.len(numbers);      // 5
ayanmo pushed = Ogunda.push(numbers, 6); // [1,2,3,4,5,6]
ayanmo reversed = Ogunda.reverse(numbers);

Map

Key-Value Collections

Maps (dictionaries/objects) store key-value pairs.

// Create map
ayanmo person = {
    "name": "Adé",
    "age": 25,
    "active": otito
};

// Access values
ayanmo name = person["name"];  // "Adé"

// Nested structures
ayanmo org = {
    "leader": {"name": "?ba", "title": "Chief"},
    "members": ["A", "B", "C"]
};

Nil

Absence of Value

nil represents "no value" or "nothing".

ayanmo empty = nil;

// Check for nil
ti (value == nil) {
    Irosu.fo("No value present");
}

// Functions without return give nil
ise no_return() {
    Irosu.fo("Hello");
    // No padap?/return statement
}

ayanmo result = no_return();  // nil

Type Coercion

Ifá-Lang performs automatic type conversion in some contexts:

String Concatenation

// Numbers convert to strings when concatenated
ayanmo msg = "Age: " + 25;  // "Age: 25"

// Booleans too
ayanmo status = "Active: " + otito;  // "Active: true"

Boolean Context

// These are "falsy" (evaluate to false):
ti (nil) { }       // false
ti (iro) { }       // false
ti (0) { }         // false (in some contexts)
ti ("") { }        // false (empty string)

// These are "truthy" (evaluate to true):
ti (42) { }        // true
ti ("hello") { }   // true
ti ([1, 2]) { }    // true
?? Type Errors

Some operations require specific types and will error:

// ERROR: Cannot add string and number directly in math
ayanmo bad = "5" + 3;  // May error or produce "53"

// Use explicit parsing
ayanmo good = Ogbe.parse_int("5") + 3;  // 8

Type Checking

// Check type at runtime
ayanmo value = [1, 2, 3];
ayanmo t = Ogbe.type(value);

ti (t == "list") {
    Irosu.fo("It's a list with " + Ogunda.len(value) + " items");
} bib?k? ti (t == "string") {
    Irosu.fo("It's a string");
} bib?k? {
    Irosu.fo("Unknown type: " + t);
}