add mega iter, fix division
This commit is contained in:
parent
2bbeaebd7c
commit
a8a2616a41
2 changed files with 20 additions and 13 deletions
19
spl/std.spl
19
spl/std.spl
|
@ -103,6 +103,9 @@ construct _mega-ext {
|
|||
_str_radix { str | with radix this ;
|
||||
this radix mega-to-str-radix
|
||||
}
|
||||
iter { MegaIter | with this ;
|
||||
this MegaIter:new
|
||||
}
|
||||
} include _mega-ext in mega
|
||||
|
||||
construct _array-ext {
|
||||
|
@ -498,6 +501,22 @@ construct 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 { }
|
||||
|
||||
func aadd { array | with arr1 arr2 ;
|
||||
|
|
14
src/lexer.rs
14
src/lexer.rs
|
@ -121,7 +121,7 @@ fn read_block_dyn(
|
|||
run_as_base: false,
|
||||
}))))
|
||||
}
|
||||
// ., lambda
|
||||
// <| .. > lambda
|
||||
"|" => {
|
||||
let block = read_block_dyn(&str_words[i + 1..], false, ">".to_owned(), compat)?;
|
||||
i += block.2;
|
||||
|
@ -134,18 +134,6 @@ fn read_block_dyn(
|
|||
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] == "!{" => {
|
||||
words.push(Word::Const(Value::Str(x[2..].to_owned())));
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue