Skip to content

Commit a40d905

Browse files
Fix functionp handling of lambdas
closes #92
1 parent 4b5ae64 commit a40d905

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/data.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ pub(crate) fn symbolp(object: Object) -> bool {
167167
pub(crate) fn functionp(object: Object) -> bool {
168168
match object.untag() {
169169
ObjectType::ByteFn(_) | ObjectType::SubrFn(_) => true,
170-
ObjectType::Cons(cons) => cons.car() == sym::CLOSURE,
170+
ObjectType::Cons(cons) => cons.car() == sym::CLOSURE || cons.car() == sym::LAMBDA,
171171
ObjectType::Symbol(sym) => sym.has_func(),
172172
_ => false,
173173
}
@@ -519,6 +519,7 @@ unsafe impl Sync for LispError {}
519519
#[cfg(test)]
520520
mod test {
521521
use super::*;
522+
use crate::interpreter::assert_lisp;
522523

523524
#[test]
524525
fn test_ash() {
@@ -528,6 +529,11 @@ mod test {
528529
assert_eq!(ash(256, -8), 1);
529530
assert_eq!(ash(-8, 1), -16);
530531
}
532+
533+
#[test]
534+
fn test_functionp() {
535+
assert_lisp("(functionp '(lambda nil))", "t");
536+
}
531537
}
532538

533539
defsym!(MANY);

0 commit comments

Comments
 (0)