mbudde


Joined 2 years ago
Homeworks submitted:
Homework comments:
3
2

About Me

No description provided.

Classes

MIT OpenCourseWare 6.00 Introduction to Computer Science and Programming

Class status: Established
Role: Student
. 0% complete

Learning Vim from the inside

Class status: Established
Role: Student
. 11% complete

Structure and Interpretation of Computer Programs

Class status: Established
Role: Student
. 7% complete

Submitted Assignments

Learning Vim from the inside: Lesson 3, HW 3

If you get the following error when trying to make tags:
rm -f tags
*.c *.cpp if_perl.xs *.h
/bin/sh: arabic.c: not found
make: *** [tags] Error 127
then it is because you haven't run ./configure

  • To open the file move the cursor to the filename and press gf (goto file).

  • ex_docmd.c:do_one_cmd parses command line and figures out which command to run.

  • ex_docmd.c:replace_makeprg inserts makeprg in command line
  • quickfix.c:ex_make runs make command with do_shell

  • ex_make flushes all buffers with autowrite_all. I'm not quite sure what that function does though.

  • eap is a pointer to a exarg struct which is defined in ex_cmds.h. It contains stuff like the command and its arguments, etc.


mbudde 2 years ago
Learning Vim from the inside: Lesson 3, HW 2

The README.txt file was the first file I read after downloading the sources. Information like this is usually found in the README file so that would be the natural place to look. I also looked for a file named HACKING or similar and found README.txt file in the src dir which is also quite interesting.


mbudde 2 years ago
Structure and Interpretation of Computer Programs: Lesson 1, HW 1

Ex 1.4

If b is positive the two arguments is added together, else they are subtracted.

Ex 1.5

Applicative-order: infinite loop when evaluating p.
Normal-order: 0, p is never evaluated.

Ex 1.6

In contrast to the special form if, all arguments to new-if will be evaluated no matter what the predicate evaluates to. Thus sqrt-iter will loop infinately.

;Ex 1.1

10 12 8 3 6 a b 19 false 4 16 6 16

;Ex 1.2.

(/ (+ 5 4 (- 2 (- 3 (+ 6 (/ 1 3))))) (* 3 (- 6 2) (- 2 7)))

;Ex 1.3

(define (sqsum-of-two-largest x y z)
        (cond ((and (> x z) (> y z)) (* (* x x) (* y y)))
              ((and (> x y) (> z y)) (* (* x x) (* z z)))
              (else (* (* y y) (* z z)))))

;Ex 1.7

(define (sqrt-iter2 new-guess old-guess x)
  (if (good-enough2? new-guess old-guess)
      new-guess
      (sqrt-iter2 (improve new-guess x)
                  new-guess
                  x)))

(define (good-enough2? new-guess old-guess)
  (< (abs (- new-guess old-guess)) 0.001))

;Ex 1.8

(define (improve-cube guess x)
  (/ (+ (/ x (square guess)) (* 2 guess)) 3))

(define (cuberoot-iter new-guess old-guess x)
  (if (good-enough2? new-guess old-guess)
      new-guess
      (cuberoot-iter (improve-cube new-guess x)
                     new-guess
                     x)))

(define (cuberoot x)
  (cuberoot-iter 1.0 2.0 x))

mbudde 2 years ago