Changeset 12094 for lang/c

Show
Ignore:
Timestamp:
05/21/08 08:35:30 (5 years ago)
Author:
mokehehe
Message:

Add builtin (symbol?, number?)

Location:
lang/c/misc/mlisp
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • lang/c/misc/mlisp/core/m_basic.cpp

    r12093 r12094  
    5151        rplacd(a, d); 
    5252        return nil; 
     53} 
     54 
     55static SExp builtin_symbolp() { 
     56        SExp a = get_arg(0); 
     57        return symbolp(a) ? t : nil; 
     58} 
     59 
     60static SExp builtin_numberp() { 
     61        SExp a = get_arg(0); 
     62        return numberp(a) ? t : nil; 
    5363} 
    5464 
     
    291301                {       "set-car!",     builtin_rplaca,         2,      2,      }, 
    292302                {       "set-cdr!",     builtin_rplacd,         2,      2,      }, 
     303 
     304                {       "symbol?",      builtin_symbolp,        1,      1,      }, 
     305                {       "number?",      builtin_numberp,        1,      1,      }, 
     306 
    293307                {       "list",         builtin_list,           0,      -1,     }, 
    294308                {       "append",       builtin_append,         0,      -1,     }, 
  • lang/c/misc/mlisp/core/s_util.h

    r11676 r12094  
    5858__inline int consp(SExp s)              { return type_of(s) == tCell; } 
    5959__inline int symbolp(SExp s)    { return type_of(s) == tSymb; } 
     60__inline int numberp(SExp s)    { return type_of(s) == tInt; } 
    6061__inline int zerop(SExp s)              { return eq(s, int2s(0)); } 
    6162__inline SExp cadr(SExp s)              { return car(cdr(s)); } 
  • lang/c/misc/mlisp/readme.txt

    r12093 r12094  
    5252- ��s���ɕϐ�������������Ƃ��̎����� 
    5353- �������� 
     54- �}�N�����g�����Ƃ��́A���R�ϐ���t!�̎g�p�̃`�F�b�N 
     55 
    5456 
    5557- �R���p�C�����̃V���^�b�N�X�G���[