Skip to content

Commit

Permalink
Merge pull request #747 from dictu-lang/develop
Browse files Browse the repository at this point in the history
Release 0.30.0
  • Loading branch information
Jason2605 authored Sep 12, 2024
2 parents 97de4c1 + 029706a commit 2ced8e7
Show file tree
Hide file tree
Showing 123 changed files with 4,515 additions and 398 deletions.
2 changes: 2 additions & 0 deletions .clang-format
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
IndentWidth: 4
AccessModifierOffset: -4
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [macOS-latest, macOS-11]
os: [macOS-latest, macOS-13, macOS-12]

steps:
- uses: actions/checkout@v3
Expand Down
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,6 @@ test1.du
.vscode
/.env
/vcpkg_installed
/Release
/Release
examples/ffi-example/build
build_x64/
6 changes: 1 addition & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,7 @@
*What is Dictu?*

Dictu is a high-level dynamically typed, multi-paradigm, interpreted programming language. Dictu has a very familiar
C-style syntax along with taking inspiration from the family of languages surrounding it, such as Python and JavaScript.

*What does Dictu mean?*

Dictu means `simplistic` in Latin.
C-style syntax along with taking inspiration from the family of languages surrounding it, such as Python and JavaScript.

### Dictu documentation
Documentation for Dictu can be found [here](https://dictu-lang.com/)
Expand Down
2 changes: 1 addition & 1 deletion docs/_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ description: >-
color_scheme: "dictu" # Custom theme
logo: "/assets/images/dictu-logo/dictu-wordmark.svg"

version: "0.29.0"
version: "0.30.0"
github_username: dictu-lang
search_enabled: true

Expand Down
24 changes: 20 additions & 4 deletions docs/docs/collections/dictionaries.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,14 @@ Updating a value within a dictionary uses the same syntax, except you supply a v

```cs
var myDict = {"key": 1, "key1": true};
var myDict["key"] = false; // {"key": false, "key1": true}
myDict["key"] = false; // {"key": false, "key1": true}
```

Adding a value to a dictionary is the same as updating a value, however if the key does not exist it is created.

```cs
var myDict = {"key": 1, "key1": true};
var myDict["key2"] = nil; // {"key": false, "key1": true, "key3": nil}
myDict["key2"] = nil; // {"key": 1, "key1": true, "key2": nil}
```

### dict.get(String, value: default -> Optional) -> Dict
Expand Down Expand Up @@ -146,7 +146,7 @@ myDict.forEach(def (key, value) => {
});
```

### dict.merge(Dict)
### dict.merge(Dict) -> Dict

To merge two dicts together we use `.merge`. This operation will take a shallow copy of the dict the `.merge` method
was called on and add any items from the dictionary passed into the method. If there are keys that exist in both dictionaries
Expand All @@ -159,4 +159,20 @@ const dictTwo = {"key3": 4,"key1":0};
const mergedDict = dictOne.merge(dictTwo);

mergedDict; //{"key2": 3, "key": 1, "key3": 4, "key1": 0}
```
```

### dict.toObj(Dict, Object) -> Object

Returns an object created from the given dict and class ref. Dictionary fields that aren't strings are converted to strings and set on the object. To retrieve those fields, use the `.getAttribute(String)` method.

```cs
class A {}

const dict = {"key": 1, "key1": 2, "key2": 3};
const obj = dict.toObj(A());

obj; // <A instance>
obj.key // 1
obj.key1 // 2
obj.key2 // 3
```
15 changes: 15 additions & 0 deletions docs/docs/collections/lists.md
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,21 @@ list1.sort();
print(list1); // [-1, 1, 2, 3, 4, 5, 10]
```

#### list.sortFunc(Func)

Sorts a list with a Custom Callback, The callback function passed to `.sortFunc` takes two elements of the list `a` and `b`.
The return value should be a number whose sign indicates the relative order of the two elements: negative if `a` is less than `b`, positive if `a` is greater than `b`, and zero if they are equal.

```cs
var list1 = [[1, "Dictu"], [-1, "SomeValue"], [5, "!"], [4, "Awesome"], [2, "is"]];

print(list1); // [[1, "Dictu"], [-1, "SomeValue"], [5, "!"], [4, "Awesome"], [2, "is"]];
list1.sortFunc(def(a,b) => a[0] - b[0]);

print(list1); // [[-1, "SomeValue"], [1, "Dictu"], [2, "is"], [4, "Awesome"], [5, "!"]]
```

```cs
var list1 = ["zebra", "cat", "dino", "pig"];

Expand Down
9 changes: 9 additions & 0 deletions docs/docs/collections/sets.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,15 @@ var mySet = set();
mySet.add("Dictu!");
```

### set.values() -> List

Returns a list of all of the values in the set.

```cs
var mySet = set("foo", "bar", 123);
const values = mySet.values(); // ["foo", "bar", 123]
```

### set.contains(value) -> Boolean

To check if a set contains a value use `.contains()`
Expand Down
Loading

0 comments on commit 2ced8e7

Please sign in to comment.