Skip to content

Commit 0f8ea6a

Browse files
author
梶塚太智
committed
Update main.rs
1 parent 2432432 commit 0f8ea6a

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

src/main.rs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -766,12 +766,8 @@ impl Executor {
766766

767767
// リストの長さ
768768
"len" => {
769-
let data = self.pop_stack();
770-
self.stack.push(Type::Number(match data {
771-
Type::List(l) => l.len() as f64,
772-
Type::String(s) => s.chars().count() as f64,
773-
_ => 1f64,
774-
}));
769+
let data = self.pop_stack().get_list();
770+
self.stack.push(Type::Number(data.len() as f64));
775771
}
776772

777773
// メモリ管理コマンド

0 commit comments

Comments
 (0)