Commit 071f4fe4 authored by Jeff Smits's avatar Jeff Smits

Fixed bug in mkterm

parent 6a158e36
......@@ -63,28 +63,28 @@ pub fn mkterm<'a>(context: &MutContext<'a>,
targs[0]
.get_string()
.ok_or(Error::StrategyFailed)
.and_then(|s| {
let string = context
.factory
.application(s.clone(), ::std::iter::empty());
if string.get_string().is_some() {
Some(string)
Ok(string)
} else {
let s = truncate_at_illegal_chars(s);
targs[1]
.get_list()
.map(|l| context.factory.application(s, l.into_iter().cloned()))
from_cons_nil_list(targs[1].clone())
.map(|l| context.factory.application(s, l.into_iter()))
}
})
.or_else(|| targs[0].get_int().map(|_| targs[0].clone()))
.or_else(|| targs[0].get_long().map(|_| targs[0].clone()))
.or_else(|| targs[0].get_real().map(|_| targs[0].clone()))
.or_else(|| {
.or_else(|_| targs[0].get_int().map(|_| targs[0].clone()).ok_or(Error::StrategyFailed))
.or_else(|_| targs[0].get_long().map(|_| targs[0].clone()).ok_or(Error::StrategyFailed))
.or_else(|_| targs[0].get_real().map(|_| targs[0].clone()).ok_or(Error::StrategyFailed))
.or_else(|_| {
targs[0]
.get_list()
.and_then(|_| targs[1].get_list().map(|_| targs[1].clone()))
.ok_or(Error::StrategyFailed)
})
.ok_or(Error::StrategyFailed)
}
pub fn get_arguments<'a>(context: &MutContext<'a>,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment