Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Atoms vs. Symbols

2 views
Skip to first unread message

Curtis Cartmill

unread,
Jan 28, 1998, 3:00:00 AM1/28/98
to

Caroline Kierstead (ctki...@undergrad.math.uwaterloo.ca) wrote:

: Strangely enough, atom? doesn't seem to be a defined part of the
: standard. I just defined my own version and used that.

That's funny. Well I was a TA for the cs241 class last term, and they used
a vesion of scheme which is invoked at the command line "scm" or "scm -p1" and
I can't seem to be able to find it on neumann, cayley or descartes. And the
"scm" version of scheme implements an atom? operator. Well I guess I will just
stick with (symbol? )

curtis

--


''~``
( o o )
+---------------------.oooO--(_)--Oooo.----------------------+
| Curtis Cartmill |
| University of Waterloo Graduate Student (MMath) |
| Department of Computer Science |
| curtis....@uwaterloo.ca |
| .oooO |
| ( ) Oooo. |
+--------------------------\ (----( )----------------------+
\_) ) /
(_/


Caroline Kierstead

unread,
Jan 28, 1998, 3:00:00 AM1/28/98
to

In article <EnI5H...@undergrad.math.uwaterloo.ca>,
Curtis Cartmill <ccca...@neumann.uwaterloo.ca> wrote:
>I was wondering if anyone could explain why scheme was spitting out the
>error message to my queries below. I know that (atom? expression)
>should return #t if the expression is one of (nil, number, string, symbol)
>and returns () otherwise, but why didn't it work? And why
>(symbol? expression) did work!

Gordon V. Cormack

unread,
Jan 28, 1998, 3:00:00 AM1/28/98
to

In article <EnI5H...@undergrad.math.uwaterloo.ca>,
Curtis Cartmill <ccca...@neumann.uwaterloo.ca> wrote:
>I was wondering if anyone could explain why scheme was spitting out the
>error message to my queries below. I know that (atom? expression)
>should return #t if the expression is one of (nil, number, string, symbol)
>and returns () otherwise, but why didn't it work? And why
>(symbol? expression) did work!
>
>Thanks,
>
>Curtis
>

atom? appears to be missing in MIT scheme.
--
Gordon V. Cormack CS Dept, University of Waterloo, Canada N2L 3G1
gvco...@uwaterloo.ca http://cormack.uwaterloo.ca/cormack

Curtis Cartmill

unread,
Jan 28, 1998, 3:00:00 AM1/28/98
to

I was wondering if anyone could explain why scheme was spitting out the
error message to my queries below. I know that (atom? expression)
should return #t if the expression is one of (nil, number, string, symbol)
and returns () otherwise, but why didn't it work? And why
(symbol? expression) did work!

Thanks,

Curtis

---SCHEME OUTPUT---

1 ]=> (atom? (car '(x y)))

;Unbound variable: atom?
;To continue, call RESTART with an option number:
; (RESTART 3) => Specify a value to use instead of atom?.
; (RESTART 2) => Define atom? to a given value.
; (RESTART 1) => Return to read-eval-print level 1.


2 error> (RESTART 1)

;Abort!

1 ]=> (symbol? (car '(x y)))

;Value: #t

1 ]=> (symbol? (car '((x y) z)))

;Value: ()

Carl Laurence Gonsalves

unread,
Jan 29, 1998, 3:00:00 AM1/29/98
to
>I was wondering if anyone could explain why scheme was spitting out the
>error message to my queries below. I know that (atom? expression)
>should return #t if the expression is one of (nil, number, string, symbol)
>and returns () otherwise, but why didn't it work? And why
>(symbol? expression) did work!

It seems "atom?" is not a standard (R4RS) function. You can roll your own
if you really need it...
--
Carl Laurence Gonsalves | "Any sufficiently advanced text editor is
clgo...@kami.com | indistinguishable from VIM."
|
http://www.undergrad.math.uwaterloo.ca/~clgonsal/

0 new messages