Code Select
(define (merge)(transpose (args)))
Lutz is a man of few words ...
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
Show posts Menu- bug fixes and additional syntax patterns for 'net-connect' and 'net-service'Quote from: "Lutz"
for CHANGES notes and source package see here:http://www.newlisp.org/downloads/development/">http://www.newlisp.org/downloads/development/
this is is a source-only release
No sure what you mean. In the following smaller example you can see 'outer-var' recognized:Quote from: "Lutz"
(define typeHandler:typeHandler)
(typeHandler "text"
(fn (fl val ndxs DS DSndx)
(letn((ndx (ndxs 0))(ele (fl ndx))
(attrs(set-attr (list "value" val)(ele 2 1))))
(setf (DS DSndx ndx 2 1) attrs)
DS)))
(set 'callback-list
'(("int" (fn(arg1 arg2)
(println "heellllooo from the 'int handler")
(println arg1 " " arg2)))
("text" (fn(arg1 arg2)
(println "heellllooo from the 'text handler")
(println arg1 " " arg2)))))
(define (dispatcher key params)
(apply (eval(lookup key callback-list)) params))
(dispatcher "int" '("one" "two"))
(dispatcher "text" '("three" "four")
heellllooo from the 'int handler
one two
heellllooo from the 'text handler
three four
I suspect that part of the silence is to do with the fact that topics in this forum don't appear in the RSS feed or the Active topics list.Quote from: "cormullion"
I only noticed it because I happened to look at the Dragonfly section after seeing a tweet...
(set 'funcs
(list
(list "int" (fn(arg1 arg2)(println "DO-INT - arg1: " arg1 " arg2: " arg2)))
(list "text" (fn(arg1 arg2)(println "DO-TEXT - arg1: " arg1 " arg2: " arg2)))))
(define (f key) (lookup key funcs))
((f "text") "one" "two")
funcs = {"one":func1,"two":func2} ## etc
## Called as:
funcs[task](arg1 arg2)
(set 'funcs '(("int" do-int)("text" do-text)))
(define (do-int arg1 arg2)
(println "DO-INT - arg1: " arg1 " arg2: " arg2) )
(define (do-text arg1 arg2)
(println "DO-TEXT - arg1: " arg1 " arg2: " arg2))
## Function call:
(set 'arglst '("one" "two"))
(apply (lookup "text" funcs) arglst)
## => DO-TEXT - arg1: one arg2: two
(set 'member-list (assoc key parent-list))
;; all sorts of code including possible changes to 'member-list
----
----
(setf (assoc key parent-list) member-list) ;; we had to call 'assoc a second time. Redundant?
(set 'member-list (assoc key parent-list)
'found $found)
;; all sorts of code including possible changes to 'member-list
----
----
(setf (parent-list found) member-list) ;; I'm assuming the Implicit indexing is more efficient
(letn ((found getAssocPos(key lst)) (member-list (lst found))
(when found
;; all sorts of code including possible changes to 'member-list
----
----
)
(setf (parent-list found) member-list) ;; implicit indexing
) ;; end letn