66 Commits

Author SHA1 Message Date
Erik Rauer
a606a47ce1 Add tests for vector/_contains
This adds the tests for `vector/_contains`
2020-12-27 15:08:51 -06:00
Nic McPhee
9028a8e174 "Simplify" the testing for concat and subvec
This introduces some fancy macro action that allows us to skip the four calls to `(concat-spec …)` with the different generators and types.

@ErikRauer and I wrestled with this for a _long_ time today, and it turned out that it was absolutely necessary to quote the generators in `gen-type-pairs on lines 10-13. I'm not 100% sure why, but it seems that without that something (perhaps a level of macro-ness) got unwrapped too early and then it couldn't find the generator because it had lost the namespace it belonged in.

Whether this actually _simplifies_ things is really up for debate. If this is as far as we get, it's probably not worth it. If we can find a reasonable way to reduce the other sources of duplication, however, it might be worth it?
2020-12-21 16:59:04 -06:00
Nic McPhee
bd59045767 Add tests for vector/_concat
This adds tests for `vector/_concat`.
2020-12-21 16:40:22 -06:00
Nic McPhee
75de8e5be5 Comment out the boilerplate test in core-test
We should remove that, and maybe the whole file, but for now I'll just comment it out.
2020-12-21 16:39:48 -06:00
Nic McPhee
91df21dba5 Fix error in vector/_last
Similar to `vector/_first`, this didn't check for the empty vector case, so I've changed it to return `:ignore-instruction` in that case.

There's a lot of duplication between `_first` and `_last`, which makes me think there's some refactoring opportunities.
2020-12-18 17:03:56 -06:00
Nic McPhee
ab1f6d4396 Add tests for vector/_last
This adds test.check tests for `vector/_last`. This is _really_ similar to `vector/_first` (and the other vector tests), so I think there are definitely ways to extract common logic from these.
2020-12-18 17:02:18 -06:00
Nic McPhee
66ec0a1ebd Address the possibility of vectors being empty in vector/_first
The original version just used the built-in `first`, which returns `nil` if you give it an empty collection, which is almost certainly not a useful behavior.

This changes it to return `:ignore-instruction` if the vector is empty, thereby leaving all the stacks unchanged.
2020-12-17 18:45:06 -06:00
Nic McPhee
f2eecc774f Add tests for vector/_first
These turned up an oversight in the implementation in `vector/_first` that is addressed in the next commit.
2020-12-17 18:42:57 -06:00
Erik Rauer
b3d9d89f4c Allow instructions to indicate they should be ignored
`make-instruction` will ignore any instructions that return `:ignore-instruction`. This allows instructions to be skipped without consuming their arguments.
2020-12-17 18:32:41 -06:00
Nic McPhee
fc26886815 Fix bugs in vector/_subvec
There were two independent bugs in `vector/_subvec` that were turned up by our `test.check` testing.

The first was that the order of the arguments was wrong and `stop-raw` and `start-raw` were flipped.

The second was that `stop` wasn't max'ed with 0, which meant it could sometimes be negative, leading to an `IndexOutOfBoundsException`.
2020-12-17 15:58:11 -06:00
Nic McPhee
d1e863a23a Start test.check tests on vector instructions
This is a start on using `test.check` to write tests for the vector instructions. We currently have tests for:

   * `vector/_emptyvector`
   * `vector/_indexof`
   * `vector/_subvec`

There are _lots_ of other functions still to be tested.

This did reveal errors in `vector/_subvec`, which will be addressed in the next commit.

We used macros to make it easy to generate tests for each of the four vector types; this should be extensible to additional vector types in the future if needed.
2020-12-17 15:56:27 -06:00
Nic McPhee
a6e195eb0e Add data and .calva to .gitignore
We don't want to be committing the data files or the Calva files generated by running Clojure in VS Code. This fixes that.
2020-12-17 08:15:40 -06:00
Nic McPhee
0ca5e77d7a Merge remote-tracking branch 'upstream/master' 2020-11-24 15:19:29 -06:00
Lee Spector
a8e9de97ce Fix peek-stack for false on boolean stack 2020-11-23 09:57:04 -05:00
Lee Spector
f47e5e924a
Merge pull request #7 from NicMcPhee/fix-random-int-generation
Fix bug in `random-int`
2020-11-10 21:06:22 -05:00
Nic McPhee
bfa557c6a1 Fix bug in random-int
The `random-int` function in both `number-io` and `smallest` subtracted a floating point value (`100.0`), which means they were both _actually_ returning a float instead of an int.

This removes both of the ".0"s so that they return integers as advertised.
2020-11-10 16:59:32 -06:00
Lee Spector
db085080b3
Merge pull request #6 from skwak22/master
This version of propeller has full CLJS functionality and compiles with shadow-cljs
2020-07-23 15:21:37 -04:00
Sunghoon Kwak
bdff94091b
Update license info 2020-07-15 22:44:25 +09:00
skwak22
baf28a3e79 Working cljs version of propeller 2020-07-15 22:23:42 +09:00
Sunghoon Kwak
689536b735
Update README.md 2020-07-15 21:24:56 +09:00
skwak22
44aaf4a156 introduce shadow-cljs as ClojureScript compiler 2020-07-15 21:19:38 +09:00
Maria-Cristiana Gîrjău
4de782c50a
Merge pull request #6 from skwak22/master
ClojureScript namespace changes and small tweaks with dependencies
2020-07-14 09:57:05 -04:00
Sunghoon Kwak
16b353faf9
Delete .DS_Store 2020-07-14 16:06:03 +09:00
skwak22
bf54db427b Some changes for CLJS compatibility 2020-07-14 16:05:20 +09:00
mcgirjau
7820d5529b Clean up macros 2020-07-14 00:14:04 -04:00
mcgirjau
3f5c2fd8a7 Add string instructions 2020-07-13 21:24:43 -04:00
mcgirjau
3e820407f3 Cleanup and metadata fix 2020-07-13 17:04:05 -04:00
mcgirjau
7ce624d4ba Add Number IO and Smallest problems 2020-07-01 13:07:13 -04:00
Maria-Cristiana Gîrjău
c1e3f7e45f
Merge pull request #4 from skwak22/master
Converted to cljc (without xml files)
2020-06-30 09:42:42 -04:00
Sunghoon Kwak
b555e1300e
Converted files to cljc & ns changes for cljs 2020-06-30 20:39:36 +09:00
skwak22
9eae13a89d removed clj files 2020-06-30 20:36:40 +09:00
mcgirjau
74515bd11b Add output instructions 2020-06-30 00:08:48 -04:00
mcgirjau
69142757ce Add input handler and refactor interpreter 2020-06-29 22:52:41 -04:00
mcgirjau
ca33a46627 Remove .xml 2020-06-29 19:27:00 -04:00
mcgirjau
7184cd6644 Finish polymorphic and vector instructions 2020-06-29 19:19:55 -04:00
mcgirjau
66856cf99f Remove some stacks 2020-06-26 10:34:04 -04:00
Lee Spector
fa9befd8b0 Remove :zip 2020-06-25 16:40:10 -04:00
Lee Spector
d4140096a6 Reformat 2020-06-25 16:36:52 -04:00
mcgirjau
5ff0fbed77 Move require to top level 2020-06-25 13:26:11 -04:00
mcgirjau
11a2534f67 Alphabetize namespace dependencies 2020-06-25 13:21:41 -04:00
Maria-Cristiana Gîrjău
07956a0eca
Merge pull request #2 from skwak22/master
More namespace compatibility changes
2020-06-25 13:17:50 -04:00
skwak22
b417e4c2aa more namespace compatibility changes 2020-06-26 02:09:28 +09:00
mcgirjau
4bd92503a3 Move tools module for ClojureScript compatibility, and style fixes 2020-06-25 12:57:20 -04:00
Maria-Cristiana Gîrjău
64d43756b6
Merge pull request #1 from skwak22/master
Replace :refer :all with :require
2020-06-25 12:12:48 -04:00
skwak22
e324ee95ef replaced :refer :all with :require 2020-06-26 01:04:06 +09:00
mcgirjau
9e0a8d51b7 Remove symbols from instruction names, and use 1 instead of NOOP for division 2020-06-25 09:40:29 -04:00
mcgirjau
f04804b00b Namespace cleanup and add polymorphic instructions 2020-06-24 22:30:25 -04:00
mcgirjau
73b3963b90 Port numeric instructions 2020-06-24 19:57:20 -04:00
mcgirjau
bb5f74823c Refactor instructions 2020-06-24 16:16:53 -04:00
mcgirjau
af033c1b0e New structure 2020-06-23 11:09:15 -04:00