add mega iter, fix division

This commit is contained in:
Daniella / Tove 2024-10-23 13:50:04 +02:00
parent 2bbeaebd7c
commit a8a2616a41
Signed by: TudbuT
GPG key ID: B3CF345217F202D3
2 changed files with 20 additions and 13 deletions

View file

@ -103,6 +103,9 @@ construct _mega-ext {
_str_radix { str | with radix this ; _str_radix { str | with radix this ;
this radix mega-to-str-radix this radix mega-to-str-radix
} }
iter { MegaIter | with this ;
this MegaIter:new
}
} include _mega-ext in mega } include _mega-ext in mega
construct _array-ext { construct _array-ext {
@ -498,6 +501,22 @@ construct RangeIter {
include _Iter in RangeIter include _Iter in RangeIter
construct MegaIter {
i d
;
construct { this | with d this ;
d this:=d
0 this:=i
this
}
next { i | with this ;
this:i dup ++ this:=i
dup this:d lt not if { pop null }
}
}
include _Iter in MegaIter
construct shadow { } construct shadow { }
func aadd { array | with arr1 arr2 ; func aadd { array | with arr1 arr2 ;

View file

@ -121,7 +121,7 @@ fn read_block_dyn(
run_as_base: false, run_as_base: false,
})))) }))))
} }
// ., lambda // <| .. > lambda
"|" => { "|" => {
let block = read_block_dyn(&str_words[i + 1..], false, ">".to_owned(), compat)?; let block = read_block_dyn(&str_words[i + 1..], false, ">".to_owned(), compat)?;
i += block.2; i += block.2;
@ -134,18 +134,6 @@ fn read_block_dyn(
run_as_base: false, run_as_base: false,
})))) }))))
} }
"/" => {
let block = read_block_dyn(&str_words[i + 1..], false, "\\".to_owned(), compat)?;
i += block.2 + 1;
words.push(Word::Const(Value::Func(AFunc::new(Func {
ret_count: 0,
to_call: FuncImpl::SPL(block.1),
origin: Arc::new(Frame::dummy()),
fname: None,
name: "dyn-direct".to_owned(),
run_as_base: false,
}))))
}
x if x.len() >= 2 && &x[0..2] == "!{" => { x if x.len() >= 2 && &x[0..2] == "!{" => {
words.push(Word::Const(Value::Str(x[2..].to_owned()))); words.push(Word::Const(Value::Str(x[2..].to_owned())));
} }