মডিউল:Wikilisp: সংশোধিত সংস্করণের মধ্যে পার্থক্য

বিষয়বস্তু বিয়োগ হয়েছে বিষয়বস্তু যোগ হয়েছে
ShahadatHossain (আলোচনা | অবদান)
"local export = {} local wikilispversion = "0.18 (February 14, 2017)" --some basic abstractions local function stype( x ) -- type of sexpr loc..." দিয়ে পাতা তৈরি
 
MdsShakil (আলোচনা | অবদান)
সম্পাদনা সারাংশ নেই
 
১ নং লাইন:
local export = {}
 
local wikilispversion = "0.1819 (FebruaryNovember 144, 20172019)"
 
--[[ some basic abstractions ]]
৭১ নং লাইন:
if (p0 ~= nil) and (((p1 == nil) or (p0 < p1)) and
((p2 == nil) or (p0 < p2))) then
-- process a comment
tok2( ls, mw.ustring.sub( t, 1, (p0 - 1) ) )
p1 = mw.ustring.find( t, '\n', (p0 + 1) )
৮০ ⟶ ৮১ নং লাইন:
end
elseif (p1 ~= nil) and ((p2 == nil) or (p1 < p2)) then
-- process a string literal starting with double-quote
p2 = p1 + 1
while true do
৯৪ ⟶ ৯৬ নং লাইন:
ls[1 + #ls] = mw.ustring.gsub(
mw.ustring.sub( t, (p1 + 1), (p2 - 1) ),
'""', '"') -- inverse operation is at write_sexpr
ls[1 + #ls] = mw.ustring.sub( t, (p2 + 1) )
return true
১০০ ⟶ ১০২ নং লাইন:
end
elseif p2 ~= nil then
-- process a string literal starting with single-quote
-- side benefit: precludes Lisp shorthand for "suppress eval"
p1 = p2
১৭২ ⟶ ১৭৫ নং লাইন:
return tostring( x )
elseif type(x) == "string" then
return mw.ustring.format('"%s"', mw.ustring.gsub( x, '"', '""' )) -- inverse operation is at tok1
elseif type(x) == "boolean" then
if x then return "true" else return "false" end
১,৩৪৯ ⟶ ১,৩৫২ নং লাইন:
{ "fn", "list" }, make_op(function (ls, env, depth)
return combine(ls[1].comb, ls[2], env, depth)
end, "apply", "true")), 2)),
["boolean?"] = wrap(unary_pred(function (x)
return stype(x) == "boolean"
১,৩৬৭ ⟶ ১,৩৭০ নং লাইন:
return math.ceil(ls[1])
end, "ceil", true)), 1)),
curry = wrap(nary_op(typed_op(
{ "fn", any_tc }, make_op(function (ls1, env, depth)
return wrap(make_op(function (ls2, env, depth)
local ls3 = { type = "list" }
for k = 2, #ls1 do ls3[k - 1] = ls1[k] end
for k = 1, #ls2 do ls3[k + #ls1 - 1] = ls2[k] end
return combine(ls1[1].comb, ls3, env, depth)
end, nil, true))
end, "curry", true)), -2)),
define = nary_op(make_op(function (ls, env, depth)
if stype(ls[1]) ~= "symbol" then