Commit Graph

1065 Commits

Author SHA1 Message Date
Scott Olsen
d45a6424eb Fix arity for sumtypes 2020-05-22 01:29:53 -04:00
Scott Olsen
7f095d754c Add Introspect module
The introspect module contains functions that return information about
program bindings based on their s-expressions.
2020-05-22 01:16:55 -04:00
Jorge Acereda
ccb31c589a Avoid division by zero. 2020-05-21 20:05:02 +02:00
Jorge Acereda
59ef5bbf2b Added --compile-fast to compile with tcc. 2020-05-21 20:04:54 +02:00
hellerve
74d734903e core: move range into array ext and add unsafe-range 2020-05-21 15:23:29 +02:00
scottolsen
f819f083cc Fix signature of Control.iterate-until
Now that sigs work, turns out the signature for iterate-until and it's
definition don't match.

There was an extra argument in the sig, which I've removed. Adding a ref
to `result` also confused the type checker, since result technically has
two types in the definition whenever `b` is not a ref. I believe the
side effect of this change is that the `start` argument must now be a
`Ref`, but at least it's well-typed.
2020-05-20 23:40:46 -04:00
Erik Svedäng
099d242d1f
Merge pull request #820 from hellerve/veit/fix-818
macros: fix hidden?, private?, and annotate?
2020-05-20 22:32:32 +02:00
hellerve
cc19bdc917 macros: fix hidden?, private?, and annotate? 2020-05-20 10:04:05 +02:00
scottolsen
e44f5e00c7 Fix erroneous implements call for PairRef.> 2020-05-19 16:54:36 -04:00
scottolsen
39e9836452 Add an implements? macro
This macro simply returns true or false if a binding implements a given
interface.
2020-05-19 16:53:15 -04:00
Erik Svedäng
74c5542abb
Merge pull request #816 from hellerve/veit/add-implements-to-longref
Add missing longref implements annotations
2020-05-19 06:11:14 +02:00
hellerve
32d4095a5d core: make NULL Ptr a instead of a 2020-05-18 23:21:16 +02:00
hellerve
5f408229a1 core: add missing longref implements procs 2020-05-18 23:02:26 +02:00
hellerve
3353427dd9 core: make Array.range safe 2020-05-18 22:59:41 +02:00
Erik Svedäng
d85086e518
Merge pull request #810 from hellerve/veit/fix-debug-trace
Fix Debug.trace for new evaluator
2020-05-18 20:51:00 +02:00
hellerve
1b39139d7b core: fix Debug.trace for new evaluator 2020-05-16 12:46:05 +02:00
Scott Olsen
5cd786c732 Add an implements-all macro
This macro adds implements forms for functions with the same name as a
given list of interfaces in a given module.
2020-05-15 12:46:35 -04:00
Erik Svedäng
f71613a0c8
Merge pull request #796 from dbalan/freebsd_platform
Add FreeBSD as a supported platform
2020-05-13 21:25:20 +02:00
Erik Svedäng
14a0d7e722
Merge pull request #799 from hellerve/veit/string-to-bytes
Add String.to-bytes
2020-05-13 20:59:37 +02:00
Erik Svedäng
855ddb75bf
Merge pull request #798 from hellerve/veit/generics-typo-fix
Fix typo in docs for Generics.approx
2020-05-13 20:59:04 +02:00
hellerve
468c232741 core: add String.to-bytes 2020-05-13 17:15:26 +02:00
hellerve
8e062c3173 core: fix typo in docs for Generis.approx 2020-05-13 16:45:11 +02:00
Dhananjay Balan
05bf39827b Add signal.h on FreeBSD platforms
The SIGNAL definitions are in signal.h, this also adds a macro freebsd-only, in the style of other platform-only macros.
2020-05-13 16:10:00 +02:00
Erik Svedäng
e4e3c4208a
Merge pull request #790 from hellerve/veit/safe-num-from-string
Make Num.from-string better
2020-05-12 23:04:00 +02:00
hellerve
058ef11f9c core: add implements for FloatRef comparators 2020-05-12 22:45:29 +02:00
hellerve
c569666a0a core: make from-string better 2020-05-12 22:33:40 +02:00
Erik Svedäng
d9295b3c1f
Merge pull request #788 from hellerve/veit/str-on-numeric-refs
Add str on refs for numeric types
2020-05-12 22:25:25 +02:00
Erik Svedäng
dcca7505d1
Merge pull request #786 from hellerve/veit/move-to-templates
Move templates out of the compiler into deftemplates
2020-05-12 22:24:54 +02:00
hellerve
fe2c08c1ff core: rearrange templates 2020-05-12 21:58:40 +02:00
hellerve
eec1ad9375 test: rollback accidently commited test update 2020-05-12 21:54:48 +02:00
hellerve
06f7ea4c28 docs: update for refs 2020-05-12 21:50:21 +02:00
hellerve
8636dd467f core: add str on refs for numeric types 2020-05-12 21:50:20 +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
Erik Svedäng
2121b87151
Merge pull request #787 from hellerve/veit/add-new-asserts
Add assert-ref-equal, assert-just, and assert-nothing
2020-05-12 19:59:36 +02:00
hellerve
9e2c2fe2fd test: add assert-ref-equal, assert-just, and assert-nothing 2020-05-12 14:53:42 +02:00
hellerve
fce423aee9 core: move as many templates as possible out of the compiler 2020-05-12 12:44:17 +02:00
Erik Svedäng
9ba6a26ff1
Merge pull request #782 from TimDeve/enumerate-empty-arrays
Makes enumerated work with empty arrays
2020-05-12 12:03:14 +02:00
Erik Svedäng
0f461dd011
Merge pull request #771 from hellerve/veit/pattern-substitute-docs
Mention backreferences in docs for Pattern.substitute
2020-05-12 11:33:17 +02:00
hellerve
d2235112dd core: move the first function into carp template 2020-05-12 11:32:26 +02:00
Jorge Acereda
2186b34e94 Roll our own UTF-8 support. 2020-05-12 01:14:02 +02:00
Jorge Acereda
4e744a00ae Don't include windows.h on mingw. 2020-05-12 01:13:36 +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
scottolsen
681054be63 Merge branch 'master' of https://github.com/carp-lang/Carp into implement-prim 2020-05-11 14:42:11 -04: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
Jorge Acereda
a95fe95ab1 Fix warning on Windows. 2020-05-11 16:10:41 +02:00
Jorge Acereda
9b08b6df3c Merge 2020-05-11 16:10:35 +02:00
Jorge Acereda
83e8c1a874 Fix Char_str(). 2020-05-11 16:08:40 +02:00
Jorge Acereda
0fb9f9a56e Hopefully portable and simple get-line. 2020-05-11 16:08:40 +02:00
Jorge Acereda
4fb5a1195d Fix warning due to ignored fread() return value. 2020-05-11 16:08:40 +02:00
Jorge Acereda
9f87d17561 Ignoring system() return value produces warnings on some systems, just return it. 2020-05-11 16:08:40 +02:00
Jorge Acereda
de89be2bb5 Use system-include like the rest. 2020-05-11 16:08:40 +02:00
Nils 'Linkie Pi' Reid
43c64d5ed1 Fix the inline-c macro to avoid using a reserved keyword as parameter. 2020-05-11 10:58:24 +02:00
Scott Olsen
26131f2b1c Add remaining implements declarations 2020-05-10 22:53:35 -04:00
Scott Olsen
f13a2fdd9d Add some more calls to implement to make tests pass 2020-05-10 13:32:22 -04:00
hellerve
57be1e7f4e core: mention backreferences in substitute docs 2020-05-10 12:20:26 +02: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
Nils 'Linkie Pi' Reid
a8032f3b72 Readded inline-c as a macro of deftemplate. 2020-05-08 15:17:34 +02: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
Erik Svedäng
870d549da9 Merge branch 'master' into do-not-reload-core-libs 2020-05-06 10:08:56 +02:00
Erik Svedäng
78f85d73c1
Merge pull request #747 from hellerve/veit/better-dynamic-tests
Better dynamic tests
2020-05-05 15:20:08 +02:00
hellerve
4e711a4eb0 core: add docs for any? and all? 2020-05-05 15:19:43 +02:00
hellerve
80d1086cb7 tests: better dynamic tests 2020-05-05 15:09:18 +02:00
Erik Svedäng
ca804beace Added support for (load-once). 2020-05-05 15:00:57 +02:00
Erik Svedäng
6f70dbd18e Merge branch 'master' into match-on-refs 2020-05-05 13:57:58 +02:00
Erik Svedäng
9951468a5a
Merge pull request #742 from hellerve/veit/fix-719
Make primitives proper AST objects
2020-05-05 09:45:00 +02:00
hellerve
5838136f83 core: rename dynor and dynand and check in docs 2020-05-04 23:47:06 +02:00
Erik Svedäng
e6c119d34c Remove comment. 2020-05-04 13:21:40 +02:00
Tim Dévé
da98a770be Adds StaticArray nth & contains? 2020-05-04 09:35:39 +01:00
Tim Dévé
acc5dbb914 Adds StaticArray sum, index-of, element-count, predicate-count, aupdate! & swap! 2020-05-04 09:35:39 +01:00
Tim Dévé
5965b098bb Adds StaticArray reverse! 2020-05-04 09:35:39 +01:00
Tim Dévé
b5d363c85e Adds StaticArray minimum & maximum 2020-05-04 09:35:39 +01:00
Tim Dévé
27ce300648 Adds StaticArray first, unsafe-first, last & unsafe-last 2020-05-04 09:35:39 +01:00
Tim Dévé
b87fd0911c Adds StaticArray find & find-index 2020-05-04 09:35:39 +01:00
Tim Dévé
ce3f53518f Adds StaticArray empty? any? & all? 2020-05-04 09:35:39 +01: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
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