June 2018 Update

This commit is contained in:
Ingy döt Net 2018-06-22 20:57:24 +00:00
parent ba8067c3b7
commit 22f33d4004
5278 changed files with 84726 additions and 14379 deletions

View file

@ -0,0 +1,8 @@
import extensions.
program =
[
var first := (:f)(f()).
var second := [ ^ "second" ].
console printLine(first(second)).
].

View file

@ -1,17 +1,17 @@
-- in some movie script
----------------------------------------
-- Runs provided function on all elements of the provided list, returns results as new list
-- @param {list} tList
-- Runs provided function (of some object) on all elements of the provided list, returns results as new list
-- @param {list} aList
-- @param {symbol} cbFunc
-- @param {object} [cbObj=_movie]
-- @return {list}
----------------------------------------
on map (tList, cbFunc, cbObj)
on map (aList, cbFunc, cbObj)
if voidP(cbObj) then cbObj = _movie
res = []
cnt = tList.count
cnt = aList.count
repeat with i = 1 to cnt
res[i] = call(cbFunc, cbObj, tList[i])
res[i] = call(cbFunc, cbObj, aList[i])
end repeat
return res
end

View file

@ -0,0 +1,21 @@
# Project : Higher-order functions
# Date : 2018/04/03
# Author : Gal Zsolt (~ CalmoSoft ~)
# Email : <calmosoft@gmail.com>
docalcs(1,10,"squares",:square)
docalcs(1,10,"cubes",:cube)
func square(n)
return n * n
func cube(n)
return n * n * n
func docalcs(from2,upto,title,func2)
see title + " -> " + nl
for i = from2 to upto
x = call func2(i)
see x + nl
next
see nl