Skip to content

Commit

Permalink
pr feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
gpwclark committed Oct 3, 2024
1 parent 859e48b commit 844a9ce
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 19 deletions.
19 changes: 0 additions & 19 deletions builtins/src/string.rs
Original file line number Diff line number Diff line change
Expand Up @@ -504,24 +504,6 @@ fn char_is_whitespace(target: SloshChar) -> VMResult<bool> {
}
}

/// Usage: (char? char) -> #t/#f
///
/// Returns true if a character is whitespace, false/nil otherwise.
///
/// Section: type
///
/// Example:
/// (test::assert-true (char? \a))
/// (test::assert-false (char? 1))
/// (test::assert-false (char? "a"))
#[sl_sh_fn(fn_name = "char?")]
fn is_char(target: Value) -> VMResult<bool> {
match &target {
Value::CodePoint(_) | Value::CharCluster(_, _) | Value::CharClusterLong(_) => Ok(true),
_ => Ok(false),
}
}

pub fn add_str_builtins(env: &mut SloshVm) {
intern_str_sub(env);
intern_str_splitn(env);
Expand All @@ -532,7 +514,6 @@ pub fn add_str_builtins(env: &mut SloshVm) {
intern_char_lower(env);
intern_char_upper(env);
intern_char_is_whitespace(env);
intern_is_char(env);
add_builtin(
env,
"str-replace",
Expand Down
14 changes: 14 additions & 0 deletions lisp/core.slosh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,20 @@ Example:
%#
(def nil? (fn (v) (identical? (type v) :Nil)))

#%
Usage: (char? expression)

True if the expression is a char, false otherwise.

Section: type

Example:
(test::assert-true (char? \a))
(test::assert-false (char? 1))
(test::assert-false (char? "a"))
%#
(def char? (fn (v) (identical? (type v) :Char)))

#%
Usage: (pair? expression)

Expand Down

0 comments on commit 844a9ce

Please sign in to comment.