Skip to content

Commit

Permalink
merge with main
Browse files Browse the repository at this point in the history
  • Loading branch information
refaktor committed Mar 26, 2024
2 parents d168755 + 63beb10 commit acd7a00
Show file tree
Hide file tree
Showing 3 changed files with 76 additions and 4 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -164,10 +164,12 @@ legend: ⭐ priority , 🧪 tests
If you are interested in "fontend" / desktop technologies check out separate project that works on extending Rye lanuage with GUI, Game engine and a Webview. It
integrates these cool Go libraries:

* Fyne - Cross platform Material design inspired GUI framework ⭐
* Fyne - Cross platform Material design inspired GUI framework ⭐
* Ebitengine - 2d game engine
* Webview - Webview GUI

![Fyne Feedback example](https://ryelang.org/rye-fyne-2.png)

**[Visit Rye-front repo](https://github.com/refaktor/rye-front)**

## Follow development
Expand Down
34 changes: 34 additions & 0 deletions code-of-repo-conduct.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Code of repository conduct

With recent HN post a lot of new people came to follow development of Rye. We probably all want Rye updates and general state of Rye repository to
be "a good product" to follow too.

Here we try to come up with some directives, we could follow to achieve this. Everybody is are welcome to propose changes.

We shouldn't have too many principles (or rules), we are not trying to create a bureaucracy here. Just the really necessary ones, the rest is advice or knowledge base ...

## Principles we really try to follow

1. Main branch shouldn't be left in a failed state (the red cross)
2. PRs that are meant for merging should also pass all checks
3. Each new builtin should have a docstring written and at least few tests

## Q&A

### How to create commits / PR-s / merge them so that feed and release notes are as informative as possible?

_work-in-progress-text-propose-changes_

If there is only one commit per PR then the message is stored and used (check this).

If there are multiple commits's then messages get lost unless we merge with *Squash and merge*. This joins messages together and uses them (positive) but also joins all code changes into one commit.
A) If reason for multiple commits is iterating on a set of changes, or making them comple (adding tests, making golint-ci pass, ...) then this makes sense.
B) If PR is composed of multiple commits each for different set of changes then some information is lost with Squash.

* Should the choice be per-case based?
* What to do in case (B) then?
* Is there a third option?
* Should in case of (B) these be multiple PR-s anyway?



42 changes: 39 additions & 3 deletions evaldo/builtins_spreadsheet.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ var Builtins_spreadsheet = map[string]*env.Builtin{
cols[i] = k.Value
}
}
fmt.Println(cols)
spr := env.NewSpreadsheet(cols)
switch data1 := arg1.(type) {
case env.Block:
Expand Down Expand Up @@ -78,7 +77,7 @@ var Builtins_spreadsheet = map[string]*env.Builtin{

"to-spreadsheet": {
Argsn: 1,
Doc: "Create a spreadsheet by accepting block of dicts",
Doc: "Create a spreadsheet by accepting block or list of dicts",
Fn: func(ps *env.ProgramState, arg0 env.Object, arg1 env.Object, arg2 env.Object, arg3 env.Object, arg4 env.Object) (res env.Object) {
switch block := arg0.(type) {
case env.Block:
Expand Down Expand Up @@ -118,8 +117,45 @@ var Builtins_spreadsheet = map[string]*env.Builtin{
}
return *spr

case env.List:
data := block.Data
if len(data) == 0 {
return MakeBuiltinError(ps, "List is empty", "to-spreadsheet")
}
k := make(map[string]struct{})
for _, obj := range data {
switch dict := obj.(type) {
case map[string]any:
for key := range dict {
k[key] = struct{}{}
}
default:
return MakeBuiltinError(ps, "List must contain only dicts", "to-spreadsheet")
}
}
var keys []string
for key := range k {
keys = append(keys, key)
}
spr := env.NewSpreadsheet(keys)
for _, obj := range data {
row := make([]any, len(keys))
switch dict := obj.(type) {
case map[string]any:
for i, key := range keys {
data, ok := dict[key]
if !ok {
data = env.Void{}
}
row[i] = data
}
}
spr.AddRow(*env.NewSpreadsheetRow(row, spr))
}
return *spr

default:
return MakeArgError(ps, 1, []env.Type{env.BlockType}, "to-spreadsheet")
return MakeArgError(ps, 1, []env.Type{env.BlockType, env.ListType}, "to-spreadsheet")
}
},
},
Expand Down

0 comments on commit acd7a00

Please sign in to comment.