News for hackers. Stuff that matters.
Re:Advanced Programming Languages (2009) by ken on Tuesday May 05, 2020 @09:32AM (#23079834)
I've seen a definite shift in what "artificial intelligence" means.

Norvig's PAIP is all about manipulating symbols. It's so fundamental that in any other language you'd have to Greenspun an interpreter first, just to solve the same problems in the same way.

Today, AI seems to mostly mean matrices. If that's all you need, then you can do it in any language, especially if you're just wrapping old C or Fortran libraries.

I haven't done any new-style AI but I get the feeling that most "research" is in finding new nails to pound with the same hammer. That's a legitimate area of research, but it also should be no surprise that the concept of "AI research" expanded so much in recent years because it changed from "learn to build your own lightsaber" to "pick up a hammer and hit something with it".

Re:Advanced Programming Languages (2009) by thesz on Tuesday May 05, 2020 @12:50PM (#23082031)
Behind matrices, there is a lot of symbolic processing in the data cleanup part. Most of the time, Python suffices.

Most of the time, people does not leave Python when it is not satisfactory. They stick with it because they have no clue, most of the time.

For example, it is not quite natural for Python folks to even think about creating rewrite rules (as in Haskell) for programs to stay at higher level of expression. E.g., if you use dictionary with default value, why not lift all operations up (inline, so to say) and avoid calling these that are overloaded? It bit me many times, yet other users of Python just gave me blank stare when I tried to explain these things.

Re:Advanced Programming Languages (2009) by typest on Tuesday May 05, 2020 @03:42PM (#23084016)
Sorry, can you explain what you mean here? I am always trying to get better at both python and functional programming, but I don't know what you mean about lifting operations up/inlining them in this case with defaultdicts.
Re:Advanced Programming Languages (2009) by thesz on Tuesday May 05, 2020 @07:03PM (#23086148)
Take a look here to get a feel of what rewrite rules are: https://downloads.haskell.org/~ghc/7.0.1/docs/html/users_gui...

Haskell has two very nice libraries, bytestring and vector which use rewrite rules to have performance comparable to C code.

Operations on dictionaries with default values implemented using inheritance from dictionary. This means that instead of just having conditional expression on the right side I have a call to virtual function and there is an expression on the right side of assignment or return statement.

Most of OO virtual machines can JIT things like these into efficient machine code, by specializing. The same is also quite possible with bytecode like in CPython - by optimization in the compiler or by introduction of rewrite rules like above for library implementors to specify rules that apply to any (transformed) user code.

Re:Advanced Programming Languages (2009) by BerislavLopac on Wednesday May 06, 2020 @07:17AM (#23089725)
So something like Cython or numba?
Re:Advanced Programming Languages (2009) by thesz on Wednesday May 06, 2020 @12:02PM (#23092575)
What are these? Do they support rewrite rules on programs?
Re:Advanced Programming Languages (2009) by BerislavLopac on Thursday May 07, 2020 @03:03AM (#23100477)
I meant them in the context of your last paragraph; they are tools that optimize Python for performance. Cython is a compiled superset of Python, while numba is a JIT compiler that works on a subset of Python.

I must admit I don't quite understand what rewrite rules actually are; are they akin to macros?

Re:Advanced Programming Languages (2009) by thesz on Friday May 08, 2020 @09:15AM (#23114487)
Macros have local scope. They are evaluated to program text only once, probably, lazily.

Rewrite rules fire when compiler encounters a chance for them to fire, at any point of (optimizing) program transformation.

Due to this fact, rewrite rules are not local - compiler can transform the inner structure of a program changing the locality of program statements.

    bs = map g xs
    ... many other lines of program text not reassigning bs
    as = map f bs
still can be transformed into "as = map (f . g) xs" by rule "map f (map g xs) => map (f . g) xs" due to substitution.
Re:Advanced Programming Languages (2009) by BerislavLopac on Friday May 08, 2020 @01:14PM (#23117069)
So they -- like macros -- rewrite the source code into something different before the compilation, but -- unlike macros -- only do that under certain circumstances. Would this be a sensible approximation? I'm just trying to understand what they're doing, not why or how. Thank you!
Re:Advanced Programming Languages (2009) by ianandrich on Tuesday May 05, 2020 @03:02PM (#23083550)
Ooh, good observation. I never really thought about how many problems I've had explaining why I'm lifting something or how it makes things better.
Re:Advanced Programming Languages (2009) by newen on Tuesday May 05, 2020 @12:23PM (#23081734)
There seems to be a misconception among non machine learning programmers that ML is all about multiplying matrices. In reality, there is a lot of architecture involved and having a programming languages that facilitates that would be enormously helpful.

Yes, there is a lot of multiplying matrices. But you need to think of a matrix as like a <div> or something and multiplying matrices and placing two <div>s next to each other. Then, think of how to create a dynamic website from that. There is a lot of architecturing involved other than multiplying matrices.