Domain: iwriteiam.nl
Stories and comments across the archive that link to iwriteiam.nl.
Comments · 16
-
Use unparser
I would let LISP print out a s-expression representing the abstract syntax tree (usually called abstract parse tree). Next I would add a small piece of code to my IParse program to read s-expression and use the unparse abilities with the C grammar to produce nicely formatted C code. The unparse function is smart enough to output a S-expression like '(times (add 3 4) 5) into (3+4)*5 based on the given grammar rules fed to IParse. Feel free to contact me, if you want any help with using IParse.
-
Self taught
I learned Algol 60, FORTRAN, and Lisp while still in high school. Writing programs out on paper before traveling to a near by city by train to make punch cards and run the programs, often going home with s stack of listings to study the results. Only in second year of university did I learn something truely new: currying and lazy evaluation. More details.
-
Over use of back-tracking
Most Sudoku's can be solved without back-tracking. There is a rather trivial mapping of Sudoku's to Exact Cover problems (see: Hardest Sudoku). Good solvers, only use back-tracking when needed, and try to apply logic reduction first. When there is a column were A implies B, all rows in which B is true and A false can be eliminated, because a selection of such a row will leave the A column empty. Most of the published Sudoku's can be solved with using this simple reduction rule.
-
Re:Readability
HA! The very first basic I used was Acorn Atom Basic. Tell me that's readable.
-
Re:Algorithms
Sudoku's are really simple for computers. Simply map them to an Exact Cover and then solve the Exact Cover by reduction. Never takes more than a few seconds, even for the most hard ones. This is because Sudoku's have one solution and I have never come across a Sudoku that has one solution and cannot be solved by simple logic reasoning. There do exist Exact Covers that have one solution, but require guessing. But even if some Sudoku would require some guessing, it still cannot be a complex problem, and a back-tracking algorithm would solve it quickly. See Hardest Sudoku for some more details, algorithms and such.
-
Programs
What I mean more exactly, is to use a program (like this one) that transforms a Sudoku into an Exact Cover problem, and next try to use an elimination program (like this one) to find a solution. See also this blog entry for some more information.
-
Programs
What I mean more exactly, is to use a program (like this one) that transforms a Sudoku into an Exact Cover problem, and next try to use an elimination program (like this one) to find a solution. See also this blog entry for some more information.
-
Programs
What I mean more exactly, is to use a program (like this one) that transforms a Sudoku into an Exact Cover problem, and next try to use an elimination program (like this one) to find a solution. See also this blog entry for some more information.
-
Stage 2 VM in JavaScript
I spend about three hours writing (mostly debugging) a JavaScript implementation of the VM. (I did make a side step to C++ because at one point the JavaScript implementation seemed to run in an infinite loop.) I also discovered that the specification was not very clear and required some interpretation. So stating that stage 2 was the simplest step, and using some code that someone else developed, is not really honest. The biggest problem was with figuring out how the jmp instruction worked and the use of the cs register, because that was not explained in the specification. For more on my implementation see here.
-
Re:Object oriented and functional cannot be combin
Not at all. I'm not sure what you mean by "values" here (I'll touch on that below), but the strict definition of a functional language is "a language that has functions as first-class values". That's all there is to it.
I would define a functional language a language in which all expressions (including defined functions) have no side effects.
Object oriented to me means the introduction of object identity. Object oriented languages often work with collections of objects, that have references between them. Of course it is possible to define a function that queries a collection of objects, but as soon as you introduces means to alter attributes of objects (including references between them) you get serious problems with definining the semantics of your language, because you are introducing side effects. Side effects have a profound implication on things like execution order, which in a purely functional language should not matter (think about lazy evaluation). The only way you can avoid these problems is to let all your functions work on the whole collection of objects. Which means that if you modify one attribute of an object, the whole collection of objects (closed over objects that reference each other) are modified, implying that all objects are modified that belong to that collection. When you reason like this way about a collection of objects, that collection of objects becomes a value.
But often when people talk about object oriented, that put the objects (and not the 'universe', the collection of objects that they belong to) at the center of their attention. For more of my thought, read the articles The Art of Programming and Object-Oriented Considered Harmful.
-
Re:Object oriented and functional cannot be combin
Not at all. I'm not sure what you mean by "values" here (I'll touch on that below), but the strict definition of a functional language is "a language that has functions as first-class values". That's all there is to it.
I would define a functional language a language in which all expressions (including defined functions) have no side effects.
Object oriented to me means the introduction of object identity. Object oriented languages often work with collections of objects, that have references between them. Of course it is possible to define a function that queries a collection of objects, but as soon as you introduces means to alter attributes of objects (including references between them) you get serious problems with definining the semantics of your language, because you are introducing side effects. Side effects have a profound implication on things like execution order, which in a purely functional language should not matter (think about lazy evaluation). The only way you can avoid these problems is to let all your functions work on the whole collection of objects. Which means that if you modify one attribute of an object, the whole collection of objects (closed over objects that reference each other) are modified, implying that all objects are modified that belong to that collection. When you reason like this way about a collection of objects, that collection of objects becomes a value.
But often when people talk about object oriented, that put the objects (and not the 'universe', the collection of objects that they belong to) at the center of their attention. For more of my thought, read the articles The Art of Programming and Object-Oriented Considered Harmful.
-
Effects on the familyI too have a son with a birth defect that caused him to be mentally handicaped. He is 10 now. He cannot read nor write, but can do simple maths with numbers below 20. He has a great sense of humor and uses the computer to surf the internet searching for images of his favourite TV-shows.
Of course, not every handicapped child is the same, but I believe that my son is having a happy life dispite his handicaps. And in a sense, he also is a joy to us.
But his life did have a dramatic effect on our family life. My wife devoutes all her energy in taking care for him. As a result of this, her relationship with my now 13 year old daughter has been very poor. My wife also has been suffering from a burn-out and depressions. For many years my daughter has not been able to invite friends over to our house, because my wife could not handle the additional stress of an extra child in the house, while having to care for our son. It is my daughter who has been suffering far more than my son. For me too it has not been very easy. For many years our lives have been centered around caring for our son.
-
Effects on the familyI too have a son with a birth defect that caused him to be mentally handicaped. He is 10 now. He cannot read nor write, but can do simple maths with numbers below 20. He has a great sense of humor and uses the computer to surf the internet searching for images of his favourite TV-shows.
Of course, not every handicapped child is the same, but I believe that my son is having a happy life dispite his handicaps. And in a sense, he also is a joy to us.
But his life did have a dramatic effect on our family life. My wife devoutes all her energy in taking care for him. As a result of this, her relationship with my now 13 year old daughter has been very poor. My wife also has been suffering from a burn-out and depressions. For many years my daughter has not been able to invite friends over to our house, because my wife could not handle the additional stress of an extra child in the house, while having to care for our son. It is my daughter who has been suffering far more than my son. For me too it has not been very easy. For many years our lives have been centered around caring for our son.
-
Interpretting parser
Some years ago, I wrote an interpretting parser, which simply loads a grammer (in extended BNF) and next parses a string according to it. The lexical analyses needs to be hand coded, but examples for the most common literals are included. The interesting bit is that the parser controls the lexer, which simply gives you context sensitive lexing. The whole thing is rather small. The nice thing is that it doesn't generate code. I once tried to make it generate code, but the produced code was actually slower than the interpretting version. (Probably has to do with the fact that the interpretter fits in the primary processor cache.) The parser uses back-tracking, but uses some smart caching, making it very fast. The whole interpretting parser consists of a single C file of about 100 Kbyte and can be found here.
-
Re:The darn fool.
Unfortunately the terminology has, as usual, been co-opted and distorted by the masses, who tend to think that weak atheists are agnostics, and all atheists are strong atheists.
When I did some research about this (admittedly, this was a while ago), the term agnostic could encompass a wide variety of beliefs (including those you attribute to weak atheism).
Indeed, the term was basically coined to describe those who did not hold strong atheist views. A logical interpretation of this is that anyone who claims that we don't know about the existence of God in some way is a certain kind of agnostic. Then one can subdivide agnostics into appropriate categories.
One site gives the following definitions: An agnostic theist, for example, is one "who believe that a deity probably exists", while an agnostic atheist believes "that it is very improbable that a deity exists." On the other hand, an empirical agnostic believes "that God may exist, but that little or nothing can be known about him/her/it/them."
Thus, within this context weak atheists could be described as agnostic atheists. I believe the latter term is more clear, since it encompasses both the "not knowing" meaning of agnost as well as the implications of atheist. Certainly, though, I do not believe that describing people as agnostics when you would describe them as weak atheists is diluting the term. As mentioned earlier, it was devised originally in part (or in full, I'm not sure) for this purpose.
Besides, wouldn't it be a bit counterintuitive to have the definition of agnostic be a narrow one? -
Brainfuck!
Recommend Brainfuck to your company. Sure, they will eventually fire you when they realize what they got into, but you will go out with a hell of a snicker.