Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

((let ((a 1)) (lambda () a)))

Name: Anonymous 2013-08-27 21:22

((let ((a 1)) (lambda () a)))
gives a is undefined
although (let ((a 1)) a) gives 1
what am I doing wrong?

 else if (parseqs(y.list[0],"let")){//fun stuff! you eval each name-expression pair in order, and later expressions might depend on earlier vars
           struct parsable s = y.list[1];
           cout << "let1\n";
           if (s.type != 1){
                 cout << "let: expected list of names and expressions, but got type " << s.type << "\n";
                 exit (EXIT_FAILURE);     
           }
           cout << "let2\n";
           struct Environment * e2 = createEnvironment(e,std::vector<std::string>(),std::vector<struct something>());
           cout << "let3\n";
              int i;
              int size = s.list.size();
              cout << "let4\n";
              for (i=0;i<size;i++){
                  cout << "let5\n";
                  struct parsable s2 = s.list[i];
                  if (s2.type != 1){
                     cout << "let: expected pair of name and expression, but got type " << s2.type << "\n";
                     exit (EXIT_FAILURE);
                  }
                  if (s2.list[0].type==0){
                     e2->env[s2.list[0].string] = eval(s2.list[1],e2);   //like I said, it can depend on other vars in the list
                  } else {
                         cout << "let: expected valid var name but got type " << s2.list[0].type << "\n";
                         exit (EXIT_FAILURE); 
                  }
              }
              cout << "let6\n";
              return eval(y.list[2],e2);          
       }

Name: Anonymous 2013-08-27 21:36

that's not how you make a parser

Name: Anonymous 2013-08-27 22:07

nvm fixed it
>>2
that's not the parser, it's the evaler

Name: Anonymous 2013-08-27 22:26

>>1
That's a good lexical scope test. If it depends on dynamic scope it will break.

Name: niggertron420xD 2013-08-28 1:30

I found the best test for lexical scope is a simple counter:

(define (make-counter n)
  (lambda ()
    (set! n (+ n 1))
    n))

Provided you have assignment.

Name: Anonymous 2013-08-28 1:31

>>5
that's fucking shit.

Name: Anonymous 2013-08-28 1:42

>>6
u hurt my feelings ;_;

Name: Anonymous 2013-08-28 2:03

>>1
Is an Environment a list/stack of maps?

Name: Anonymous 2013-08-28 2:10

>>7
I am sorry. Forgive my knee jerk hatred for your dependence on mutable state. If you were supporting modification of variables from higher scopes, then that is a good test.

Name: Anonymous 2013-08-28 7:49

>>9
ONE WORD: THE FORCED IMMUTABILITY OF DATA. STACK OVERFLOW.

Name: Anonymous 2013-08-28 12:10

>>10
idiot.

Name: Anonymous 2013-09-01 16:52


The modern study of set theory was initiated by Georg Cantor and Richard Dedekind in the 1870s. After the discovery of paradoxes in naive set theory, numerous axiom systems were proposed in the early twentieth century, of which the Zermelo–Fraenkel axioms, with the axiom of choice, are the best-known.

Name: Anonymous 2013-09-01 19:08


Cantorian set theory eventually became widespread, due to the utility of Cantorian concepts, such as one-to-one correspondence among sets, his proof that there are more real numbers than integers, and the "infinity of infinities" ("Cantor's paradise") resulting from the power set operation. This utility of set theory led to the article "Mengenlehre" contributed in 1898 by Arthur Schoenflies to Klein's encyclopedia.

Don't change these.
Name: Email:
Entire Thread Thread List