Die Suche ergab 111 Treffer

von Kineese
20. Jul 2013 18:57
Forum: Archiv
Thema: Sample Exam 2011
Antworten: 15
Zugriffe: 6914

Re: Sample Exam 2011

Task 8.1 That's not CPS, but a nice demonstration of tail recursion ;) The signature expects a continuation as the last argument: import scala.annotation.tailrec @tailrec def cpsRemove[A](item: A, l: List[A], k: (List[A]) => List[A]): List[A] = l match { case Nil => k(Nil) case x :: xs if x == item...
von Kineese
20. Jul 2013 18:19
Forum: Archiv
Thema: Sample Exam 2011
Antworten: 15
Zugriffe: 6914

Re: Sample Exam 2011

3. I should have written "evaluated". As you said correctly, only the first (2nd pattern) and second element (3rd pattern) is evaluated. "magic [-1, 2, 42 `div` 0]" would fail. There is a more verbose example in the slides for lazy evaluation. How would the call "magic [-1, 2, 42 `div` 0]" fail? On...
von Kineese
20. Jul 2013 16:06
Forum: Archiv
Thema: Sample Exam 2011
Antworten: 15
Zugriffe: 6914

Re: Sample Exam 2011

Thx for your bonus questions :D 1. Immediate Substitution handles static scope quite nicely. For example, we didn't need function closures for first class functions. However, there was one concept that is impossible with immediate substitution. Which is it? Recursion?! 2. These are the current conte...
von Kineese
20. Jul 2013 10:53
Forum: Archiv
Thema: Sample Exam 2011
Antworten: 15
Zugriffe: 6914

Re: Sample Exam 2011

Task 6.3 The result is 4. The last openbox(x) equals to 2. The fact that the change is visible is the main feature of a box, otherwise Set(x) could have been used. Here's what the environment and store look like after the first line: Env Store --- ----- x -> 2 1 -> NumV(1) 2 -> Box(1) And after lin...
von Kineese
20. Jul 2013 10:41
Forum: Archiv
Thema: Sample Exam 2011
Antworten: 15
Zugriffe: 6914

Re: Sample Exam 2011

Hi, thanks for your submission. Task 2.1 a): Can you give a hint on how to solve such tasks? I never understand a function's intent just by looking at it... :| Well I guess you just have to look at the keywords^^ In the Sample Exam, the Language Scheme doesn't give any hints about types in the funct...
von Kineese
19. Jul 2013 19:46
Forum: Archiv
Thema: Sample Exam 2011
Antworten: 15
Zugriffe: 6914

Sample Exam 2011

The sample exam can be found in public respository . I tried to solve the tasks to check my skills in COPL. My solutions are truly not correct but I hope that someone else got other (better) solutions. Just post them, I try to update this post to correct answers. Task 1.1 Interpreter: Takes the inte...
von Kineese
19. Jul 2013 16:43
Forum: Archiv
Thema: Dynamic/Lexical Scoping with Substitution
Antworten: 4
Zugriffe: 816

Re: Dynamic/Lexical Scoping with Substitution

Okay thanks for the answer!
von Kineese
19. Jul 2013 16:42
Forum: Archiv
Thema: Types of Recursion
Antworten: 4
Zugriffe: 845

Re: Types of Recursion

Hi, we asked the tutor today and agreed that the other two are: -using state of the interpreted language (boxes) -using state of the interpreting language (var) Thanks for the response! Is this mentioned somewhere in the slides or can you give a rough description how the recursion should looks like...
von Kineese
19. Jul 2013 16:38
Forum: Archiv
Thema: Call-by-...
Antworten: 0
Zugriffe: 395

Call-by-...

Hi there again! More questions I'm asking, I'm thinking more that my knowledge about COPL is bad as hell :P This time it is about the types of call-by-<Value|Name|Need>. I guess the topic of call-by-... comes up with the evaluation of expressions. As Wiki says Call-by-Name has the effect that functi...
von Kineese
19. Jul 2013 16:21
Forum: Archiv
Thema: Dynamic/Lexical Scoping with Substitution
Antworten: 4
Zugriffe: 816

Re: Dynamic/Lexical Scoping with Substitution

Seldon hat geschrieben:Yes, your reasoning is right (cf. lecture 2, slides 36 and 77 et seqq.).
Thanks for you answer.. but I guess you mean my first Question ( Immediate Subst. --> Static Scoping)
Can you agree with my 2nd answer? (Deffered Subst. and dynamic scope switch to static --> Closure)
von Kineese
19. Jul 2013 15:59
Forum: Archiv
Thema: Scope vs Extent
Antworten: 1
Zugriffe: 622

Scope vs Extent

In the slides V4, slide number 90 to 91 the topic is about Scope vs Extent, At least I guess it's about the Environment-State, so the slides say that the identifier, that binds a value may not be available in the running code, but there can be an other identifier that points to the value. So to resu...
von Kineese
19. Jul 2013 15:49
Forum: Archiv
Thema: Types of Recursion
Antworten: 4
Zugriffe: 845

Types of Recursion

In the sample-exam of the lecture SS11 (find it here ) on page 3 Ex. 3.1 there is a question about 4 different kinds of recursion-implementation. Well at the moment I just figured out two types: Usage the base languages recursion pattern --> Meta Interpreter Usage of FixPoints Heres the first type: ...
von Kineese
19. Jul 2013 15:27
Forum: Archiv
Thema: Dynamic/Lexical Scoping with Substitution
Antworten: 4
Zugriffe: 816

Dynamic/Lexical Scoping with Substitution

Hi there, in the todays practice I thought I mentioned out that immediate substitution always uses static scoping, because each substitution traverses the whole Sub-AST (that is what I noticed). But on an other page of my notes I have written that immediate substitution never uses static scoping. My...
von Kineese
2. Mai 2013 15:34
Forum: Archiv
Thema: Einmal nicht da gewesen und schon komplett aus dem Bild
Antworten: 9
Zugriffe: 972

Re: Einmal nicht da gewesen und schon komplett aus dem Bild

Finde es auch nicht gerade hilfreich, dass man sich innerhalb so eines match blocks keinerlei Ausgaben geben kann. Ich würde z.B. mal gerne wissen, was in den Listen drin steht, um vielleicht weitere inhaltliche Hinweise schließen zu können. Mit eclipse + scala-ide hast du die Möglichkeit zu Debugg...
von Kineese
2. Mai 2013 11:22
Forum: Archiv
Thema: Points per exercise
Antworten: 10
Zugriffe: 1088

Re: Points per exercise

viewtopic.php?f=300&t=27858 glaube dass das damit zu tun hat

Zur erweiterten Suche