|
You going to explain, or just sit there and ?
|
# ? Jan 24, 2014 06:50 |
|
|
# ? May 21, 2024 06:41 |
|
shrughes posted:Yes it is. It's iterative. Well-disguised iteration, then? Because it sure looks like they're recursively calling themselves to solve the subproblem of whether n - 2 or 3 is divisible by 2 or 3. I can see how you'd rewrite that to use a for loop, but you can do that with most recursive solutions.
|
# ? Jan 24, 2014 06:51 |
|
shrughes posted:Yes it is. It's iterative. In the sense that "recursive" is "iterative plus a stack"? Or did you have some actual insight to share.
|
# ? Jan 24, 2014 06:51 |
|
99% sure he's obliquely referring to tail-call optimization that the Scheme interpreter does, which if the student wrote that on a simple modulus problem, likely has no idea exists.
|
# ? Jan 24, 2014 06:55 |
|
It's not tail-call optimization. It's well-defined specified behavior. That's how you write iterative functions in Scheme.
|
# ? Jan 24, 2014 06:58 |
|
Congratulations on missing the entire point of my original post, then. EVIDENCE THE STUDENT THOUGHT THEY WERE WRITING A RECURSIVE FUNCTION
EVIDENCE THE STUDENT THOUGHT THEY WERE WRITING AN ITERATIVE FUNCTION e: oh god i'm explaining the joke what am i doing? carry on then fucked around with this message at 07:09 on Jan 24, 2014 |
# ? Jan 24, 2014 07:00 |
|
shrughes is pretending to be unaware of what most people mean when they say "recursive" so that he can be smug about having read SICP. Good job, shrughes.
|
# ? Jan 24, 2014 07:31 |
|
Good to see you're on track to meet your terrible posting quota this month, shrughes!
|
# ? Jan 24, 2014 07:36 |
|
This code just turned up in some code I'm writing to integrate Crossroads.js with Backbone code:
|
# ? Jan 24, 2014 07:50 |
|
darthbob88 posted:Well-disguised iteration, then? Because it sure looks like they're recursively calling themselves to solve the subproblem of whether n - 2 or 3 is divisible by 2 or 3. I can see how you'd rewrite that to use a for loop, but you can do that with most recursive solutions. I invite you to rewrite that as a for loop in Scheme.
|
# ? Jan 24, 2014 08:42 |
|
Let's use object subscripting on a ternary operator! code:
|
# ? Jan 24, 2014 11:12 |
|
Internet Janitor posted:Students are mostly third-year CS students with some experience programming in imperative languages, but many have never used a functional language before. This is the real horror. How can you be a third-year CS student and not have seen a functional language? Also, it's cheating to bring in homework code. While correcting operating systems assignments, I've seen bugs you people wouldn't believe. TLBs on fire at the end of a context switch. I watched kernel threads unwittingly created without a stack, as they were functional as long as they never spilled registers or called functions. All that code will be lost in time, like a stack trace in a log file.
|
# ? Jan 24, 2014 11:39 |
|
GrumpyDoctor posted:shrughes is pretending to be unaware of what most people mean when they say "recursive" so that he can be smug about having read SICP. Good job, shrughes. He's not even remotely right, recursion is a matter of presentation not compilation result. Otherwise this would be a recursive function: code:
|
# ? Jan 24, 2014 11:49 |
|
Just came across this in my travels. It was originally all on one line, presumably for extra surprise value. Ternary misuse isn't a very original horror, but it's kind of elegantly horrible.code:
|
# ? Jan 24, 2014 12:35 |
|
I love that there's both "focusFadeOut" and "fadeOutFocus".
|
# ? Jan 24, 2014 13:24 |
|
Zombywuf posted:He's not even remotely right, recursion is a matter of presentation not compilation result. It sounds like you don't "get" Scheme. What about this: Is this not iterative? code:
|
# ? Jan 24, 2014 13:36 |
|
Athas posted:I've seen bugs you people wouldn't believe. TLBs on fire at the end of a context switch. I watched kernel threads unwittingly created without a stack, as they were functional as long as they never spilled registers or called functions. All that code will be lost in time, like a stack trace in a log file. Time... to HCF.
|
# ? Jan 24, 2014 16:32 |
|
shrughes posted:It sounds like you don't "get" Scheme. What about this: Is this not iterative? What definitions do you go through to define both iteration and recursion? Because it looks like the answer might be both, say you could call it an iterative function defined recursively. But you're just standing here not even mentioning how you define the meaning you attach to the words you're using, and act superior when people don't agree with you. It's not an issue of not getting Scheme, it's an issue of not getting you / not expressing oneself clearly enough. MononcQc fucked around with this message at 17:17 on Jan 24, 2014 |
# ? Jan 24, 2014 17:14 |
|
Found in shipped code:code:
|
# ? Jan 24, 2014 17:23 |
|
Athas posted:This is the real horror. How can you be a third-year CS student and not have seen a functional language? When you're a freshman, you're just taking your pre-reqs and maybe a course in your specialty. When you're a sophomore, you start taking your major's funny bits, but you're still stuck in freshman mode and you've also gotten complacent, thinking you're king poo poo of gently caress mountain because hey freshman year was easy peasy. Then, when you're a junior and you're expected to start working on Real Major poo poo, you're like "what the gently caress" cause this is stuff you've barely ever done for the past two years. That's how.
|
# ? Jan 24, 2014 17:27 |
|
Athas posted:This is the real horror. How can you be a third-year CS student and not have seen a functional language? that's ridiculous. at my school, two years worth of courses would have gotten you intro to CS, data structures, operating systems, computer architecture, some electives and MAYBE algorithms (though it was intended for a first semester 3rd year course). where exactly do you expect ALL computer science students to learn functional programming? not everyone has been coding since 12 and not everyone goes home to just to program in languages they don't learn in class. (i should also state my school, like a lot of other schools, goes with java as the introductory language instead of like scheme or something) Pie Colony fucked around with this message at 18:14 on Jan 24, 2014 |
# ? Jan 24, 2014 17:39 |
|
Athas posted:This is the real horror. How can you be a third-year CS student and not have seen a functional language? All of my courses were in C++ or Java and now I wish they'd made me learn a functional language back in the day so I'd be less poo poo with them now
|
# ? Jan 24, 2014 17:46 |
|
celestial teapot posted:Found in shipped code: I don't know why but I find this really hilarious Pollyanna posted:When you're a freshman, you're just taking your pre-reqs and maybe a course in your specialty. When you're a sophomore, you start taking your major's funny bits, but you're still stuck in freshman mode and you've also gotten complacent, thinking you're king poo poo of gently caress mountain because hey freshman year was easy peasy. Then, when you're a junior and you're expected to start working on Real Major poo poo, you're like "what the gently caress" cause this is stuff you've barely ever done for the past two years.
|
# ? Jan 24, 2014 17:55 |
|
Pie Colony posted:that's ridiculous. at my school, two years worth of courses would have gotten you intro to CS, data structures, operating systems, computer architecture, some electives and MAYBE algorithms (though it was intended for a first semester 3rd year course). where exactly do you expect ALL computer science students to learn functional programming? not everyone has been coding since 12 and not everyone goes home to just to program in languages they don't learn in class. In our first two years we have mandatory courses on functional programming (very first course on the bachelor level, in fact), algorithms/data structures, operating systems, compilers, networking, object-oriented programming, databases, human-computer interaction as well as a project course. (As well as the necessary math courses.) This leaves a bit of room for electives, though most of the room for those is on the third year. The functional programming is reinforced in the compilers course, where the compiler is built in a functional language as well. It is very much doable - and being done at our univeristy. It all depends on how highly you value functional programming. Sebbe fucked around with this message at 18:19 on Jan 24, 2014 |
# ? Jan 24, 2014 18:16 |
|
can you post one of these compilers made by a sophomore? e: i don't really imagine a sophomore understanding CFGs, LL/LR parsing, type checkers, register allocation, garbage collection, or anything that goes into making a compiler. unless you just meant you read chapter 5 from SICP. my school's program definitely wasn't the best but it's a fairly well known school and probably represents the type of education you can get from a typical non-elite school. Pie Colony fucked around with this message at 18:50 on Jan 24, 2014 |
# ? Jan 24, 2014 18:34 |
|
Strong Sauce posted:Are you actually describing your own experiences or what you view how CS courses go? This doesn't sound right at all. Actually she is right. Freshman and Sophomore year are usually full of 101 courses from different unrelated majors (mandatory electives). Also, CS programs have many courses that require prerequisites and as such you can't take them early. Not to mention scheduling problems, professor availability, and seat availability.
|
# ? Jan 24, 2014 18:37 |
|
Shinku ABOOKEN posted:Actually she is right. Freshman and Sophomore year are usually full of 101 courses from different unrelated majors (mandatory electives). This was exactly my experience. There were only a few semesters near the end that I thought I was actually focusing on computery related stuff. E: True, I'm just saying, "Yes that kind of thing definitely does happen." VVV Mogomra fucked around with this message at 18:47 on Jan 24, 2014 |
# ? Jan 24, 2014 18:43 |
|
Shinku ABOOKEN posted:Actually she is right. Freshman and Sophomore year are usually full of 101 courses from different unrelated majors (mandatory electives). Thus the case for the maintenance or reintroduction of weedout courses, so that people don't roll into junior and senior courses and poo poo the bed e: Mogomra posted:This was exactly my experience. There were only a few semesters near the end that I thought I was actually focusing on computery related stuff. This will vary tremendously from place to place
|
# ? Jan 24, 2014 18:43 |
|
Oddly enough how classes are distributed varies a lot between schools. My freshman and senior years were almost entirely CS classes, my junior year was almost entirely GEs, and sophomore year was a mix. Two years of GEs followed by two years of in-major classes seems to mostly be a large public university thing.
|
# ? Jan 24, 2014 18:49 |
At my university you typically took 2 cs coursers per semester and if desired could take more or less.
|
|
# ? Jan 24, 2014 18:51 |
Pie Colony posted:can you post one of these compilers made by a sophomore? Based on Sebbe's description of the curriculum (and his profile page) it sounds very much like DIKU. I suppose I can just post the code I turned in for the compiler course there in January 2005. Bunch of Standard ML files (for the Moscow ML interpreter suite.) Some parts of that code was supplied by the lector, in particular the file I/O stuff and some of the constants used for generating the MIPS assembly output. The register allocator might also have been supplied. The input language is a Pascal-like. E: Eh turns out I haven't touched SML for 8+ years and forgot a couple files in that archive. It's a small miracle I could even find those files. Fill in the blanks. nielsm fucked around with this message at 19:07 on Jan 24, 2014 |
|
# ? Jan 24, 2014 18:54 |
|
nielsm posted:Based on Sebbe's description of the curriculum (and his profile page) it sounds very much like DIKU. I suppose I can just post the code I turned in for the compiler course there in January 2005. Bunch of Standard ML files (for the Moscow ML interpreter suite.) Some parts of that code was supplied by the lector, in particular the file I/O stuff and some of the constants used for generating the MIPS assembly output. The register allocator might also have been supplied. The input language is a Pascal-like. Indeed it is DIKU. It follows the book Basics of Compiler Design, which pretty much was written for use on the course. Each year, a basic compiler for a subset of a language is handed out. The students then extend this compiler with new features, working in groups. The exam again is extending the compiler, this time on their own, with some more features. Here's my group's compiler from 3 years ago. Each year it's a new language. Quite fun course. Edit: The problem statement (G-opgave.pdf) is there, too, if you can read Danish. Sebbe fucked around with this message at 19:30 on Jan 24, 2014 |
# ? Jan 24, 2014 19:22 |
|
Plorkyeran posted:Oddly enough how classes are distributed varies a lot between schools. My freshman and senior years were almost entirely CS classes, my junior year was almost entirely GEs, and sophomore year was a mix. Two years of GEs followed by two years of in-major classes seems to mostly be a large public university thing. At mine it's basically three semesters of one or maybe two intro CS classes per semester until you pass the introductory data structures course in your third semester, then a mad dash to grab all required classes plus about 7 CS electives, the finish up GE classes you might have not gotten to while you were stuck waiting to pass DS. Could be better, but I've enjoyed my all CS semesters well enough.
|
# ? Jan 24, 2014 20:17 |
|
Pie Colony posted:that's ridiculous. at my school, two years worth of courses would have gotten you intro to CS, data structures, operating systems, computer architecture, some electives and MAYBE algorithms (though it was intended for a first semester 3rd year course). where exactly do you expect ALL computer science students to learn functional programming? not everyone has been coding since 12 and not everyone goes home to just to program in languages they don't learn in class. my school did about a 50/50 mix of Java and Scheme in the first year CS courses.
|
# ? Jan 25, 2014 01:00 |
|
When I signed up at my school, we had to take 2 Physics courses, Calculus (differential and integral), Linear Algebra, Combinatorics, a bunch of CS courses, and then enough electives to get to 120 credit hours. Since then they've added additional breadth requirements.Deus Rex posted:my school did about a 50/50 mix of Java and Scheme in the first year CS courses. Cool that you got to use a functional language outside of a course on that type of language. At my school, everything was Java, except for a course on Functional and Logical Programming, covering Standard ML, Racket, and Prolog. I wonder how it would be to go through a CS degree where everything was SML/Scheme/some_other_functional_language, except for a course on Imperative and Object-oriented programming?
|
# ? Jan 25, 2014 05:53 |
|
Pie Colony posted:that's ridiculous. at my school, two years worth of courses would have gotten you intro to CS, data structures, operating systems, computer architecture, some electives and MAYBE algorithms (though it was intended for a first semester 3rd year course). where exactly do you expect ALL computer science students to learn functional programming? not everyone has been coding since 12 and not everyone goes home to just to program in languages they don't learn in class. Sounds mostly like mine. First year you get intro to programming, intermediate programming, discrete structures 1, calculus 1, and six electives. We do five classes a semester. Second year is data structures, computer architecture, OO, discrete structures 2, algorithms, software systems development (this one is notorious for its high failure rate), operating systems. Third and fourth is mostly electives, but we have to take classes in system analysis and design, software engineering, theory of computation, and either statistics 1 or modelling of computer systems. Compilers was made a requirement for students starting in 2013. Most classes are in C. Java is used for OO. And we've done some Python.
|
# ? Jan 25, 2014 06:01 |
|
Athas posted:This is the real horror. How can you be a third-year CS student and not have seen a functional language? Gazpacho fucked around with this message at 08:19 on Jan 25, 2014 |
# ? Jan 25, 2014 08:17 |
|
I don't think it's really that surprising. Functional languages are kind of trendy for first-year CS education right now, but it's hardly all schools that do it that way or some kind of fundamental requirement of a CS program. Lots of places still use Java or some combination of Python, C and C++. Some places even use Lisp. And if the intro courses aren't in a functional language, then probably the only courses that would use it are upper division electives that not everyone takes.
|
# ? Jan 25, 2014 08:44 |
|
Gazpacho posted:The US teems with colleges that have unaccredited CS departments whose focus is vocational. It's not that I didn't know there were functional languages during my undergrad program, but nobody on the faculty was repping for them, and if you concluded that therefore they must be a research dead end nobody was going to challenge that conclusion. Of cousre, my "introductory" course (though it was CS 1&2 bundled together) used Scratch for a bit into Processing with zero focus on data structures that everyone who took CS2 had.
|
# ? Jan 25, 2014 09:41 |
|
|
# ? May 21, 2024 06:41 |
|
quote:Note: The electronic payment system is unavailable due to weekly maintenance from 11 p.m. on Friday until 9 a.m. on Saturday. Not sure why a website should need 10 hours of weekly downtime for maintenance.
|
# ? Jan 25, 2014 09:52 |