Changeset 5924 for lang/c/misc
- Timestamp:
- 01/31/08 08:06:41 (5 years ago)
- Location:
- lang/c/misc/mlisp
- Files:
-
- 3 modified
-
readme.txt (modified) (2 diffs)
-
src/ml_builtin.c (modified) (4 diffs)
-
src/mlisp.cpp (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
lang/c/misc/mlisp/readme.txt
r5814 r5924 51 51 * todo 52 52 53 - �����Ƃ��������� �}�N�����Łu`�v�u,�v�u,@�v��������� 54 -- �u`�v�u,�v����ς� 55 - ���L�V�J���X�R�[�v�A�N���[�W�� 53 - �����Ƃ��������� ���L�V�J���X�R�[�v�A�N���[�W�� 56 54 - �K�x�R�� 57 55 - assert �Ŏ��ȂȂ��悤�� … … 63 61 - destructuring-bind 64 62 - &optional, &rest 63 64 -[v] �}�N�����Łu`�v�u,�v�u,@�v��������� 65 -- �u`�v�u,�v����ς� 66 -- �u,@�v����ς� 65 67 66 68 -
lang/c/misc/mlisp/src/ml_builtin.c
r5814 r5924 40 40 } 41 41 42 42 /// �o�b�N�N�H�[�g�̏��� 43 43 static SExp b_quasiquote_sub(MLContext* ml, SExp a) 44 44 { … … 46 46 return a; 47 47 } else { 48 SExp unq = ml_make_symbol(ml, "unquote", NULL); 49 SExp ca = ml_car(ml, a); 50 if (ca == unq) { 51 return ml_eval(ml, ml_car(ml, ml_cdr(ml, a))); 52 } else { 53 SExp ls; 54 SExp top = cNil, tail = cNil; 55 for (ls = a; ls != cNil; ls = ml_cdr(ml, ls)) { 56 SExp b = b_quasiquote_sub(ml, ml_car(ml, ls)); 48 SExp ls; 49 SExp top = cNil, tail = cNil; 50 for (ls = a; ls != cNil; ls = ml_cdr(ml, ls)) { 51 SExp ca = ml_car(ml, ls); 52 SExp b; 53 if (SEXP_CONSP(ca)) { 54 SExp unq = ml_make_symbol(ml, "unquote", NULL); 55 SExp unqa = ml_make_symbol(ml, "unquote-splicing", NULL); 56 SExp caa = ml_car(ml, ca); 57 if (caa == unq) { 58 b = ml_eval(ml, ml_car(ml, ml_cdr(ml, ca))); 59 } else if (caa == unqa) { 60 b = ml_eval(ml, ml_car(ml, ml_cdr(ml, ca))); 61 ml_rplacd(ml, tail, b); 62 if (SEXP_IS_ATOM(b)) { 63 break; 64 } else { 65 SExp cd; 66 for (tail = b; (cd = ml_cdr(ml, tail)) != cNil; tail = cd); 67 continue; 68 } 69 } else { 70 b = b_quasiquote_sub(ml, ml_car(ml, ls)); 71 } 72 } else { 73 b = b_quasiquote_sub(ml, ml_car(ml, ls)); 74 } 75 76 { 57 77 SExp cd = ml_cons(ml, b, cNil); 58 78 if (top == cNil) { … … 63 83 tail = cd; 64 84 } 65 return top;66 }85 } 86 return top; 67 87 } 68 88 } … … 72 92 { 73 93 SExp ca = ml_car(ml, a); 74 // �T�u�c���[��ǂ�āA unquote �ȊO��ote ��75 94 return b_quasiquote_sub(ml, ca); 76 95 } -
lang/c/misc/mlisp/src/mlisp.cpp
r5814 r5924 608 608 { 609 609 SExp a = read_list(fp); 610 610 611 611 // close paren 612 612 int c = fgetc(fp); … … 615 615 syntax_error(ERR_NO_CLOSE_PAREN); 616 616 } 617 617 618 618 return a; 619 619 } … … 630 630 case ',': 631 631 { 632 SExp fn; 633 c = fgetc(fp); 634 if (c != '@') { 635 ungetc(c, fp); 636 fn = make_symbol("unquote", NULL); 637 } else { 638 fn = make_symbol("unquote-splicing", NULL); 639 } 632 640 SExp a = read_rec(fp); 633 return cons( make_symbol("unquote", NULL), cons(a, cNil));641 return cons(fn, cons(a, cNil)); 634 642 } 635 643 case '"':
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)