Re: [Chicken-users] Syntax of case expressions

2008-04-17 Thread Harri Haataja
On 03/03/2008, Alaric Snell-Pym <[EMAIL PROTECTED]> wrote: > On 3 Mar 2008, at 12:33 pm, Tobia Conforto wrote: > Here is a typical Unlambda program: > `r```.H.e.l.l.o. .w.o.r.l.di Typical because it's very nearly the only one commonly seen? :) > > A shortest code programming contest,

Re: [Chicken-users] Syntax of case expressions

2008-03-03 Thread Alaric Snell-Pym
On 3 Mar 2008, at 12:33 pm, Tobia Conforto wrote: LOL at the S combinator, the most obscure invention of computer science (or was it lambda calculus?) to date. I've never fully understood it. Ah, that's easy... The idea of combinators, as I understand it, is that you can get rid of lambdas

Re: [Chicken-users] Syntax of case expressions

2008-03-03 Thread Tobia Conforto
Alaric Snell-Pym wrote: it'd be too easy: Start by (set! ...)ing a load of common globals to other things in an ever-shifting sea of misleading bindings, define a macro called + that implements the S combinator in some bizarre way, bind "quote" to a function so "'a" means something quite

Re: [Chicken-users] Syntax of case expressions

2008-03-03 Thread Alaric Snell-Pym
On 3 Mar 2008, at 12:11 am, Tobia Conforto wrote: PS: we need an Obfuscated Scheme Contest No!! Anyway, it'd be too easy: Start by (set! ...)ing a load of common globals to other things in an ever-shifting sea of misleading bindings, define a macro called + that implements the

Re: [Chicken-users] Syntax of case expressions

2008-03-02 Thread Tobia Conforto
Apologies, I think I misread the thread. Anyways: Elf wrote: how is it that ('a ...) isn't a syntax error? Is it because 'a expands to (quote a), and is thus treated by case as a list of the symbols quote and a? And if so, is that correct behavior? After all, csi> (pair? 'a) #f (as I expect

Re: [Chicken-users] Syntax of case expressions

2008-03-02 Thread Tobia Conforto
Elf wrote: (define foo 'quote) (case foo ('a 1) (else 2)) => 1 the proper behaviour in this case, btw, has not yet been given. This *is* the proper behaviour, although it could qualify for an "Obfuscated Scheme" contest. You see, case is a macro. It parses its body with its own rules.

Re: [Chicken-users] Syntax of case expressions

2008-03-02 Thread Graham Fawcett
On Sat, Mar 1, 2008 at 7:40 PM, Elf <[EMAIL PROTECTED]> wrote: > > id consider it a bug with the reader fighting with the macroexpander for > unpredictable dominance of the universe. Just to be clear, elf -- what specifically is the bug that you see here? Do you really see unpredictability, or j

Re: [Chicken-users] Syntax of case expressions

2008-03-01 Thread Elf
id consider it a bug with the reader fighting with the macroexpander for unpredictable dominance of the universe. -elf On Thu, 28 Feb 2008, Ivan Raikov wrote: Well, R5RS does not specify what happens in the second case, so you can consider it a feature :-) Matt Gushee <[EMAIL PROTECT

Re: [Chicken-users] Syntax of case expressions

2008-03-01 Thread Elf
no, actually, i get lots of errors about 'quote' being an invalid value to car in macros. to demonstrate: (define foo 'quote) (case foo ('a 1) (else 2)) => 1 the proper behaviour in this case, btw, has not yet been given. (define foo 'a) (case foo ((a) 1) (else 2)) is the

Re: [Chicken-users] Syntax of case expressions

2008-02-29 Thread Matt Gushee
Shawn W. wrote: On Feb 27, 2008, at 6:39 PM, Matt Gushee wrote: I have just written a 'string-case' macro--it is supposed to behave just like case, except that it uses string=? in place of eqv? as its equality predicate. Insert obligatory plug for my extended-cond egg, which has a version

Re: [Chicken-users] Syntax of case expressions

2008-02-28 Thread Shawn W.
On Feb 27, 2008, at 6:39 PM, Matt Gushee wrote: Hi, all-- I have just written a 'string-case' macro--it is supposed to behave just like case, except that it uses string=? in place of eqv? as its equality predicate. Insert obligatory plug for my extended-cond egg, which has a version of

Re: [Chicken-users] Syntax of case expressions

2008-02-28 Thread Peter Bex
On Wed, Feb 27, 2008 at 08:04:23PM -0700, Matt Gushee wrote: > Wait a minute, though. I understand now why > >(('a) ...) > > didn't match, but how is it that > >('a ...) > > isn't a syntax error? Is it because 'a expands to (quote a), and is thus > treated by case as a list of the symb

Re: [Chicken-users] Syntax of case expressions

2008-02-27 Thread Ivan Raikov
Well, R5RS does not specify what happens in the second case, so you can consider it a feature :-) Matt Gushee <[EMAIL PROTECTED]> writes: > > Wait a minute, though. I understand now why > > (('a) ...) > > didn't match, but how is it that > > ('a ...) > > isn't a syntax error? Is it beca

Re: [Chicken-users] Syntax of case expressions

2008-02-27 Thread Matt Gushee
Matt Gushee wrote: isn't a syntax error? Is it because 'a expands to (quote a), and is thus treated by case as a list of the symbols quote and a? And if so, is that correct behavior? After all, csi> (pair? 'a) #f (as I expected). [with apologies for replying to myself] Oh, wait: csi> (pa

Re: [Chicken-users] Syntax of case expressions

2008-02-27 Thread Matt Gushee
Ivan Raikov wrote: Remember that in Scheme, (define foo 'a) is a shortcut for (define (define foo (quote a))) -- quote is a special form, and not a part of the literal. So you in your case statement you are not matching the symbol a, you are actually matching the symbol 'a (the apostrophe is

Re: [Chicken-users] Syntax of case expressions

2008-02-27 Thread Ivan Raikov
Yes. My apologies for screwing up something so simple to correct a simple mistake :-) Here is the relevant part of R5RS: Literal expressions --- - syntax: quote - syntax: ' - syntax: `(quote )' evaluates to . may be any external representation of a Scheme o

Re: [Chicken-users] Syntax of case expressions

2008-02-27 Thread Matt Gushee
Ivan Raikov wrote: Oops, I meant that (define foo 'a) -> (define foo (quote a)). No wonder I was confused. -- Matt Gushee : Bantam - lightweight file manager : matt.gushee.net/software/bantam/ : : RASCL's A Simple Configuration Language : matt.gushee.net/rascl/ : __

Re: [Chicken-users] Syntax of case expressions

2008-02-27 Thread Matt Gushee
Ivan Raikov wrote: Remember that in Scheme, (define foo 'a) is a shortcut for (define (define foo (quote a))) Well, I can't remember that because I never learned it! And I'm not sure I understand it now ... have to ponder a bit. -- quote is a special form, and not a part of the literal.

Re: [Chicken-users] Syntax of case expressions

2008-02-27 Thread Leonardo Valeri Manera
On 28/02/2008, Ivan Raikov <[EMAIL PROTECTED]> wrote: > > Oops, I meant that (define foo 'a) -> (define foo (quote a)). Right, that had my head in an "I want some of whatever he's smoking" kinda loop... Leo ___ Chicken-users mailing list Chicken-use

Re: [Chicken-users] Syntax of case expressions

2008-02-27 Thread Ivan Raikov
Oops, I meant that (define foo 'a) -> (define foo (quote a)). -Ivan Ivan Raikov <[EMAIL PROTECTED]> writes: > Remember that in Scheme, (define foo 'a) is a shortcut for > (define (define foo (quote a))) -- quote is a special form, and not > a part of the literal. So you in your case st

Re: [Chicken-users] Syntax of case expressions

2008-02-27 Thread Ivan Raikov
Remember that in Scheme, (define foo 'a) is a shortcut for (define (define foo (quote a))) -- quote is a special form, and not a part of the literal. So you in your case statement you are not matching the symbol a, you are actually matching the symbol 'a (the apostrophe is treated as a literal

[Chicken-users] Syntax of case expressions

2008-02-27 Thread Matt Gushee
Hi, all-- I have just written a 'string-case' macro--it is supposed to behave just like case, except that it uses string=? in place of eqv? as its equality predicate. But in the course of writing test cases, I have encountered a surprise: the Chicken version of case appears to be non-compliant