Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: jfo/sild
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: master
Choose a base ref
...
head repository: jfo/sild
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: display-pipe
Choose a head ref
Able to merge. These branches can be automatically merged.
  • 1 commit
  • 3 files changed
  • 1 contributor

Commits on May 17, 2016

  1. display pipe prototype

    jfo committed May 17, 2016
    Copy the full SHA
    7091e6e View commit details
Showing with 14 additions and 11 deletions.
  1. +3 −9 examples/lambda-carcdr.sld
  2. +1 −2 src/builtins.c
  3. +10 −0 src/read.c
12 changes: 3 additions & 9 deletions examples/lambda-carcdr.sld
Original file line number Diff line number Diff line change
@@ -7,12 +7,6 @@
(define cdrr (lambda (x)
(x (lambda (a d) d))))

(display
(conss '(1) '(2))
)
(display
(carr (conss '(1) '(2)))
)
(display
(cdrr (conss '(1) '(2)))
)
(conss '(1) '(2))
|(carr (conss '(1) '(2)))
|(cdrr (conss '(1) '(2)))
3 changes: 1 addition & 2 deletions src/builtins.c
Original file line number Diff line number Diff line change
@@ -179,8 +179,7 @@ C *display(C *operand, Env *env) {
arity_check("display", 1, operand);
C *evalled = eval(operand, env);
print(evalled);
free_cell(evalled);
return &nil;
return evalled;
}

C *lambda(C *operand, Env *env) {
10 changes: 10 additions & 0 deletions src/read.c
Original file line number Diff line number Diff line change
@@ -47,6 +47,14 @@ static void verify(char c, int depth) {

static C * read_inner(FILE *s, int depth);

static C *display_next(FILE *s, int depth) {
C *quotecell = makecell(BUILTIN, (V){ .func = { scpy("display"), display } }, read(s));
return makecell(
LIST, (V)
{ .list = quotecell },
(depth > 0 ? read_inner(s,depth) : &nil));
};

static C *quote_next(FILE *s, int depth) {
C *quotecell = makecell(BUILTIN, (V){ .func = { scpy("quote"), quote } }, read(s));
return makecell(
@@ -117,6 +125,8 @@ static C * read_inner(FILE *s, int depth) {
return read_inner(s, depth);
case '\'':
return quote_next(s, depth);
case '|':
return display_next(s, depth);
case '(':
return makecell(
LIST,