Commit Graph

111 Commits

Author SHA1 Message Date
Erik Svedäng
320bc67bac
feat: scan functions (#1339) 2021-10-22 06:59:40 +02:00
Veit Heller
d3a6ca562f
docs: document core modules (#1271) 2021-07-05 14:48:35 +02:00
Erik Svedäng
470f0f827d
fix: Unify aupdate and aupdate! with other update functions (#1220)
* chore: Re-format Haskell code

* fix: Unify aupdate and aupdate! with other update functions

* fix: Re-add comment

* fix: Also make StaticArray.aupdate! adhere to the normal update signature

* fix: Failing test
2021-05-25 12:11:31 +02:00
Veit Heller
2afe09a94e
docs: fix order of args in map-reduce docs (#1203) 2021-04-20 09:52:24 +02:00
Veit Heller
00146c70b9
feat: add Array.map-reduce (#1201)
* feat: add Array.map-reduce

* test: add map-reduce to memory tests
2021-04-19 16:45:15 +02:00
Veit Heller
bdaf96550f
refactor: use quasiquoting in STDLIB and go through array in quasiquote (#1135) 2021-01-21 06:20:03 +01:00
Veit Heller
2d34af6aa9
feat: make empty? an interface (#1139) 2021-01-20 09:54:08 +01:00
Efi
c1fe094885
feat: Add "rest" function to Array (#1099)
* feat: Add "rest" function to Array

* typo

* Update core/Array.carp
2020-12-24 16:19:53 +01:00
Erik Svedäng
f78fd16a71
refactor: Move code out of Macros.carp into other files (#1014)
* refactor: Move code out of Macros.carp into other files

* fix: Move back some macros needed in --no-core mode

* refactor: Remove weird 'evaluate' macros

* fix: Put back more macros

* fix: Remove transitive loading of Macros.carp

* refactor: Remove ArrayMacros.carp and put 'for' at top of Array.carp instead

* refactor: More splitting up

* refactor: Move back save-docs

* fix: Moved back some stuff

Co-authored-by: Erik Svedang <erik@Eriks-iMac.local>
2020-11-28 12:53:18 +01:00
rrruko
e3af878e2a
Return reference from unsafe-first/unsafe-last (#1027)
* core: return Array.unsafe-first as reference (#970)

* core: return Array.unsafe-last as reference (#970)

* Make examples and tests build
2020-11-27 10:19:06 +01:00
hellerve
74d734903e core: move range into array ext and add unsafe-range 2020-05-21 15:23:29 +02:00
hellerve
3353427dd9 core: make Array.range safe 2020-05-18 22:59:41 +02:00
Erik Svedäng
aae743fb35
Merge pull request #769 from scolsen/implement-prim
Add an `implements` primitive, update core
2020-05-12 21:45:29 +02:00
Tim Deve
8fc5ce2946 Removes usage of range in enumerated
`range` signature is likely to change in the future
this change gets ahead of that but using a more
'procedural' style.
2020-05-11 19:55:09 +01:00
Tim Deve
58ab18da46 Makes enumerated work with empty arrays
This is a work around for https://github.com/carp-lang/Carp/issues/776
the proper fix would be to allow range to take `(range 0 0 1)` inputs
but the decision about what the correct behavior should be hasn't been
made.
2020-05-11 16:37:07 +01:00
Scott Olsen
f13a2fdd9d Add some more calls to implement to make tests pass 2020-05-10 13:32:22 -04:00
scottolsen
040e9e4391 Add an implements primitive, update core
This change adds a new primitive Implements which changes interface
implementations from being implicit to being explicit. Going forward,
users will have to declare (implements <interface> <implementation>) to
explicitly add a function to an interface. This provides two benefits:

- Prevents unwitting name clashes. Previously, if one defined a function
  that happened to have the same name as an interface, it was
  automatically assumed the function implemented that interface when this
  is not always the intention, especially in large programs.
- Name flexibility. One can now implement an interface with a function
  that has a different name than the interface, which allows for greater
  flexibility.

I've updated core to make the necessary calls to the new primitive.

Since str and copy are derived automatically for types, we treat these
functions as a special case and auto-implement the interfaces.
2020-05-09 12:59:47 -04:00
Erik Svedäng
e13048687e Remove test log. 2020-05-06 10:56:11 +02:00
Erik Svedäng
12ec75ba8b Can configure 'force-reload' that makes 'load-once' work just like 'load'. 2020-05-06 10:27:10 +02:00
Tim Deve
85abcbbf0a Adds Array.from-static function 2020-05-04 09:35:37 +01:00
Tim Dévé
3222e5cd22 Adds tests for ArrayStatic map! and reduce 2020-05-04 09:30:45 +01:00
hellerve
7c7bb71584 eval: final rewrite version 2020-04-17 11:58:28 +02:00
Scott Olsen
6d1ddf41cf Cleanup partition refactor
Remove an unnecessary let clause.
2020-02-16 16:00:04 -05:00
Scott Olsen
d3f99487db Move partition function into the Array module
Since the function is generic over arrays, it makes more sense to house
it here.

I've also fixed an issue with its definition whereby we produced extra
empty arrays when n was greater than the original array length. We now
return an array of a length that matches precisely the number of
partitions with values we're able to create.
2020-02-16 15:57:38 -05:00
hellerve
ee812b37e6 core: make subarry/substring slice 2020-02-11 09:09:30 +01:00
hellerve
a67c33d2f5 core: fix example in Array.reduce (thanks @Emiluren) 2020-01-06 23:29:49 +01:00
hellerve
b1b84c8e3a core: rename map-> to unreduce 2019-11-21 11:05:21 +01:00
hellerve
48b8b4ec13 core: add Array.map-> 2019-11-13 10:47:22 +01:00
GrayJack
52ce78ab13 Fix wrong parameter usage 2019-11-01 03:19:02 -03:00
GrayJack
d852662002 Added safe version of nth 2019-10-31 19:14:44 -03:00
GrayJack
07def7db23 Fix all nth usage 2019-10-31 06:23:23 -03:00
Erik Svedäng
e8e641de99 Merge branch 'misc-fixes' of https://github.com/jacereda/Carp into jacereda-misc-fixes 2019-09-27 15:37:36 +02:00
Jorge Acereda
7b7cb5d1e5 Substitute /= interface by a generic. 2019-09-20 23:49:20 +02:00
Jorge Acereda
0423f40b51 Avoid copies. 2019-09-17 19:34:54 +02:00
Erik Svedäng
e455bab500 Array.contains? 2019-09-16 15:33:18 +02:00
Jorge Acereda
08af49dc62 Working on generics.
- Added Generics module.
- Some Geometry/Vector* functions hardcoded parameters to Double.
2019-09-08 13:02:04 +02:00
Erik Svedäng
4f61d83730
Merge pull request #442 from GrayJack/safe-array
Make Array module safer
2019-05-21 12:11:38 +02:00
hellerve
c091b36b23 compiler: generate documentation for compiler-generated functions automatically 2019-05-16 15:51:56 -04:00
GrayJack
bfd80fd4af Fix minimum name and it comparison function 2019-05-14 13:29:30 -03:00
GrayJack
2228a8c5fa Change Array.maximum and Array.minimum to fix behaviour and keep clonning to a minimum. (Thanks Veit Heller!!!)
Also added my name to the contributors
2019-05-14 11:57:50 -03:00
GrayJack
f69650434d Better doc string for Array.index-of 2019-05-14 06:53:19 -03:00
GrayJack
d18fa71afb Made Array.index-of safe 2019-05-14 06:48:26 -03:00
GrayJack
11338e6414 Remove "TODO unsafe" strings 2019-05-14 06:34:14 -03:00
GrayJack
152818cde5 A better doc string for minimum and maximum 2019-05-13 21:52:52 -03:00
GrayJack
783167bb27 Modify the functions Array.maximum and Array.minimum to be safe
- Also made zero function for Pair so we don't lose compatibility with
   it
2019-05-13 21:41:45 -03:00
GrayJack
caf01bff35 Made Array.find safe wrapping in a Result
- Also some typo fixes in Array module doc strings
2019-05-13 14:47:03 -03:00
Joel Kaasinen
4cf918f71a core/Array.carp: fix minimum and maximum for non-primitive types 2019-03-28 16:14:07 +02:00
hellerve
d9c8ee4710 core: add tests for range on non-integer and update docs 2019-03-26 18:10:31 +01:00
hellerve
4bc9cb6046 core: make to-int and from-int interfaces 2019-03-26 18:08:17 +01:00
hellerve
e24fd38258 sumtypes: multiple fixes
- add test suite for Result
- make Array a little safer overall
- document Maybe and Result comprehensively
- rework Array documentation
2019-02-15 10:24:47 +01:00