Efectos Especiales

Ramblings, rants, musings, ideas and observations. Topics include (but are not limited to): programming (especially Python), books, games (especially CCGs and board games), astrology, design, writing, painting, etc.

icon:default #699 (old comments) NADD, again

[I wrote about this before. For the definition of NADD, see this article.]

One of the signs of NADD is having a lot of windows open at the same time. I wonder if that isn't a sign of the times, for programmers, at least. Different developers use different tools, of course, so this will vary from person to person... but a modern programming job at least encourages to use a great many tools, which are often open during programming.

For example, here's what I regularly use when working on my main project (aka "work"):

In other words, having most of those apps open at the same time is a necessity... it's not just a matter of an obsessed mind trying to do 20 things at once. (That is just a pleasant side-effect. emoticon:smile) Closing these programs when you're "done" doesn't really make sense if you may need them again 5 minutes later.

I wonder if other developers have similar experiences. (Feel free to use the comment option; it's not just for spam... :-)

[Update #1] My point, by the way, was not that I want to reduce the number of open Windows... Well, I guess if it can be done without losing functionality or speed, that's OK. But the actual point was that having all those things open is not necessarily a sign of NADD... it may very well be a sign of a busy (programming) job instead. :-)

/* Posted by Hans Nowak at 2004-12-19 19:04 */

icon:spam #698 (old comments) Peculiar spam

This spam seems like a haiku gone wrong:

Devised for:
Intensify sexual life ride
Encouragement intimate operation
Abundant and inflexible hard-on
Growth toughness & fortitude

Improved solution
Works in less than 11 minutes
Lowest price on the Net

Also, I regularly get spam in languages other than English... Japanese, Russian, and Spanish are some favorites... but the other day I got one in Albanian! What were they thinking?

/* Posted by Hans Nowak at 2004-12-18 10:59 */

icon:games2 #697 (old comments) Runebound

This looks like an interesting game. Maybe someday I'll get it. Not now, though; we are planning to move to a different state, and I don't really need any extra stuff to carry along.

Of course, this bit doesn't seem promising: "Two of the colors were indistinguishable to the colorblind member of our group, ..." Hmm.

This site has a number of documents, like rules, extended rules, a FAQ, card list, etc.

/* Posted by Hans Nowak at 2004-12-18 10:51 */

icon:programming #696 (old comments) On static typing (1)

Advocates of rigid languages often claim that static typing catches a lot of bugs, because it checks types at compile time. Dynamic languages, on the other hand, check things at run time.

I don't know. If checking types was so important, then one would expect that this would be done a lot in unit tests. However, very rarely I write tests that explicitly check types, and I haven't seen it in other people's tests, either.

Maybe it's a bit of a self-fulfilling prophecy. Rigid languages make types important, so whenever you get a type "wrong" (i.e. different from the declared type signature), it's a bug, and the compiler balks loudly. No wonder a lot of these bugs are caught; the language sets the programmer up to make them. By contrast, in a dynamic language, what a type or object *does* is important, not if it matches a certain declaration. As a result, programmers can focus on the actual functionality without having to worry about ballast, and the language doesn't introduce extra opportunity for errors.

Or something like that. emoticon:smile

/* Posted by Hans Nowak at 2004-12-17 21:32 */

icon:cardgames #694 (old comments) Collectible card games

There are more collectible card games than one might think.

It all started with Magic the Gathering, of course. Targeted at a geeky audience, with strong fantasy and D&D influences. It spawned a lot of copycats, and also some original and well-designed CCGs (L5R, Magi-Nation, etc).

These days, there are CCGs for everything. Some try to cash in on the success of certain themes: Pokemon, Harry Potter, Dragonball Z, Yu-Gi-Oh, Lord of the Rings. (But behind the poppy facade there actually might be a good game. For example, Pokemon may not be the most complex of CCGs, but it's rather good.) Other games cater to different audiences... the Bratz Fashion Party Fever Game, or WotC's Star Sisterz. There are also CCGs with a christian audience (Redemption).

By the way, the new Magi-Nation expansion seems to be called Traitor's Reach... not sure if it's actually going to be released, though. Some card previews can be found on insiider.com.

/* Posted by Hans Nowak at 2004-12-08 23:35 */

icon:food #693 (old comments) The Complete Book of Cheese

(Via Brainwagon:) The Complete Book of Cheese, on Project Gutenberg. A yummy interesting treatise on all kinds of cheeses, including Dutch ones of course. It also has a number of recipes.

This quote tickled my fancy: "Commodore Coe, of the Montevidian Navy, defeated Admiral Brown of the Buenos Ayrean Navy, in a naval battle, when he used Holland cheese for cannon balls." Hmm...

/* Posted by Hans Nowak at 2004-12-07 21:58 */

icon:default #692 (old comments) An observation

It's funny... when I don't write, I gain more Bloglines readers than when I do write. What does that tell me...

/* Posted by Hans "lost another one to ditech" Nowak at 2004-12-02 19:34 */

icon:caml #691 (old comments) A bit more about OCaml types

OCaml really is an interesting language. I am studying it because it's so different from what I'm currently using (mostly Python, a bit of Delphi). It teaches you to think differently about problems, although it's a different different than when studying Lisp or Scheme. :-)

The type system is ultra-strong, and currently gets in the way of my thinking, which is probably an indication that the problem at hand needs to be handled differently.

One example. (Hey, I have to write about *something*, right?) Let's say that in a far future, I would like to write a Lisp interpreter in OCaml. How would I go about that? How would you emulate Lisp-like lists in OCaml?

OCaml's built-in lists are not unlike Lisp's, consisting of pairs with a car and a cdr (or a head and a tail, if you will), and some syntactic sugar for convenience. However, these lists can only be of one type. Any type. So [1;2;3] is valid, and so is ["Guido"; "Larry"; "Xavier"]. But ["+"; 2; 3] is an error. So we cannot use these lists as-is.

Lisp lists aren't just pairs, though. There's also the empty list. So a list node can be either a pair, or the empty list. This can expressed like this:

type 'a lisplist = Nil | Cons of 'a * 'a lisplist;;

The 'a means "any type". A list element is either Nil, or a Cons, represented by a pair of which the first element is of type 'a, and the second of type 'a lisplist.

While this works, it still restricts the list to one type. We need something more. Lisp has many types. What if we define a type lisptype that handles these, and then use a list of lisptype?

type lisptype =
    Int of int
  | Float of float
  | Symbol of string
  | String of string
  | Rational of int * int

Here, lisptype has several subtypes. E.g. Int is represented by an OCaml int, Symbol by an OCaml string, and Rational by an OCaml tuple int * int. This almost works. What's missing is that a list is also a Lisp type. We could do something like

type lisptype =
    Int of int
  | ...etc...
  | LispList of lisplist


type lisplist = Nil | Cons of lisptype * lisplist;;

but the type checker won't let us define these separately. If we define lisptype first, we get an error because it refers to lisplist, which hasn't been defined yet... and vice versa.

The and construct to the rescue:

type lisptype =
    LispInt of int
  | LispFloat of float
  | LispSymbol of string
  | LispString of string
  | LispRational of int * int
  | LispList of lisplist
 lisplist = Nil | Cons of lisptype * lisplist;;

This allows us to have mutually recursive definitons. Nice. emoticon:loveit

[Note #1] It might be possible to get away with using regular lists... e.g. by using LispList of lisptype list. But that wouldn't give me user-defined pairs. At this point, I'm not sure if using OCaml lists would have the same effect.

[Note #2] The new type(s) can be used like this:

# let a = LispInt 4;;
val a : lisptype = LispInt 4
# let b = LispFloat 3.1415;;
val b : lisptype = LispFloat 3.1415
# let z = Cons (a, Cons (b, Nil));;
val z : lisplist = Cons (LispInt 4, Cons (LispFloat 3.1415, Nil))

(If you'd like to learn more about OCaml, this page has a number of tutorials. And stuff for other languages as well, by the way.)

[Other posts about OCaml: #350, #423, #683]

/* Posted by Hans "snoep verstandig, eet een kameel" Nowak at 2004-11-25 21:48 */

icon:wax #690 (old comments) Wax 0.2.39 released

Available in the usual place.

Not much is new since 0.2.33. Some controls support more styles. Some support the size parameter, which is necessary in certain situations (i.e. setting the size after creating the control does not necessarily have the same effect). Added ShowMessage function (ala Delphi).

Note that some of the work on Wax is currently sponsored by Oasis Digital.

/* Posted by Hans Nowak at 2004-11-23 20:02 */