H. Chase Stevens Logo

Most Common Tags

  1. programming
  2. python
  3. code
  4. philosophy
  5. evolution
  6. game design
  7. probability
  8. video games
  9. genetic algorithms
  10. government



Contradiction of Values: The New School's “Gateways”

posted on: Sunday, July 1, 2012 (8:04 pm) by

I have often felt that one of the real problems facing The New School is a lack of unified and consistent vision. The ability to reference and be guided by some manner of underlying philosophical foundations would greatly increase the school's governmental and communal stability. However, as of yet (and perhaps owing to the school's democratic nature and ever-changing populace), the philosophical waters of the school are at present murky and unexplored.

A prime embodiment of the consequences of this inconsistent and unexamined philosophical bedrock can be found in the school's "Gateway" policy. Gateways were concocted and implemented – without authorization from the student body or parents - by the school faculty as a means of testing student learning and conceptual understanding. This was a noble goal, to be sure: there was widespread fear that students were graduating from the New School without having mastered key concepts in math, science, and English language. I was a sort of "guinea pig" for the gateway program, being the first to attempt (and pass) the mathematics and "persuasive essay" gateways. In doing so, I had to demonstrate my abilities in both categories as measured against a rubric which had been devised by the teachers. This brings me to my first concern: creating standardized tests is a difficult task. It would seem to me that there are two criteria which a standardized test should attempt to pass:

1. Doing well on the test necessitates knowledge and understanding of the subject matter.
2. Understanding the subject matter guarantees that one does well on the test.
Designing a test which adheres to both these principles is not only hard, but perhaps even impossible. A test which caters to all methods of expressing subject mastery will expose itself to methods of expression which do not demonstrate learning, but are so abstract or subjective in evaluation as to be indistinguishable from those that do. On the other hand, a test which cannot in any case be "fooled" by such methods of expression and ensures that the test-taker have complete understanding of the subject matter will be so strict as to filter out those who have sufficient understanding but are not compatible with the test's methods of evaluation.

Because of this inherent conflict between the two goals, one must make a prioritization. It seemed to me that The New School had always valued the second goal over the former – leniency and acceptance of all learning styles and manners of expression over test accuracy. This, I thought, was evidenced by the fact that the narratives students had to create upon completing a course could take any form: an interview, an essay, a photo collage, et cetera. But the gateway rubrics were a step in the opposite direction, toward tests which, although they might provide better insight into whether or not a student has achieved a sufficient level of comprehension, are far more restrictive.

I don't find fault with aiming to fulfill the first of my two criteria when creating standardized tests. Indeed, having reliable metrics is an incredible boon in education: it allows teachers to see how well their teaching methods have been able to impart knowledge, and allows for the identification of problem areas for both specific students and entire classes. The provision of objective, conclusive evidence for student learning is a very, very good thing, perhaps even something which is imperative if we aim to ensure that students are leaving high school well-prepared for whatever they wish to do next. However, the question remains as to whether this style of testing is consistent with the espoused aims of The New School.

In fact, there pervades an even deeper conundrum as to the role of any testing at The New School. I started at the school because of its commitment to educational freedom for its students. The right to self-determination was an attractive proposition for me, as I imagine it is for many other students, both those currently attending the school and prospective students. I would even go so far as to say that for a multitude of community members, myself included, educational autonomy is an intrinsic property of our vision of the school, an attribute which should inform all decision-making and policy creation. The imposition of mandatory testing is not compatible with the school's assertion of its students as responsible young adults who are capable of determining what is best for themselves. Ultimately, without an explicit inquiry into the underlying philosophical tenets of the school, this and other contradictions of values will continue to occur.

Tags: education, examination, government, philosophy, testing, tnsk

More Stupid Higher-Order Function Tricks

posted on: Thursday, March 15, 2012 (11:23 am) by

A while ago, a friend of mine who was unfamiliar with python asked me how to go about parsing a CSV into a list of lists. Moreover, the data included integers which needed to be parsed as such (and not as strings). My solution was as follows:

(lambda f: [map((lambda x: x.isdigit() and int(x) or x),(line.split(','))) for line in f.readlines()]) #takes a file
Just yesterday, another friend of mine had accidentally merged and subsequently sorted two excel spreadsheets, and overwrote one with the result. She asked if I could take the merged file and the remaining original file and re-construct the file she had overwritten. Incorporating the CSV parsing function I had written earlier, I wrote this:
from tkFileDialog import asksaveasfile, askopenfile
full = (lambda f: [map((lambda x: x.isdigit() and int(x) or x),(line.split(','))) for line in f.readlines()])(askopenfile())
exclude = (lambda f: [map((lambda x: x.isdigit() and int(x) or x),(line.split(','))) for line in f.readlines()])(askopenfile())
(lambda f: map(f.write,(map(','.join,filter((lambda x: x not in exclude),full)))))(asksaveasfile())

Tags: code, csv, filter, lambda, map, programming, python, tkinter

One-Line Mode Function

posted on: Tuesday, March 13, 2012 (12:59 pm) by

More functional programming fun.

(lambda l: max([(l.count(i), i) for i in set(l)])[1])

Tags: lambda, math, programming, python, statistics, code

Plotting Simple Functions in 3 Lines with Python

posted on: Tuesday, March 6, 2012 (11:13 am) by

You can hardly even tell that I took a course on functional programming last semester.

import turtle
eq = "(x ** 2) / 1.5"
map((lambda x: turtle.setx(x[0]) or turtle.sety(x[1])),[(n,(eval(eq.replace("x","(" + str(n) + ")")))) for n in range(0,100)])

Tags: code, lambda, math, programming, python

Fermat's Primality Test

posted on: Sunday, January 22, 2012 (4:03 pm) by

Recently, I was reading about some sample interview questions used (at some point) by Google. One such question was "what are the first 10 consecutive digits of e that form a prime number?" Curious, I went to Wikipedia and looked up some primality tests that I could run on 10-digit prime candidates (if you'll forgive the pun) from e. One such test was Fermat's Primality Test, which can be used to probabilistically assess a number's primality (it fails on Carmichael numbers, et alia). I've written up a short python script which runs the test on the numbers 1 to 100 using computed probable primes as possible coprimes and returns all probable primes.


def test(end):
    candidates = range(1,end+1)
    primes = list()
    for candidate in candidates:
        prime = True
        for prime in primes:
            if candidate % prime:
                test_result = ((prime ** (candidate - 1)) % candidate)
                print "Candidate: %s, Prime: %s, Result:%s" %(candidate,prime,test_result)
                if test_result != 1:
                    prime = False
        if prime:
    return primes


Of course, the astute reader will notice that the above program exhaustively checks each candidate for primality for coprimality with all other probable primes, meaning that even simple trial division would be considerably faster. However, a quick modification to the program that only tested against a fixed number of random probable primes would lead to an increase in efficiency.

Tags: code, math, number theory, probability, programming, python