Commit graph

226 commits

Author SHA1 Message Date
Jan Van Bruggen
d7e2be306f WIP: Add Num.minI128 builtin (TODOs remain) 2022-01-15 17:49:15 -07:00
ayazhafiz
2c41c43aea Implement saturated add/subtract 2022-01-10 22:37:08 -05:00
ayazhafiz
ed64ff912a Implement List.dropIf
This was referenced in the `List` documentation and in the
[tutorial](./TUTORIAL.md), but wasn't actually implemented prior to this
commit!

Part of #2227
2021-12-22 12:34:48 -06:00
rvcas
b7d48b2fe1 feat: add the rest of the num types for Str conversion 2021-12-06 23:24:02 -05:00
rvcas
e587e20de2 feat: switch to using a builtin per num type to convert from a string 2021-12-06 22:24:00 -05:00
rvcas
ba9d01773b fix: result holds a num_type 2021-12-01 16:25:00 -05:00
rvcas
3104406956 feat: add the type def for Str.toNum 2021-12-01 16:12:55 -05:00
Anton-4
e63701c5d1 trying to make Str.toNum work for Ints 2021-12-01 20:37:21 +01:00
Anton-4
eaf4e57759 started on Str.toNum 2021-12-01 15:15:30 +01:00
rvcas
f995a07029 feat: Num.toStr
* add type for Num.toStr
  * create new lowlevel
  * delete types and Symbol for fromInt and fromFloat
  * leave LowLevel::{StrFromFloat,StrFromInt}
  * match on LowLevel::NumToStr and figure out the layout to decide
    which build function to delegate to
2021-11-30 14:52:06 -05:00
Michael Downey
d11bb93539
Merge branch 'trunk' into add_list_all 2021-11-18 16:09:24 -05:00
Michael Downey
9d587d37b4
Merge branch 'trunk' into add_list_all 2021-11-18 06:41:08 -05:00
satotake
ce8a88416d Merge branch 'trunk' into builtins-list-intersperse 2021-11-18 11:16:27 +00:00
satotake
16fb04b4fa Add builtin List.intersperse 2021-11-17 15:18:45 +00:00
Michael Downey
d946b84e63 adding initial List.all 2021-11-16 16:34:36 -05:00
satotake
73dda714de Add builtin List.split 2021-11-15 13:50:11 +00:00
Theo Felippe
8d7c252fce implemented Str.trimRight 2021-11-13 18:02:58 +00:00
Theo Felippe
10eab4b785 implemented Result.isErr 2021-11-13 08:29:40 +00:00
Theo Felippe
84af26d813 added placeholder implementation 2021-11-11 19:13:42 +00:00
Folkert de Vries
b3a663a741
Merge branch 'trunk' into builtins-list-sublist 2021-11-10 16:28:58 +01:00
satotake
9f5d3f521b Implement List.sublist 2021-11-10 13:16:57 +00:00
Michael Downey
07cd3850d7
Merge branch 'trunk' into str_trim_left 2021-11-09 19:43:26 -05:00
Michael Downey
7e074d300e cleaning up and adding comments 2021-11-09 14:37:31 -05:00
Michael Downey
1bc278d962 initial commit of Str.trimLeft 2021-11-09 14:25:24 -05:00
Folkert
94efbd0e95 Merge remote-tracking branch 'origin/trunk' into builtins-list-take-last 2021-11-09 16:18:19 +01:00
satotake
772fc9c021 Implement List.takeLast 2021-11-09 12:26:17 +00:00
ayazhafiz
f65b174ab5 Implement List.find
`List.find : List elem, (elem -> Bool) -> Result elem [ NotFound ]*`
behaves as follows:

```
>>> List.find [1, 2, 3] (\n -> n > 2)
Ok 2
>>> List.find [1, 2, 3] (\n -> n > 4)
Err NotFound
```

We implement this as builtin in two phases. First, we call out to a
pure-llvm-lowlevel `ListFindUnsafe` that returns a record indicating
whether a satisfying element was found, and the value of that element
(the value is all null bytes if the element wasn't found). Then, we lift
that record to a `Result` via a standard construction of the can AST.

Closes #1909
2021-11-08 21:03:14 -05:00
satotake
9087bf7273 Merge branch 'trunk' into builtsins-list-take-first 2021-11-08 14:32:36 +00:00
satotake
878400f95f Implement List.takeFirst 2021-11-08 14:10:53 +00:00
satotake
97c82d8d51 pick 02acef6 2021-11-08 11:15:20 +00:00
Kevin Sjöberg
44938a9e35 Implement List.any 2021-11-07 20:44:10 +01:00
ayazhafiz
0d2ed76334 Implement List.joinMap
Closes #1887
2021-11-07 11:08:20 -05:00
Eric Newbury
f3a350dd74 add dropFirst builtin 2021-11-05 16:12:29 -04:00
Folkert
7cd5d41b35 bump varid for closure var (List.map4 used so many variables that they interfered 2021-11-01 10:34:34 +01:00
Kevin Sjöberg
f9ed060e49 Implement List.map4 2021-10-31 21:08:41 +01:00
Chelsea Troy
4afaf96aea
Add List.max builtin 2021-10-30 19:17:35 -05:00
Folkert de Vries
aa978ae6d9
Merge branch 'trunk' into list_min 2021-10-28 20:32:27 +02:00
Tim Whiting
c721a1cc1f add builtin List.min 2021-10-27 20:28:34 -06:00
Folkert de Vries
29bd4e3e50
Merge branch 'trunk' into str_trim 2021-10-26 22:45:32 +02:00
Dan Knutson
e7523ad41d add Roc wiring 2021-10-25 20:22:37 -05:00
Chelsea Troy
49a832d757
Add dropLast to tests and parser 2021-10-21 23:02:26 -05:00
Folkert
4152519bfb formatting & catch zig overflow error 2021-10-17 18:03:40 +02:00
Chelsea Troy
03295d4369 So far, add type for divCeil to the language 2021-10-17 09:29:11 -05:00
Folkert
94e8c62613 make things compile, base64 has a memory leak 2021-10-06 22:57:11 +02:00
Richard Feldman
8391c337ab Merge remote-tracking branch 'origin/trunk' into list-walk-flip 2021-10-05 20:50:50 -04:00
Dan Knutson
3baff93a97 add first version of List.dropAt
* adds an implementation with no uniqueness/mutability
2021-10-03 13:55:11 -05:00
Kofi Gumbs
b32a42f05a Add Str.repeat builtin 2021-09-29 17:32:42 -04:00
Richard Feldman
71a678c092 Update Dict.walk to match List.walk 2021-08-30 23:05:15 -04:00
Richard Feldman
1abebb7713 Reorder args for List.walk and friends 2021-08-30 22:45:10 -04:00
Folkert
727222bbe7 hashing always returns a U64 2021-08-29 00:51:48 +02:00