Though much of the time, lisp implementations adds syntax as shortend, and you can also do all that with the syntax I described.
Though much of the time, lisp implementations adds syntax as shortend, and you can also do all that with the syntax I described.
(list '(1. . #\#)
-5/6+7.s-8i
`(1 ,@2)
1@1 ;hmmm, no unquote splicing comma ;-)
10# ;surprised?
(list #i+1 +1i 1+i) ;complicated or complex?
#e-1e10i ;Old MacDonald?
"(* 9 10)" #())
...how many can you guess without running the example? (I checked it with Dr. Racket under R5RS mode)1) A list of 1.0 and the pound char. 2) I'm guessing a complex number. 3) A list of 1 and an explicitly evaluated 2. 4) Hum, would it just be a symbol? 5) I am surprised. Maybe just another symbol? 6) More complex numbers. 7) Another complex number? 8) A string 9) An empty vector.
Without the complex numbers, which I admit I've never used, it's not that bad. They're just shortend, you can use list, vector, quote, unquote, unquote-splicing and quasiquote functions instead.
I think there's a function for char too, name->char I think.
The ones that are weird are 1@1 and 10#.
Anyways, there's a bit more syntax it's true, but all of that is literals. I'm not sure that counts as syntax, I guess it does. So ya, there's a little more than I said.
Maybe it's easier to say I can explain the semantics in one minute and the syntax in two minutes?
http://download.plt-scheme.org/doc/html/guide/Pairs__Lists__...
2) Yup, complex number.
3) Another improper list.
4) Imaginary number in polar coordinate notation
5) # at the end of a numbers are to express inexactness, and are equivalent to a zero digit, so that express is 100.
6) The first one in that list (#i+1) is actually just 1.0, no imaginary part. The #i notation is for inexact numbers. The other two are the complex numbers i and 1+i.
http://www.delorie.com/gnu/docs/guile/r5rs_54.html
7) Yes, an exact complex number. Interestingly enough, Dr. Racket in R5RS mode accepts that just fine, but Guile doesn't seem to like it.
8,9) Yes.
For the full syntax of scheme see:
I'm still confused about '(1. . #\#)
So it's a pair containing 1.0 and pound?
It's the 1. I find surprising. You can omit the number after the dot?
Oh, and what's improper about `(1 ,@2) ? Wouldn't it evaluate to (1 2) ?
http://www.cs.rpi.edu/academics/courses/fall00/ai/scheme/ref...