Init skeleton project

This commit is contained in:
Stephen Seo 2020-12-06 17:55:30 +09:00
commit d59d747678
5 changed files with 39 additions and 0 deletions

5
c_impl/.gitignore vendored Normal file
View file

@ -0,0 +1,5 @@
listSlices_c
src/*.o
.cache/
compile_commands.json

18
c_impl/Makefile Normal file
View file

@ -0,0 +1,18 @@
COMMON_FLAGS = -Wall -Wextra -Wpedantic
ifdef DEBUG
CFLAGS = $(COMMON_FLAGS) -O0 -g
else
CFLAGS = $(COMMON_FLAGS) -O3 -DNDEBUG
endif
all: listSlices_c
listSlices_c: src/main.o
$(CC) $(CFLAGS) -o listSlices_c $^
.PHONY:
clean:
rm -f src/main.o
rm -f listSlices_c

3
c_impl/src/main.c Normal file
View file

@ -0,0 +1,3 @@
int main(int argc, char **argv) {
return 0;
}

1
link Normal file
View file

@ -0,0 +1 @@
https://programmingpraxis.com/2020/10/27/list-slices/

12
problem Normal file
View file

@ -0,0 +1,12 @@
During some recent personal programming, I needed a function to slice a list
into pieces: Given a list of sub-list lengths, and an input list to be sliced,
return a list of sub-lists of the requested lengths. For instance:, slicing the
list (1 2 2 3 3 3) into sub-lists of lengths (1 2 3) returns the list of
sub-lists ((1) (2 2) (3 3 3)). Extra list elements at the end of the input list
are ignored, missing list elements at the end of the input list are returned as
null lists.
Your task is to write a program that slices lists into sub-lists according to a
specification of sub-list lengths. When you are finished, you are welcome to
read or run a suggested solution, or to post your own solution or discuss the
exercise in the comments below.