Compare commits
3 Commits
165438cdf3
...
062edbac3c
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
062edbac3c | ||
|
|
caf6648867 | ||
|
|
245143bd9e |
@@ -62,7 +62,7 @@ std::pair<int, std::string> HttpClient::doRequest(const std::string &method, con
|
|||||||
|
|
||||||
// and fetch the rest if not read completely
|
// and fetch the rest if not read completely
|
||||||
while (content_len > 0 && content_len > ssl_read_packet.length() - 4 - end_of_headers) {
|
while (content_len > 0 && content_len > ssl_read_packet.length() - 4 - end_of_headers) {
|
||||||
auto read_bytes = sslRecvPacket();
|
/* auto read_bytes = */ sslRecvPacket();
|
||||||
}
|
}
|
||||||
|
|
||||||
// get body
|
// get body
|
||||||
|
|||||||
@@ -1 +1,4 @@
|
|||||||
(system-cmd-fork "ml" "-c" "(print 123) (sleep 1) (print \"aaa\")")
|
; (system-cmd-fork "ml" "-c" "(print 123) (sleep 1) (print \"aaa\")")
|
||||||
|
|
||||||
|
(print (reduce (lambda (acc e) (+ acc (string (+ "<th>" e "</th>")))) "" '("h1" "h2" "h3"))
|
||||||
|
)
|
||||||
@@ -76,7 +76,7 @@
|
|||||||
|`(find-val-in-list lst name)`|Returns tail od sublist which first element is name|`>>> (find-val-in-list '(("a" ("av" "avv")) ("b" "bv") (31 32 33) (41 42 43)) "b") => "bv" >>> `|List manipulation|
|
|`(find-val-in-list lst name)`|Returns tail od sublist which first element is name|`>>> (find-val-in-list '(("a" ("av" "avv")) ("b" "bv") (31 32 33) (41 42 43)) "b") => "bv" >>> `|List manipulation|
|
||||||
|`(map ..)`|Returns list that is the result of executing lambda on its elements|`(map (lambda (x) (+ x 10)) '(1 2 3 4 5 6)) => (11 12 13 14 15 16)`|List manipulation|
|
|`(map ..)`|Returns list that is the result of executing lambda on its elements|`(map (lambda (x) (+ x 10)) '(1 2 3 4 5 6)) => (11 12 13 14 15 16)`|List manipulation|
|
||||||
|`(filter lambda list)`|Returns list with elements for which passed lambda returns true|`(filter (lambda (x) (> x 2)) '(1 2 3 4 5)) => (3 4 5)`|List manipulation|
|
|`(filter lambda list)`|Returns list with elements for which passed lambda returns true|`(filter (lambda (x) (> x 2)) '(1 2 3 4 5)) => (3 4 5)`|List manipulation|
|
||||||
|`(reduce lambda acumulator list)`|Reduces list|`>>> (reduce (lambda (x y) (+ (* x 10) y)) 0 '(1 2 3 4)) => 1234`|List manipulation|
|
|`(reduce lambda acumulator list)`|Reduces list|`>>> (reduce (lambda (acc e) (+ (* acc 10) e)) 0 '(1 2 3 4)) => 1234`|List manipulation|
|
||||||
|`(exit code)`|Exit the program with an integer code||System|
|
|`(exit code)`|Exit the program with an integer code||System|
|
||||||
|`(quit code)`|Same as (exit ..)||System|
|
|`(quit code)`|Same as (exit ..)||System|
|
||||||
|`(print ..)`|Print one or several values separated by space and return the last one|`>>> (print "pi" "is" 3.14)\npi is 3.140000 => 3.140000`|IO|
|
|`(print ..)`|Print one or several values separated by space and return the last one|`>>> (print "pi" "is" 3.14)\npi is 3.140000 => 3.140000`|IO|
|
||||||
|
|||||||
31
docker/Dockerfile
Normal file
31
docker/Dockerfile
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
# docker build -t ml:latest .
|
||||||
|
# docker run --rm -it ml ml -v
|
||||||
|
# docker run --rm -it --entrypoint sh ml
|
||||||
|
|
||||||
|
|
||||||
|
FROM alpine:3.15.4 AS builder
|
||||||
|
|
||||||
|
# Install all dependencies required for compiling ml
|
||||||
|
RUN apk add --verbose build-base musl-dev openssl-dev make git cmake
|
||||||
|
|
||||||
|
RUN git clone http://gitea.stocksriddle.one/vaclavt/mlisp.git
|
||||||
|
|
||||||
|
# Compile
|
||||||
|
RUN cd /mlisp \
|
||||||
|
&& rm -f CMakeCache.txt \
|
||||||
|
&& cmake -DCMAKE_BUILD_TYPE=Release . \
|
||||||
|
&& cmake --build ./ --target clean -j 4 -- \
|
||||||
|
&& cmake --build ./ --target all -j 4 --
|
||||||
|
|
||||||
|
|
||||||
|
# Create image and copy compiled installation into it
|
||||||
|
FROM alpine:3.15.4
|
||||||
|
|
||||||
|
RUN apk add openssl libstdc++
|
||||||
|
|
||||||
|
CMD mkdir -p /usr/local/var/mlisp/
|
||||||
|
COPY --from=builder /mlisp/stdlib/*.lsp /usr/local/var/mlisp/
|
||||||
|
COPY --from=builder /mlisp/doc/*.md /usr/local/var/mlisp/
|
||||||
|
|
||||||
|
CMD mkdir -p /usr/local/bin/
|
||||||
|
COPY --from=builder /mlisp/ml /usr/local/bin/
|
||||||
@@ -79,7 +79,7 @@ void MlPerfMon::restore_callstack_position(size_t to_position) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void MlPerfMon::clear_callstack() {
|
void MlPerfMon::clear_callstack() {
|
||||||
bool e = call_stack.empty();
|
call_stack.empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
void MlPerfMon::print_results() const {
|
void MlPerfMon::print_results() const {
|
||||||
|
|||||||
@@ -47,6 +47,8 @@
|
|||||||
(ut::define-test "result of (member '(1 2 3) 3)" '(ut::assert-true (member '(1 2 3) 3)))
|
(ut::define-test "result of (member '(1 2 3) 3)" '(ut::assert-true (member '(1 2 3) 3)))
|
||||||
(ut::define-test "result of (member '(1 2 3) 4)" '(ut::assert-false (member '(1 2 3) 4)))
|
(ut::define-test "result of (member '(1 2 3) 4)" '(ut::assert-false (member '(1 2 3) 4)))
|
||||||
|
|
||||||
|
(ut::define-test "result of (reduce (lambda (acc e) (+ acc (string (+ \"<th>\" e \"</th>\")))) \"\" '(\"h1\" \"h2\" \"h3\"))" '(ut::assert-equal "<th>h1</th><th>h2</th><th>h3</th>" (reduce (lambda (acc e) (+ acc (string (+ "<th>" e "</th>")))) "" '("h1" "h2" "h3"))))
|
||||||
|
|
||||||
(ut::define-test "result of (take '(1 2 3 4) 3)" '(ut::assert-equal '(1 2 3) (take '(1 2 3 4) 3)))
|
(ut::define-test "result of (take '(1 2 3 4) 3)" '(ut::assert-equal '(1 2 3) (take '(1 2 3 4) 3)))
|
||||||
|
|
||||||
(ut::define-test "result of (make-list 3)" '(ut::assert-equal '(nil nil nil) (make-list 3)))
|
(ut::define-test "result of (make-list 3)" '(ut::assert-equal '(nil nil nil) (make-list 3)))
|
||||||
|
|||||||
Reference in New Issue
Block a user