x[a]=(int if x[a].find(".")==-1 else float)(x[a])

Posted by s on Nov. 25, 2008, 11:16 p.m.

Luda said first class functions never seem necessary. Well, nothing's necessary once you have turing completeness and proper IO, so that just means first class functions do just as they should: Make life easier when you want them to

Today I remembered that when I was in French Immersion all the lessons were in French and all the tests were in French. They weren't strict on grammar though, and so how I'm learning in my French class reflects this. When the teacher talks, some people don't know what she's saying. To me, it all sounds natural. When we have reading assignments, I'm done. I'm use to reading in French. The issue is that my knowledge of the actual grammar is highly intuitive, so now I'm getting a well formatted lesson on how the grammars work

And Physics is crazy. I look over a problem chanting on about forces going this way and that and none of it makes logical sense to me. It all just seems like a bunch of random symbols dashed across the page

Now then, to give this function a 10000x speed boost by optimizing out eval()

def tokenize(x):

. return eval(str(x.split(" ")[1:-1]).replace("'(',","[").replace(", ')'","]"))

I'm also using eval() in macroize(). eval() is nice for prototype code

So far I have

(macro (+ a b)

(push ,a ,b ebx)

(pop ebx eax)

(add eax ebx)

(pop ebx))

(+ 1 2)

Becoming

[[['push', '1', '2', 'ebx'], ['pop', 'ebx', 'eax'], ['add', 'eax', 'ebx'], ['pop', 'ebx']]]

Comments

ESA 15 years, 5 months ago

Notice how many comments you receive is proportionate to the amount of code in you posts. I despise physics :S

s 15 years, 5 months ago

Comments from people who don't like code? Forget about them

Physics is quite fun, lots of interesting stuff talked about and while there are a few "That's this weird thing that's crazy so don't ask" or "Nobody really knows why" answers, it isn't as much as with the other sciences. They want you to inquire as to why, not just what