Tim Dévé
3222e5cd22
Adds tests for ArrayStatic map! and reduce
2020-05-04 09:30:45 +01:00
hellerve
a761b561e3
all: use dynor and dynand
2020-05-01 12:50:31 +02:00
Erik Svedäng
504f63ffb4
Merge branch 'zero-sumtypes' of https://github.com/hellerve/Carp into hellerve-zero-sumtypes
2020-04-30 14:46:35 +02:00
hellerve
7eaa30d663
core: remove result.zero
2020-04-30 14:40:01 +02:00
hellerve
918c893189
core: implement zero for Maybe and Result
2020-04-30 14:22:06 +02:00
Erik Svedäng
8e04cb476e
Renamed Dynamic.String.join and Dynamic.Symbol.join to concat.
2020-04-30 13:32:54 +02:00
hellerve
a06c1dc91c
core: change maybe and result to match on refs if possible
2020-04-30 12:57:27 +02:00
Erik Svedäng
89dcad4e79
Merge branch 'master' into static-arrays
2020-04-29 10:39:44 +02:00
Erik Svedäng
979077b388
Some cleanup and start of tests for Static Array.
2020-04-29 10:39:15 +02:00
Erik Svedäng
c42ffec862
Ref result.
2020-04-29 09:48:37 +02:00
Erik Svedäng
de8104eb14
Add Control.iterate-until.
2020-04-28 14:48:39 +02:00
Erik Svedäng
14b608a36e
Static array kinda works now.
2020-04-28 10:06:17 +02:00
Erik Svedäng
2d295ad52f
Merge branch 'master' of https://github.com/carp-lang/Carp
2020-04-26 22:05:33 +02:00
Erik Svedäng
b2c77fc19a
Revert format specifier.
2020-04-26 22:05:13 +02:00
Erik Svedäng
94ed7f0696
Merge pull request #728 from scolsen/macro-fixes
...
Dynamic.Curry fix and Macro Tests
2020-04-24 23:20:36 +02:00
Erik Svedäng
dbc4a86f3c
Use other format specifers on Windows.
2020-04-24 23:01:53 +02:00
scottolsen
ac87e8fbdc
Add tests for dynamic functions
...
I accidentally broke `curry`, what better incentive for writing some
tests than preventing my own future silly mistakes :)
I also added and-internal because we cannot perform direct comparisons
on lists--so, instead we build member-wise comparisons by zipping, then
reduce the result using and.
2020-04-24 17:00:30 -04:00
Erik Svedäng
3093702c54
Merge pull request #726 from hellerve/veit/longs
...
Long type to ensure longs are actually 64 bits
2020-04-24 22:50:49 +02:00
scottolsen
3cbe0e8c79
Fix dynamic curry regression
...
I accidentally committed a change to the definition of curry that
severly alters how it functions! This commit fixed that, and adds a test
so that I don't unwittingly break it again :)
2020-04-24 15:38:22 -04:00
hellerve
38af3d344a
safe arithmetic: disable on windows
2020-04-24 10:28:00 +02:00
hellerve
30ed0ae8c3
all: various long fixes
2020-04-23 21:50:30 +02:00
hellerve
c0ba8c723a
binary: try to fix on windows
2020-04-22 10:56:53 +02:00
Jorge Acereda
a6055eec5f
Long type to ensure longs are actually 64 bits.
2020-04-22 10:40:06 +02:00
Scott Olsen
4c8726808d
Fix order of append in filter, quote in curry*
...
Originally, curry* required double quoting function arguments in some
cases, due to an eval and lack of quotes in the function body it
produces. This is not ideal, as having to type ''(form) is quite
esoteric. Now we handle the extra quoting in the function itself, so
that only one quote is required.
I also fixed the order of filter (which was reversing results).
2020-04-21 23:09:25 -04:00
scottolsen
338b1624b2
Add several utility functions to Macros.carp
...
This commit adds several dynamic utility functions in the spirit of map,
zip, et al, including:
- Compose (composer for functions of any airty, that evaluate
immediately (unlike comp)
- empty (returns the empty value for a structure [] or ())
- unreduce (builds a list of values)
- filter (filters a list of values)
- take (returns the first x members of a list)
I also removed a quote in collect-into that's no longer necessary after
the evaluator refactor.
2020-04-21 19:03:53 -04:00
scottolsen
2fd7a1fe40
Restrict map to mapping only (not zipping)
...
We currently define two dynamic functions, map and zip. Each performs
the traditional operation given by these names, however, map, emulated
clojure's map, which would selectively apply map or zip depending on the
number of lists passed as arguments. This change removes that selection,
making the execution of map more predicatable.
2020-04-21 09:41:42 -04:00
Scott Olsen
ba0bfe7ed7
Return length comparison directly in empty?
2020-04-19 12:07:06 -04:00
Scott Olsen
0c512c5eaf
Use append in apply
...
No need for extra functions :)
2020-04-19 12:04:26 -04:00
Scott Olsen
d1155aaed8
Make internal functions hidden
2020-04-19 12:00:54 -04:00
Scott Olsen
b2bb8d0e71
Add docs for zip
2020-04-19 11:57:30 -04:00
Scott Olsen
e10575e9f4
Add docs on curry and flip
2020-04-19 11:43:10 -04:00
Scott Olsen
8e027d0688
Add additional functions, restore or-internal
...
We need or-internal because Dynamic.or is currently a special form;
special forms can't be passed to higher-order functions like `reduce`.
2020-04-19 11:36:33 -04:00
Scott Olsen
5aa19ff8c2
Remove redundant definitions of or, and
...
The `or` and `and` macros suffice to do the job of `or-internal` and
`and-internal` now that we can call macros within Dynamic code
effectively.
2020-04-19 10:55:56 -04:00
Scott Olsen
54a3101654
Merge branch 'master' of https://github.com/carp-lang/Carp into dynamic-map
2020-04-19 10:34:42 -04:00
hellerve
15522206e9
macros: make save-docs eval
2020-04-17 12:59:22 +02:00
hellerve
a52c02be29
eval rewrite: rebase changes
2020-04-17 12:29:21 +02:00
hellerve
7c7bb71584
eval: final rewrite version
2020-04-17 11:58:28 +02:00
hellerve
22c53406a3
all: fixes for new evaluator
2020-04-17 11:58:28 +02:00
hellerve
e2b52655ef
eval: initial working rewrite
2020-04-17 11:58:28 +02:00
hellerve
c3358ed4c5
interim
2020-04-17 11:58:28 +02:00
hellerve
6185099044
interim
2020-04-17 11:58:26 +02:00
hellerve
25732af8f0
interim
2020-04-17 11:56:05 +02:00
hellerve
ca5cc8abeb
eval: add eval primitive
2020-04-17 11:56:04 +02:00
Erik Svedäng
e47b9cf580
Friendly tip.
2020-04-06 09:38:13 +02:00
Erik Svedäng
b6d4d41f46
Some fixes for SDL on Windows.
2020-04-06 09:28:50 +02:00
Tim Deve
f2f3ea57c3
Doesn't compile assert-exit and assert-signal on Windows
...
These two assertions expect a *nix environment
and cause a compilation failure on windows
Creates stub implementation on Windows
2020-04-03 22:07:38 +01:00
Tim Deve
11e0eb5f56
Fixes wrongly named doc
for assert-signal
2020-04-03 21:24:45 +01:00
Erik Svedäng
41b450873e
Carp init globals function call.
2020-03-23 10:31:58 +01:00
scottolsen
a66a5126e6
Move Byte Order type outside of the Binary module
...
Issue #698 points out an bug related to reloading. The illustious
hellerve@ has discovered that the issue relates to types defined in
modules--for some reason, upon reloading, the type's delete, copy, etc.
functions are doubly defined, resulting in too high or a number of
functions for Carp to work out the dependencies.
2020-03-20 19:02:55 -04:00
hellerve
1cfd873b78
core: reformat carp_binary.h
2020-02-21 13:22:01 +01:00
Erik Svedäng
608634e471
Merge pull request #690 from hellerve/veit/stdint-print
...
Using formatting macros for stdint
2020-02-21 13:00:10 +01:00
hellerve
238365bcc2
core: fix #688 by using the correct formatting macros\n\n(and pray that windows does c99)
2020-02-21 12:28:34 +01:00
Scott Olsen
32b61fbced
Add zero for other StdInt types
2020-02-20 23:39:25 -05:00
Scott Olsen
7c7a65c43e
Refactor bytes->int-seq, add exact variants
...
Instead of returning an array of Maybe UintNs, we now return a pair
comprised of the array of interpreted int values and the number of bytes
that were'nt read/interpreted.
We also provide an `exact` variant of this function that returns a
Result instead of a Pair. If there are excess bytes in the sequence one
attempts to interpret, the `exact` functions return a `Result.Error`
containing the number of extra bytes. If the byte sequence is exact , a
`Success` containing the interpreted values is returned instead.
2020-02-20 14:12:38 -05:00
Scott Olsen
03d93f7b65
Add zero values for unsigned int types
2020-02-20 14:12:14 -05:00
Scott Olsen
edee6d9dc9
Add basic tests for the binary module
...
I've also added the Binary module to Core.carp.
2020-02-18 15:34:41 -05:00
Scott Olsen
3c95c4baeb
Use unsafe as a prefix in unsafe functions
...
This brings our function naming scheme into parallelism with other core
modules (e.g. Array.carp).
2020-02-18 13:56:52 -05:00
Scott Olsen
6fc0562028
Group functions by int type
2020-02-18 13:50:07 -05:00
Scott Olsen
a0bb6c5242
Add functions for converting intN seq(uence)s to byte seqs
2020-02-18 13:45:18 -05:00
Scott Olsen
05ab70b196
Add UintN->Byte conversions
...
Note that we do not need an unsafe variant of these conversions since
they are simple projections to and from the Uint types.
2020-02-18 13:35:35 -05:00
Scott Olsen
b8afc39a3b
Binary: Make names consistent. Update docs.
...
Specifically, we now reference the explicit unsigned int types we return
in the docs for each function, and I've dropped the term byte-seq in
favor of bytes in all cases.
2020-02-18 11:50:24 -05:00
Scott Olsen
511663409e
Add safe variants of byte conversion functions
...
I've also adopted a new naming strategy for these functions--the seq in
byte-seq was redundant, so we now just name these bytes->intN-seq.
2020-02-18 11:41:29 -05:00
Scott Olsen
d3e198673b
Use partitions in byte-seq->int16-seq-unsafe
...
This change brings the implementation of `byte-seq->int16-seq-unsafe`
into parity with the implementations of its 32 and 64 bit brethren.
I've also cleaned up some of my previous sloppiness:
- Correct function names in doc and sig annotations.
- Remove extra spaces before newlines.
2020-02-17 19:03:52 -05:00
Scott Olsen
38efca11fa
Remove byte-seq->int8-seq-unsafe
...
This function is obsolete after the introduction of Int8.from-bytes
2020-02-17 18:47:51 -05:00
Scott Olsen
dec44984ca
Use StdInt types in binary conversion functions
2020-02-17 16:04:09 -05:00
Scott Olsen
4faa721e1d
Add a function for retrieving the system endianness
...
The technique here feels a bit hacky, but it's the common way to do it.
We exploit the fact that ints are 16bits and chars are 8bits to grab the
first byte in a systems int representation, which is indicative of its
endianness.
2020-02-17 15:38:55 -05:00
Scott Olsen
9329662fbb
Merge branch 'master' of https://github.com/carp-lang/Carp into binary
2020-02-17 14:45:26 -05:00
hellerve
657f27c6ac
core: add stdint types
2020-02-17 10:42:07 +01: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
Scott Olsen
ea1505779d
Add Binary module
...
The binary module implements functions for interpreting byte sequences
as int16, int32, or int64 values depending on a given endianess (the
Byte module implements support for interpreting bytes as int8 values).
It'd be nice if we could implement these functions in pure Carp, using
the Bytes module--but unfortunately we need to rely on some type
conversions in C, which are only possible by registering C functions for
performing the necessary conversions.
At the moment, all of these functions are unsafe (they access byte
arrays using unsafe-nth).
2020-02-16 15:15:54 -05:00
Erik Svedäng
761789b2ff
Merge pull request #682 from hellerve/veit/doall
...
Readd old foreach as doall
2020-02-14 15:43:46 +01:00
hellerve
c78c936016
core: readd old foreach as doall
2020-02-14 15:32:15 +01:00
Erik Svedäng
e6ebc5da13
Merge branch 'veit/genericize-for' of https://github.com/hellerve/Carp into hellerve-veit/genericize-for
2020-02-14 10:44:29 +01:00
Erik Svedäng
0223f6d381
Merge pull request #679 from hellerve/veit/long-laws
...
Add Long.MAX, Long.MIN, and Long.zero
2020-02-14 10:43:07 +01:00
Erik Svedäng
381494bb4a
Merge pull request #676 from hellerve/veit/starts-with-check
...
core: add check in starts-with?/ends-with? for string length
2020-02-14 10:31:50 +01:00
hellerve
c89d79b359
core: add additional custom comparator to for
2020-02-13 16:02:49 +01:00
hellerve
ae3f9c49b8
core: add Long.MAX, Long.MIN, and Long.zero
2020-02-13 16:00:53 +01:00
hellerve
0328b8a28a
core: remove old definition of String.ends-with? (thanks @davidrusu)
2020-02-12 19:05:00 +01:00
hellerve
3b0b032bdc
core: fix fmt without arguments
2020-02-12 17:33:38 +01:00
hellerve
e9d04ce1b9
core: add check in starts-with?/ends-with? for string length
2020-02-12 17:22:03 +01:00
hellerve
ee812b37e6
core: make subarry/substring slice
2020-02-11 09:09:30 +01:00
hellerve
66431a4c80
pattern: fix captures, add split and global-match-str
2020-02-09 13:42:39 +01:00
hellerve
d7cf3982f8
pattern: fix newline, tab, and carriage return treatment
2020-02-09 12:58:53 +01:00
Erik Svedäng
6ddf0e8f2b
FIX! Avoid having to use temporary variables to help lifetime
...
checker.
In Concretize.hs, 'manageMemory' visits all args BEFORE managing their variables, making
it possible to apply functions to args "at the same time" as passing
them to the function.
Example:
(let [n (Array.unsafe-nth &b idx)
new-b (Bucket.shrink @n k)]
(Array.aset b idx new-b))))))
becomes
(let [n (Array.unsafe-nth &b idx)]
(Array.aset b idx (Bucket.shrink @n k)))))))
2020-02-07 16:01:33 +01:00
Erik Svedäng
b7de401b82
Fixed broken code because of unsafe-nth.
2020-02-07 15:06:21 +01:00
Erik Svedäng
4fe7ea072b
Merge branch 'master' into lifetimez-with-lambdas
2020-02-07 14:34:13 +01:00
Erik Svedäng
5eb603e470
Merge pull request #656 from hellerve/master
...
Make foreach (almost) hygienic
2020-01-30 14:36:55 +01:00
Erik Svedäng
248f84b1a7
Merge pull request #657 from sdilts/add-missing-header
...
Add missing #include <stdint.h> to carp_byte.h
2020-01-30 14:36:48 +01:00
sdilts
870b71e651
Add missing include directive
...
+ Missing stdint.h in carp_byte.h
2020-01-29 11:08:05 -07:00
hellerve
07fb17b753
core: make foreach loop counter hygienic
2020-01-29 15:48:02 +01:00
Erik Svedäng
bd7167986e
Merge pull request #653 from hellerve/veit/from-string
...
Add Float.from-string and Double.from-string
2020-01-29 15:06:31 +01:00
Erik Svedäng
9a8ce8fc99
Merge pull request #655 from hellerve/veit/char-zero-type
...
core: fix type of Char.zero
2020-01-29 15:01:57 +01:00
hellerve
43e4875138
core: make foreach (almost) hygienic
2020-01-29 11:55:56 +01:00
hellerve
07a21d76b5
core: fix type of Char.zero
2020-01-29 11:48:31 +01:00
hellerve
c0c31b6ad1
core: add Float.from-string and Double.from-string
2020-01-29 11:41:06 +01:00
Erik Svedäng
d9a2da18b0
Merge pull request #652 from hellerve/veit/const
...
Add const
2020-01-29 11:02:40 +01:00
hellerve
6c1901cccb
core: add const
2020-01-28 19:31:05 +01:00
Erik Svedäng
1cc751afbb
Merge pull request #651 from hellerve/veit/use-sprintf
...
Use snprintf only when checking length
2020-01-28 16:19:44 +01:00
Erik Svedäng
148add054f
Merge pull request #649 from hellerve/veit/reformat-core
...
Reformat carp_string and carp_byte
2020-01-28 15:24:00 +01:00
Erik Svedäng
60d98a8c15
Merge pull request #648 from hellerve/veit-cleanup-bench
...
Move get-time-elapsed into Bench module
2020-01-28 15:21:13 +01:00
hellerve
9a431b1f54
core: use memcpy in String_append
2020-01-27 23:11:45 +01:00
hellerve
657f6c9d3a
all: use snprintf only when checking length
2020-01-27 22:43:11 +01:00
hellerve
ac73729edf
core: better performing Map./Set.put!
2020-01-27 16:58:10 +01:00
hellerve
78cdcb46e7
core: reformat
2020-01-27 16:57:08 +01:00
hellerve
1b7e027642
core: move elapsed_time into bench module
2020-01-27 16:56:22 +01:00
Erik Svedäng
ea045be426
Merge branch 'byte-type' of https://github.com/hellerve/Carp into hellerve-byte-type
2020-01-27 10:10:58 +01:00
Erik Svedäng
4801fec15d
Merge branch 'veit/apply-ref' of https://github.com/hellerve/Carp into hellerve-veit/apply-ref
2020-01-27 10:07:50 +01:00
hellerve
95739d0cea
core: add IO.getenv
2020-01-25 14:23:14 +01:00
hellerve
3ebe10d587
core: make Maybe.apply take function ref
2020-01-25 14:08:37 +01:00
Erik Svedäng
afea0555b1
Merge pull request #644 from hellerve/reformat-core
...
core: reformat core.h
2020-01-23 10:15:36 +01:00
Erik Svedäng
773824f5e7
Merge branch 'master' of https://github.com/hellerve/Carp
2020-01-23 10:12:34 +01:00
hellerve
09404798c2
core: add Result.map-error
2020-01-22 12:36:03 +01:00
hellerve
ab5cbb3a49
core: reformat core.h
2020-01-22 12:18:03 +01:00
hellerve
65db2bc2a8
macros: add comp
2020-01-15 16:52:36 +01:00
Erik Svedäng
bd397f8d50
Merge pull request #635 from hellerve/string-from-cstr
...
core: add String.from-cstr
2020-01-15 09:44:05 +01:00
Erik Svedäng
0ca676f337
Merge pull request #634 from hellerve/make-result-fns-ref
...
core: make result functions take refs
2020-01-14 10:52:05 +01:00
hellerve
cc6774ef8c
core: make String.from-cstr copy
2020-01-14 10:08:29 +01:00
hellerve
3d1abf1469
commands: check char-at
2020-01-14 09:32:22 +01:00
hellerve
cd0c09da3f
core: add String.from-cstr
2020-01-13 22:49:23 +01:00
hellerve
40f3975937
core: make result functions take refs
2020-01-13 22:40:20 +01:00
Erik Svedäng
d0f2c447be
Merge pull request #632 from hellerve/fix-array-reduce-example
...
Fix example in Array.reduce documentation
2020-01-07 10:39:18 +01:00
hellerve
a67c33d2f5
core: fix example in Array.reduce (thanks @Emiluren)
2020-01-06 23:29:49 +01:00
Erik Svedäng
11be440fab
Work around defdynamic-once not working inside modules for now.
2019-12-18 12:35:27 +01:00
Erik Svedäng
50d91859c4
Merge branch 'master' of https://github.com/carp-lang/Carp
2019-12-18 12:11:50 +01:00
Erik Svedäng
7c15ec299b
'defined?' and 'defdynamic-once'
2019-12-18 12:10:47 +01:00
Erik Svedäng
2926abd1c8
Got rid of all but one compiler complaints on Windows.
2019-12-18 11:33:42 +01:00
Erik Svedäng
99bf013b81
Merge pull request #626 from nateupstairs/master
...
[win] attempt to fix windows compilation
2019-11-29 14:15:32 +01:00
Erik Svedäng
a6fb8c2515
Merge pull request #625 from hellerve/map->
...
RFC: Add Array.unreduce
2019-11-27 10:58:27 +01:00
hellerve
231b0a1d97
macros: fix nthcdr like @scolsen suggested
2019-11-26 07:13:14 +01:00
Erik Svedäng
e850da236f
Merge pull request #622 from hellerve/cxr
...
macros: add cxr, nthcar, and nthcdr
2019-11-25 12:58:24 +01:00
Erik Svedäng
81776b9635
Merge branch 'master' into hellerve-until
2019-11-25 12:44:14 +01:00
Erik Svedäng
34c314e6fe
Merge pull request #618 from sdilts/fopen-safe
...
Add open-file function
2019-11-25 12:42:42 +01:00
Erik Svedäng
cf276f4488
Merge pull request #608 from hellerve/pointer-arith
...
Add pointer arithmetic
2019-11-25 12:36:10 +01:00
Erik Svedäng
576dad0984
Merge branch 'master' into lifetimez-with-lambdas
2019-11-25 12:22:04 +01:00
hellerve
6bf45e16a6
macros: add until
2019-11-22 13:10:36 +01:00
hellerve
b1b84c8e3a
core: rename map-> to unreduce
2019-11-21 11:05:21 +01:00
nateupstairs
539804d9b0
[win] attempt to fix windows compilation
2019-11-20 13:26:59 -08:00
hellerve
48b8b4ec13
core: add Array.map->
2019-11-13 10:47:22 +01:00
hellerve
bc87e82d9f
macros: add cxr, nthcar, and nthcdr
2019-11-09 12:52:11 +01:00
sdilts
5614103107
open-file: Return the value of errno instead of an error string
2019-11-01 17:28:52 -06:00
sdilts
77614b21d9
Add errno to System.carp
...
+ Error values included are those that can be set from calling `fopen`
+ Change order of imports so that the System module is available before the IO module
2019-11-01 17:26:56 -06:00
sdilts
0386971f00
Add open-file function
...
`fopen` returns a nullable pointer, which doesn't fit very well with
Carp's notions of saftey and error handling. Instead, return a
`Result` type that forces the user to check if the operation was
successful.
+ Can't call the function fopen because we can't overload a C
function.
+ Leave `fopen` public in the IO module so extant code doesn't need to
be changed.
2019-11-01 14:54:18 -06:00
hellerve
98bc275ea5
core: add Byte.hash
2019-11-01 10:52:34 +01:00
hellerve
15c27bdb49
core: allow byte as member type
2019-11-01 10:52:34 +01:00
hellerve
f1f252639f
core: add a byte type
2019-11-01 10:52:34 +01:00
Erik Svedäng
16e9418d25
Merge pull request #616 from GrayJack/unsafe_fn
...
Rename known unsafe function to make clear that they're unsafe
2019-11-01 10:08:42 +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
Erik Svedäng
e90a123274
Merge branch 'includes' of https://github.com/GrayJack/Carp into GrayJack-includes
2019-10-31 14:30:07 +01:00
GrayJack
07def7db23
Fix all nth usage
2019-10-31 06:23:23 -03:00
Erik Svedäng
84afdb2575
Merge pull request #609 from hellerve/clang-format
...
Add .clang-format
2019-10-31 09:48:15 +01:00
GrayJack
2ac9d7fc12
Add 2 missing includes on core/Core.carp
2019-10-31 05:42:14 -03:00
GrayJack
2c0fcbd6c9
Changes Maybe.ptr to Maybe.unsafe-ptr and all it's ocurrences
2019-10-31 05:38:47 -03:00
hellerve
1829df07a5
core: do not have short functions on single lines
2019-10-30 11:07:32 +01:00
Erik Svedäng
c90d11b7ca
Merge pull request #606 from hellerve/better-repeat
...
Reduce allocations in String.repeat
2019-10-30 10:09:51 +01:00
Erik Svedäng
32a63d6def
Merge pull request #605 from hellerve/heap-without-copy
...
Reduce copies in heap
2019-10-30 10:05:11 +01:00
hellerve
65946224f0
core: add .clang-format (references #499 )
2019-10-30 08:47:36 +01:00
hellerve
2819d22729
core: add pointer arithmetic (references #423 )
2019-10-30 08:09:18 +01:00
Erik Svedäng
bfbd86711b
Merge branch 'master' into lifetimez-with-lambdas
2019-10-29 10:17:19 +01:00
hellerve
c6dafda518
core: reduce allocations in String.repeat
2019-10-28 18:13:40 +01:00
hellerve
fc204fff1e
core: reduce copies in heap
2019-10-28 17:23:46 +01:00
hellerve
eb9c236249
core: simplify Char.meaning
2019-10-28 17:19:31 +01:00
hellerve
e33c5fd7b4
core: actually register error
2019-10-28 14:28:37 +01:00
Erik Svedäng
6c9a6c0671
All tests run (yay).
2019-10-23 16:38:00 +02:00
Erik Svedäng
211cfdf65c
Some hackery to get the Map module to not emit lifetime warnings.
2019-10-21 10:23:19 +02:00
Erik Svedäng
09f2dd7e23
Can load the core library without complaints. Tests still fail.
2019-10-18 14:40:20 +02:00
Erik Svedäng
24b76f57af
Merge pull request #586 from zxygentoo/master
...
Fix Generics.approx doc name.
2019-10-15 09:15:58 +02:00
Jorge Acereda
c4957020dd
Add CARP_REALLOC() so it can be checked with CHECK_ALLOCATIONS
2019-10-13 10:40:54 +02:00
zxygentoo
4e0fd0a1ac
Fix Generics.approx doc name.
2019-10-09 14:36:59 +08:00
Jorge Acereda
4a4107fffd
Preserve includes order in generated output.
2019-10-03 00:23:27 +02:00
Erik Svedäng
1a0b003745
Remove defn for /=
2019-09-27 15:48:10 +02: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
336b43a2af
Add DoubleRef./=
2019-09-18 18:51:36 +02:00
Jorge Acereda
0423f40b51
Avoid copies.
2019-09-17 19:34:54 +02:00
Jorge Acereda
99ffd8efb7
Fix private? and hidden?.
2019-09-17 19:34:34 +02:00
Erik Svedäng
9e4f69ce5b
Merge branch 'string-join-ref' of https://github.com/hellerve/Carp into hellerve-string-join-ref
2019-09-17 14:37:12 +02:00
hellerve
aad568c941
core: make String.join take ref (for #562 )
2019-09-16 20:22:01 +02:00
Erik Svedäng
e455bab500
Array.contains?
2019-09-16 15:33:18 +02:00
Scott Olsen
c049394fa3
Macros: Make map more lispy
...
I've updated the implementation of map to make it similar to
implementations in other lisps. Calling map either calls an
implementation of the traditional `map` if a single list is provided as
an argument, or to `zip/zip-with` if multiple forms are provided as
arguments.
In order to facilitate this implementation, I've also implemented
several utility functions:
empty?: returns true if a data literal is empty.
and-internal: boolean and (the prior and macro doesn't work for our
purposes because it returns a form).
or-internal: boolean or, ditto regarding the existing or macro.
apply: applies a function to a list of arguments.
zip-internal: the implementation of zip-with we use in map.
reduce: works in the traditional way, folds a list of values into a
single value using a binary function and some initial value.
2019-09-14 23:54:56 -04:00
Erik Svedäng
0567c8ef14
Some docs for the SDL bindings.
2019-09-13 12:37:06 +02:00
Erik Svedäng
e4dceb2405
More functional event handler in SDLApp.
2019-09-13 12:09:11 +02:00
Jorge Acereda
57e46cc4db
Use get-tag.
2019-09-11 20:37:15 +02:00
Jorge Acereda
df72627974
Fix doc
2019-09-11 20:24:09 +02:00
Jorge Acereda
c14a38a457
Remove str, fix hash/=.
2019-09-11 20:24:09 +02:00
Jorge Acereda
85cacf538f
Stronger types for Color
2019-09-11 20:24:09 +02:00
hellerve
ba1fb68fe1
core: add dynamic string functions tail, prefix, and suffix
2019-09-11 15:03:44 +02:00
Erik Svedäng
ec9fc0f493
Merge pull request #550 from jacereda/typos
...
Fix some typos.
2019-09-11 11:11:39 +02:00
Jorge Acereda
8162deb1bb
Fix gcc9 warning.
2019-09-11 08:33:38 +02:00
Jorge Acereda
cb9ff267b6
Fix some typos.
2019-09-11 08:21:42 +02:00
Scott Olsen
b9c0aa1bee
Macros: Add map dynamic function
...
Adds a `map` function to the dynamic module. This function takes some
function (perhaps we should restrict it to only accept dynamic
functions?) and one or more forms. It returns a list data literal
containing the results of applying the function to each form.
2019-09-10 21:51:53 -04:00
Jorge Acereda
aa71647d02
Fix crashes in String.join/join-with-char with empty array.
2019-09-10 21:49:00 +02:00
Jorge Acereda
d29ff19968
Remove #516 workaround.
2019-09-10 20:46:09 +02:00
Erik Svedäng
6d6f93ec28
Merge pull request #542 from hellerve/gensym
...
Add gensym
2019-09-10 11:13:36 +02:00
Erik Svedäng
a6d4358ead
Merge pull request #541 from jacereda/generics2
...
Working on generics.
2019-09-10 10:55:10 +02:00
hellerve
439f734809
core: add gensym-with
2019-09-09 22:33:56 +02:00
Jorge Acereda
99516122b1
Generics no longer propagated.
2019-09-09 22:08:50 +02:00
Erik Svedäng
e40dfc57d7
Merge pull request #536 from scolsen/array-list-dynamics
...
Macros: Add dynamic list to array transforms
2019-09-09 21:43:04 +02:00
hellerve
a2c859c586
all: remove local-include in favor of relative-include
2019-09-09 17:56:43 +02:00
hellerve
f992fb4582
core: add gensym
2019-09-09 09:59:22 +02:00
Scott Olsen
b6abf38082
Merge branch 'master' of https://github.com/carp-lang/Carp into array-list-dynamics
2019-09-08 15:00:40 -04:00
Scott Olsen
b9d792ae39
Macros: Implement hellerve@'s generic collect-into
...
This change removes the previous array/list transformation dynamic
functions in favor of a generic collection transform courtesy of
@hellerve.
I made one minor adjustment to make the api more friendly, namely, the
implicit introduction of quoting such that users do not have to do so
themselves.
2019-09-08 14:58:30 -04:00
Scott Olsen
9aa7e4c0cb
Macros: Fix issue in array-to-list
...
In order to work properly, the list returned by the array-to-list
function needs to be quoted.
Additionally, I fixed an obvious error in which the wrong internal
function was called in array-to-list
2019-09-08 14:54:29 -04: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
d8545a57be
Merge pull request #532 from jacereda/stdhandles
...
Add stdin/stdout/stderr.
2019-09-02 10:27:06 +02:00
Erik Svedäng
85e1983658
Merge pull request #531 from jacereda/abort
...
Use abort() for assertions.
2019-09-02 10:21:34 +02:00
Erik Svedäng
c2d4794246
Merge pull request #527 from hellerve/format-errors
...
Better error messages in fmt
2019-09-02 10:16:46 +02:00
Erik Svedäng
a8ae8570d5
Merge pull request #517 from jacereda/float-variants
...
Use float variants.
2019-09-02 10:02:05 +02:00
Erik Svedäng
0b29fd6ff6
Merge pull request #510 from jacereda/string-asserts
...
Fix string assert, simpler/faster conditions.
2019-09-02 09:48:38 +02:00
Scott Olsen
a8751a712e
Macros: Add dynamic list to array transforms
...
This change adds two utility functions to the Dynamic module for
transforming list forms into arrays and array forms into lists.
Using this function, one can easily convert lists and arrays for
ease of symbol manipulation, for example:
```clojure
(Symbol.join (list-to-array (list 'a 'b 'c)))
```
This comes in handy, for instance, when defining macros, as certain
forms in Carp expect arrays in certain places while others expect
list--this enables the programmer to flexible convert between the two as
needed.
2019-08-26 23:44:29 -04:00
Jorge Acereda
a5b527efbe
Add stdin/stdout/stderr.
2019-07-29 21:50:08 +02:00
Jorge Acereda
554b9df849
Use abort() for assertions.
2019-07-29 21:48:20 +02:00
hellerve
daf8f017c8
core: better error messages in fmt
2019-07-22 13:09:22 +02:00
Jorge Acereda
82bc16c809
More generic for macro
2019-07-09 00:18:38 +02:00
Jorge Acereda
a5f3d0025d
Use float variants.
2019-07-06 19:56:35 +02:00
Erik Svedäng
af127da90c
Merge pull request #511 from hellerve/todo
...
Add todo macro
2019-06-27 09:10:57 +02:00
Erik Svedäng
c5d07b81d7
Merge pull request #509 from jacereda/asan-warnings
...
Enabling address sanitizer yields warnings due to _FORTIFY_SOURCE red…
2019-06-27 08:59:32 +02:00
Erik Svedäng
698f1870e1
Merge pull request #505 from hellerve/copy-map-updater
...
Copy default in Map.update-with-default
2019-06-27 08:55:56 +02:00
hellerve
f60f72f4b4
core: add todo macro
2019-06-22 20:18:32 +02:00
Jorge Acereda
e10f4228c0
CHK_INDEX macro
2019-06-21 00:00:46 +02:00
Jorge Acereda
d8919bf1e8
Fix string assert, simpler/faster conditions.
2019-06-20 12:43:37 +02:00
Jorge Acereda
e8c9d77d8f
Enabling address sanitizer yields warnings due to _FORTIFY_SOURCE redefinition.
2019-06-20 12:12:26 +02:00
Erik Svedäng
7d1d16dd53
Merge pull request #506 from jacereda/sdl-init
...
Initialize SDL explicitly
2019-06-17 20:26:31 +02:00
Erik Svedäng
2022afede7
Merge branch 'master' of https://github.com/carp-lang/Carp
2019-06-17 20:24:42 +02:00
Erik Svedäng
19eee410c3
SDL pkg-config name should be lowercase.
2019-06-17 20:23:27 +02:00
Erik Svedäng
09422f89d6
Merge pull request #502 from jacereda/just-ptr
...
Add Unsafe.coerce
2019-06-17 20:23:09 +02:00
Jorge Acereda
a88b3ffbf9
Initialize SDL explicitly
2019-06-17 20:02:17 +02:00
Jorge Acereda
db6e5b87e7
Add Unsafe.coerce
...
Used for Maybe.ptr, fixes #494 .
2019-06-17 19:30:16 +02:00
hellerve
7882b7ad57
core: copy default in Map.update-with-default
2019-06-17 13:43:45 +02:00
Erik Svedäng
ae076f5faa
Merge pull request #504 from hellerve/checked-malloc
...
Optionally check malloc
2019-06-17 09:26:53 +02:00
Erik Svedäng
db62efc825
Merge pull request #495 from jacereda/comp-flags
...
Use pkg-config for SDL flags.
2019-06-17 09:24:18 +02:00
hellerve
8b78fe453a
core: optionally check malloc
2019-06-17 09:17:20 +02:00
Erik Svedäng
d1381ad41d
Merge pull request #498 from jacereda/const
...
Add some const qualifiers, removed MALLOC() null checks, fixed Float_…
2019-06-17 09:03:53 +02:00
Jorge Acereda
7ed48b733b
Refactored flags handling (add-pkg).
2019-06-17 09:02:34 +02:00
Jorge Acereda
9ef01c67c6
Split flags for glfw.
2019-06-17 09:02:34 +02:00
Jorge Acereda
ba8a9a1853
Use pkg-config for SDL flags.
2019-06-17 09:00:24 +02:00
Erik Svedäng
d4182b53ef
Merge pull request #497 from jacereda/sdl-unused
...
Sdl unused
2019-06-17 08:44:22 +02:00
Erik Svedäng
6b2b33e823
Merge pull request #496 from jacereda/char-zero
...
Implement zero for Char.
2019-06-17 08:33:14 +02:00
Erik Svedäng
5e2faba7b9
Merge branch 'opengl-fw' of https://github.com/jacereda/Carp
2019-06-17 08:10:22 +02:00
Erik Svedäng
eaf2a427df
Implement str/prn for &Bool
2019-06-14 15:24:25 +02:00
Jorge Acereda
bbee702f5e
Add some const qualifiers, removed MALLOC() null checks, fixed Float_modf(), use memcpy() instead of memmove().
2019-06-14 14:38:19 +02:00
Erik Svedäng
882bcce8bc
carp_system.h should include carp_string.h
2019-06-14 13:24:40 +02:00
Jorge Acereda
ab07aecc25
Warning in generated code.
2019-06-14 13:13:22 +02:00
Jorge Acereda
aa897869d0
Remove unused SDL_INIT_EVERYTHING.
2019-06-14 13:13:04 +02:00
Jorge Acereda
c76177dfa7
Implement zero for Char.
2019-06-14 13:02:03 +02:00
Jorge Acereda
2343025ecf
Move OpenGL.framework reference to its own module.
2019-06-13 18:21:59 +02:00
Jorge Acereda
bbf8c23281
Use standard NDEBUG instead of OPTIMIZE.
2019-06-13 14:29:47 +02:00
hellerve
538c4370dd
core: add Maybe.or-zero
2019-06-12 08:49:54 +02:00
Erik Svedäng
fbd9c83f0d
Documented the Dynamic module.
2019-06-07 15:19:07 +02:00
hellerve
465f34b7ff
core: add annotations
2019-06-06 10:54:58 +02:00
Erik Svedäng
57748d21f8
Merge pull request #462 from hellerve/map-ho-non-owning
...
Make map’s higher order functions take refs
2019-06-06 09:53:02 +02:00
hellerve
c87893dd14
core: make map’s higher order functions non-owning
2019-05-27 18:42:25 +02:00
hellerve
e9fcf87ff5
core: remove stringcopy.append
2019-05-27 18:05:44 +02:00
Erik Svedäng
a34752413e
Merge pull request #457 from hellerve/fix-string-words
...
Also split by newline in String.words
2019-05-27 10:41:47 +02:00
Scott Olsen
8c4d38233b
Map: Fix small typo in doc empty?
2019-05-24 12:30:00 -04:00
hellerve
113aa1d96a
core: also split by newline in String.words
2019-05-24 15:39:52 +02:00
Erik Svedäng
006b3bf5f0
Merge pull request #454 from hellerve/const-assert
...
Add const-assert
2019-05-22 21:24:28 +02:00
Erik Svedäng
2c978a09f4
Merge pull request #455 from hellerve/in-place-map-put
...
Add Map.put! and Set.put!
2019-05-22 21:23:49 +02:00
hellerve
9010a5c2ee
core: add Map.put! and Set.put!
2019-05-22 20:13:38 +02:00
hellerve
3768c42d23
core: add const-assert
2019-05-22 20:01:03 +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
Erik Svedäng
cb5d3cecf7
Merge pull request #451 from scolsen/scolsen/project-macro
...
Macros: Add defproject macro
2019-05-20 14:54:46 +02:00
Scott Olsen
6819ab7707
Macros: Add defproject macro
2019-05-20 00:08:09 -04:00
hellerve
c091b36b23
compiler: generate documentation for compiler-generated functions automatically
2019-05-16 15:51:56 -04:00
Erik Svedäng
d01743e5aa
Merge pull request #435 from hellerve/fix-pattern-docs
...
Fix pattern docs
2019-05-16 09:42:49 +02:00
GrayJack
353f8470ed
Fix tests on memory.carp, Modify Statistics module as Veit Heller
...
sugested
2019-05-14 20:11:19 -03:00
GrayJack
bfd80fd4af
Fix minimum name and it comparison function
2019-05-14 13:29:30 -03:00
GrayJack
25e80273ff
Fix memory test using the new version of the Array function
...
Tried to fix problems on Statistics.carp with the new Array functions
2019-05-14 13:26:19 -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
Erik Svedäng
9b6e3636a8
Merge pull request #439 from hellerve/safe-read
...
Safe IO.read->EOF
2019-05-10 11:26:40 +02:00
hellerve
992b0c5fc5
core: fix IO.read->EOF
2019-05-10 11:21:46 +02:00
Erik Svedäng
8bc50fa0c9
Merge pull request #436 from hellerve/reverse
...
Add Pair.reverse and Map.reverse
2019-05-05 12:19:54 +02:00
hellerve
8089585f0a
core: add docstring to Map.reverse
2019-05-05 11:55:37 +02:00
hellerve
58e280c553
core: add Pair.reverse and Map.reverse
2019-05-05 11:49:30 +02:00
hellerve
ffa8302e1e
core: better Pattern docs
2019-05-04 09:41:33 +02:00
Erik Svedäng
cc26dbdbcf
Merge pull request #432 from hellerve/fix-287
...
Add Maybe.ptr and Maybe.from-ptr
2019-05-03 15:30:24 +02:00
hellerve
79a0fb77c5
core: add Maybe.ptr and Maybe.from-ptr, references #287
2019-05-03 13:49:33 +02:00
Veit Heller
64ef326a21
core: typo fix in Maybe.to-result
2019-05-02 22:33:18 +02:00
Erik Svedäng
ab16e9de5e
Merge pull request #428 from hellerve/clarify-git-loading
...
Clarify git loading situation in docs
2019-05-01 11:25:31 +02:00
hellerve
122038fad3
docs: clarify git loading situation
2019-05-01 00:24:29 +02:00
hellerve
a1f5b1fc2f
core: add while-do macro
2019-04-30 21:42:34 +02:00
Erik Svedäng
702ca00f08
Merge pull request #417 from hellerve/optional-assert
...
Make all asserts optional
2019-04-21 10:53:59 +02:00
hellerve
0e7bd44dd9
core: make all asserts optional
2019-04-21 08:43:18 +02:00
Erik Svedäng
a13ebe9e78
Merge pull request #412 from hellerve/embedded-changes
...
Remove headers that are problematic for embedded applications
2019-04-17 22:51:26 +02:00
hellerve
1e21f2b5f6
core: remove unused else in ifdef
2019-04-17 13:52:08 +02:00
hellerve
fb9bbe1d9b
core: remove some headers that are problematic for embedded applications
2019-04-17 13:47:18 +02:00
Scott Olsen
65d612939a
Fix doc for get-args-len
...
I was running through the docs and it seemed like get-arg was incorrectly documented based on the signature. It looks like the doc for get-args-len was reassigned to get-arg.
2019-04-16 17:49:31 -04:00
Erik Svedäng
f1c1fa1563
Merge pull request #404 from opqdonut/fix-update-with-default-docs
...
fix Map.update-with-default docs
2019-03-28 15:30:07 +01:00
Joel Kaasinen
4cf918f71a
core/Array.carp: fix minimum and maximum for non-primitive types
2019-03-28 16:14:07 +02:00
Joel Kaasinen
0bcf6f6e72
fix Map.update-with-default docs
...
they were accidentally overwriting Map.update docs
2019-03-28 16:06:45 +02:00
Erik Svedäng
a4fb6d3177
Merge pull request #401 from hellerve/master
...
Make `Array.range` more general
2019-03-26 22:38:13 +01:00
hellerve
9c4731fccc
core: specialize Char.random again!
2019-03-26 18:19:10 +01:00
hellerve
d9c8ee4710
core: add tests for range on non-integer and update docs
2019-03-26 18:10:31 +01:00