Re: [Chicken-users] how to unintern a symbol
On Mon, Feb 02, 2015 at 11:34:05AM -0800, Dan Leslie wrote: Is that a function composition function I spy? I wasn't aware of such a thing in R5RS or R7RS, is it a chicken extension or a part of one of the Unity libraries? It's a CHICKEN extension :) There's also compose for when the functions accept/return more than one value (o is a more efficient version for single arg). Cheers, Peter signature.asc Description: Digital signature ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] how to unintern a symbol
Peter Bex scripsit: I wasn't aware of that CL behaviour. IIUC that's actually conflating two different things: creating an uninterned symbol and unbinding an interned symbol. I don't know of a way to unbind a variable through Scheme, but you can set the symbol's value slot (0) to C_SCHEME_UNBOUND in C. This has to go with the warnings Don't try this at home, and this voids your warranty. :) Actually, neither of those things is what CL `unintern` does, though I can see how people might come to believe that. What it does is to remove an existing symbol from the symbol table. The symbol maintains its properties, including its value, but any future attempt to refer to a symbol of the same name will create an entirely new object, since lookup in the symbol table will fail (and of course this new symbol is undefined). To put things another way, `unintern` mutates its argument from interned to uninterned. It's a dangerous thing to do, because it corrupts Scheme/Lisp read-write equivalence. -- John Cowan http://www.ccil.org/~cowanco...@ccil.org If I have seen farther than others, it is because I am surrounded by dwarves. --Murray Gell-Mann ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] how to unintern a symbol
On Mon, Feb 02, 2015 at 10:51:26AM -0700, Alexej Magura wrote: Does Chicken have anything comparable to Common Lisp's /unintern/? I thought that it might be under /##sys/, since other features present in Common Lisp, but absent in Chicken are available under that namespace, but it doesn't seem to be provided by that module/namespace. There's string-uninterned-symbol, which is even documented, right below gensym: http://wiki.call-cc.org/man/4/Unit%20library#string-uninterned-symbol If you have a symbol you want to unintern, you can get its string and create an uninterned symbol from that: (define unintern (o string-uninterned-symbol symbol-string)) (eq? (unintern 'foo) 'foo) = #f Cheers, Peter signature.asc Description: Digital signature ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] how to unintern a symbol
AFAICT that just defines a symbol to itself, and only then if you run: (define foo 1) (define foo (unintern 'foo)) (eq? foo |foo|) = #t But, as I said, that only defines 'foo as |foo|: it doesn't /undefine/ the symbol, and it needs to have side-effects, since the CL /unintern/ AFAIK effects the targeted package, or in our case module. After uninterning /foo/, if I were to enter foo into the REPL to be evaluated, it would throw an unbound variable exception. On 02/02/2015 11:31 AM, Peter Bex wrote: On Mon, Feb 02, 2015 at 10:51:26AM -0700, Alexej Magura wrote: Does Chicken have anything comparable to Common Lisp's /unintern/? I thought that it might be under /##sys/, since other features present in Common Lisp, but absent in Chicken are available under that namespace, but it doesn't seem to be provided by that module/namespace. There's string-uninterned-symbol, which is even documented, right below gensym: http://wiki.call-cc.org/man/4/Unit%20library#string-uninterned-symbol If you have a symbol you want to unintern, you can get its string and create an uninterned symbol from that: (define unintern (o string-uninterned-symbol symbol-string)) (eq? (unintern 'foo) 'foo) = #f Cheers, Peter ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
[Chicken-users] how to unintern a symbol
Does Chicken have anything comparable to Common Lisp's /unintern/? I thought that it might be under /##sys/, since other features present in Common Lisp, but absent in Chicken are available under that namespace, but it doesn't seem to be provided by that module/namespace. ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] how to unintern a symbol
On Mon, Feb 02, 2015 at 11:55:12AM -0700, Alexej Magura wrote: AFAICT that just defines a symbol to itself, and only then if you run: (define foo 1) (define foo (unintern 'foo)) (eq? foo |foo|) = #t But, as I said, that only defines 'foo as |foo|: it doesn't /undefine/ the symbol, and it needs to have side-effects, since the CL /unintern/ AFAIK effects the targeted package, or in our case module. After uninterning /foo/, if I were to enter foo into the REPL to be evaluated, it would throw an unbound variable exception. I wasn't aware of that CL behaviour. IIUC that's actually conflating two different things: creating an uninterned symbol and unbinding an interned symbol. I don't know of a way to unbind a variable through Scheme, but you can set the symbol's value slot (0) to C_SCHEME_UNBOUND in C. This has to go with the warnings Don't try this at home, and this voids your warranty. :) Cheers, Peter signature.asc Description: Digital signature ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users
Re: [Chicken-users] how to unintern a symbol
Is that a function composition function I spy? I wasn't aware of such a thing in R5RS or R7RS, is it a chicken extension or a part of one of the Unity libraries? Thanks! -Dan Peter Bex pe...@more-magic.net writes: On Mon, Feb 02, 2015 at 10:51:26AM -0700, Alexej Magura wrote: Does Chicken have anything comparable to Common Lisp's /unintern/? I thought that it might be under /##sys/, since other features present in Common Lisp, but absent in Chicken are available under that namespace, but it doesn't seem to be provided by that module/namespace. There's string-uninterned-symbol, which is even documented, right below gensym: http://wiki.call-cc.org/man/4/Unit%20library#string-uninterned-symbol If you have a symbol you want to unintern, you can get its string and create an uninterned symbol from that: (define unintern (o string-uninterned-symbol symbol-string)) (eq? (unintern 'foo) 'foo) = #f Cheers, Peter ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users -- -Dan Leslie ___ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users