I was just trying to use "pop" to pop several items off the front of a list. I'm making a MIDI debugger. I've been very happy with the ease that newLISP has allowed for bit-banging this serial protocol.
My only gripe so far is that there is no equivalent to "pop" that lets me take multiple elements from a list. How about "extract" that is like "slice", but destructive like "extend"? Or some boolean flag to slice?
That, and bind wants the variables in the association list to all have names that begin with Uppercase. That is annoying. I note that the examples in the manual don't require this. Am I doing something wrong? Bind+unify is very cool, but the Title-case requirement is a boner-killer. Otherwise, a syntax like (setq '(a b c d) (some-function)) would be nice. Similarly with the let family. Or is this something where I am supposed to use macro wizardry by diving into my copy of Paul Graham's "On Lisp" and translating to newLISP?
Ted
Can you tell us more about the application problem you want to solve and give code examples?
... also it is not true that 'bind' wants variables in title-case. Title-case is only required for variables in 'unify'.
> (bind '((a 1) (b 2)))
2
> a
1
> b
2
>
regarding your '(setq '(a b c d) (some-function))' snipped, perhaps you mean this:
> (map set '(a b c) '(1 2 3))
(1 2 3)
> a
1
> b
2
> c
3
>
Yes, you are right, it is unify that wants title-case. I feel foolish now; thanks for the map-set example. That is what I wanted.
I never thought of
(map set '(a b c) '(1 2 3))
... probably because it's not allowed in other languages.
Gambit Scheme:
4> (map define '(ee ff gg) '(22 33 44))
*** ERROR IN (console)@8.6 -- Macro name can't be used as a variable: define
Don't know about Scheme, but in SBCL:
* (mapc #'set '(ee ff gg) '(22 33 44))
(EE FF GG)
* ee
22
* ff
33
* gg
44
Quote from: "rickyboy"
Don't know about Scheme, but in SBCL:
* (mapc #'set '(ee ff gg) '(22 33 44))
(EE FF GG)
* ee
22
* ff
33
* gg
44
Yes, I later realized that. My post has been corrected.