示例#1
0
bool SimpleString::equal(Value value) const
{
  if (!stringp(value))
    return false;
  AbstractString * s = the_string(value);
  if (this == s)
    return true;
  if (_capacity != s->length())
    return false;
  // REVIEW optimize
  for (INDEX i = 0; i < _capacity; i++)
    {
      if (_chars[i] != s->fast_char_at(i))
        return false;
    }
  return true;
}
示例#2
0
// ### character
Value CL_character(Value arg)
{
    if (characterp(arg))
        return arg;
    else if (stringp(arg))
    {
        AbstractString * s = the_string(arg);
        if (s->length() == 1)
            return make_character(s->fast_char_at(0));
    }
    else if (symbolp(arg))
    {
        SimpleString * s = the_symbol(arg)->name();
        if (s && s->length() == 1)
            return make_character(s->fast_char_at(0));
    }
    return signal_type_error(arg, S_character_designator);
}