ときどきの雑記帖 再起編

最新ページへのリンク
目次ページへのリンク

一つ前へ 2012年3月(下旬)
一つ後へ 2012年4月(中旬)

ホームへ

2012年04月10日

■_

明日は健康診断があったりする。 が、依然不調のままであった。

■_

R と Juila

An R programmer looks at Julia | (R news & tutorials)

(略)

Evaluating a new language

There is a temptation to approach a new programming language with the idea that it 
should be exactly like the language I am currently using but better, faster, easier, ... 
This is, of course, ridiculous. If you want R syntax, semantics, function names, and 
packages then use R. If you consider another language you should accept that many 
tasks will be done differently. Some will be done better than in your current language 
and some will not be done as well. And the majority will just be done differently.

Two primary Julia developers, Jeff Bezanson and Stefan Karpinski, recently gave a 
presentation at the lang.NEXT conference. The slides and video can help you get a 
flavor of the language.

So, what does Julia provide that R doesn't?

    A JIT. The first time that a function is called with a particular argument signature it
    is compiled to machine code using the LLVM compiler backend. This, naturally, provides a
    speed boost. It can also affect programming style. In R one instinctively writes vectorized
    code to avoid a performance hit. In Julia non-vectorized code can have similar and, under
    some circumstances, better performance than vectorized code.

    A richer type system. Scalars, vectors/arrays, tuples, composite types and several others
    can be defined in Julia. In R the atomic types are actually atomic vectors and the
    composite types are either lists (which is actually a type of vector in R, not a lisp-like
    list), vectors with attributes (called structures in R but not to be confused with C's
    structs). The class systems, S3 and S4, are built on top of these structures.

    Currently it is difficult to work with 64-bit integers in R but not in Julia

    Multiple dispatch. In Julia all functions provide multiple dispatch to handle different
    signatures of arguments. In some sense, functions are just names used to index into method
    tables. In R terminology all functions are generic functions with S4-like dispatch, not
    S3-like which only dispatches on the first argument.

    Parallelism. A multiple process model and distributed arrays are a basic part of the Julia
    language.

    A cleaner model for accessing libraries of compiled code. As Jeff and Stefan point out,
    languages like R and Matlab/octave typically implement the high-level operations in "glue"
    code that, in turn, accesses library code. In Julia one can short-circuit this process and
    call the library code from the high-level language. See the earlier blog posting on
    accessing the Rmath library from Julia. This may not seem like a big deal unless you have
    written thousands of lines of glue code, as I have.

There are some parts of R not present in Julia that programmers may miss.

    Default arguments of functions and named actual arguments in function calls. The process of
    matching actual arguments to formal arguments in R function calls is richer. All matching
    in Julia is by position within function signature. Function design with many arguments
    requires more thought and care in Julia than in R.

    The R package system and CRAN. One could also throw in namespaces and function documentation
    standards as part of the package system. These are important parts of R that are not yet
    available. However, that does not preclude simular facilities being developed for Julia. The
    R package system did not spring fully grown from the brow of Zeus.

    Graphics. One of the big advantages of R over similar languages is the sophisticated
    graphics available in ggplot2 or lattice. Work is underway on graphics models for Julia but,
    again, it is early days still.

An example: Generalized Linear Models (GLMs)

以下略
Copyright © 2012 R-bloggers. All Rights Reserved.

R になくて Julia にある JITコンパイラー(Rの方あったような?)、より rich なデータ型、 並列性、並行性、Multiple dispatch、 より明確な言語モデル。 で、Julia に (まだ) ないものが 関数のデフォルト引数や名前つき引数、グラフィックスとパッケージシステムと。

■_

コンパイラーが捕らえないC++プログラミングのミス

コンパイラーが指摘するのもあるような?

ああ、こういうことか These examples were all tested using Visual Studio 2005 Express using the default warning level.

Eight C++ programming mistakes the compiler won't catch | Pixelstech.net


Eight C++ programming mistakes the compiler won't catch

Source : Alex    Date : 2012-04-08 09:55:20  

C++ is a complex language, full of subtle traps for the unwary. There is an almost 
infinite number of ways to screw things up. Fortunately, modern compilers are pretty 
good at detecting a large number of these cases and notifying the programmer via 
compile errors or warnings. Ultimately, any error that is compiler-detectable becomes 
a non-issue if properly handled, as it will be caught and fixed before the program 
leaves development. At worst, a compiler-detectable error results in lost time while 
the programmer searches for a solution or workaround.

The dangerous errors are the ones that compilers are unable to detect. These errors 
are much less likely to be noticed, and can cause severe consequences such as 
incorrect outputs, corrupted data, and/or program crashes. As the size of a 
programming project increases, the complexity of the logic and large number of paths 
of execution can help obscure these bugs, causing them to appear only intermittently, 
making them particularly hard to track down and debug. Although this list may be 
mostly review to experienced programmers, the consequences of making one of these 
errors is also amplified due to the scale and commercial nature of the projects 
experienced programmers tend to work on.

These examples were all tested using Visual Studio 2005 Express using the default 
warning level. Your results may vary on other compilers. I highly recommend all 
programmers use the highest warning level possible!. Some items that may not be 
flagged as a potential problem at the default warning level may be caught at the 
highest warning level!

(Note: This article is part 1 in an intended series of articles)


1) Uninitialized variables

Uninitialized variables are one of the most devious mistakes commonly made in C++. Memory
allocated to a variable in C++ is not cleared or zeroed upon allocation. Consequently, an
uninitialized variable will have some value, but there is no way to predict what that value
will actually be. Furthermore, the value of the variable may change each time the program is
executed. This can result in intermittent problems, which are particularly hard to track down.
Consider the following snippet:

  if (bValue)
      // do A
  else
      // do B

If bValue is uninitialized, it could evaluate to either true or false, and either branch could
be taken.

In some basic cases, the compiler will be able to inform you of an uninitialized 
variable. The following causes a compiler warning on most compilers:

(略)

Conclusion

As this is the first article in this series, I thought it appropriate to start with 
some of the more basic issues that new programmers will encounter. Future articles in 
this series will tackle programming mistakes of an increasingly complex nature.

Regardless of a programmer's experience level, mistakes happens, whether through lack 
of knowledge, a typo, or general carelessness. Being aware of which issues are most 
likely to cause trouble can help reduce the probability that they will cause trouble. 
While there is no substitute for experience and knowledge, good unit testing can help 
catch many of these before they get buried under layers of other code!

Source:
http://www.learncpp.com/cpp-programming/eight-c-programming-mistakes-the-compiler-wont-catch/
Pixelstech.net © 2011-2012 All rights reserved

■_

2012年04月09日

■_

日経MJ、駅の売店にありました。 休刊日で普通の新聞が並んでなかったので探しやすかったw

■_

オライリーのあれ。 State of the Computer Book Market, part 4: The Languages - O'Reilly Radar

State of the Computer Book Market, part 4: The Languages : programming

Corporations mainly aim for stability and easily-maintainable codebases, but I think that with
the advent of heterogeneous computing environments, new programming paradigms, and so on, we
should start to see a rapid shift in the programming languages and technologies that are being
used for many applications. Java is clearly the dominant language in the statistics shown
because of its stability and built-in features that make it easy to develop large-scale
applications. But the rapid change in the nature of the hardware on which the code will run
will require a change in the programming models that we use.

    Java is clearly the dominant language in the statistics shown because of....

All this report measures is the efficiency of book publishers at selling books in 
brick and mortar stores. It doesn't measure demand. It doesn't measure use. It's 
highly biased toward the freshness of books, how many were published in a year, and 
how many copies the publisher sales channels and store inventory departments decide to 
shelve.

Drawing any other conclusions (correlations are okay, but they're second order effects 
at best) is foolish.

    It doesn't measure demand

Yes it does. No one would want to write a book which has no hope of selling.

claim: most universities teach java

claim: university students are the most likely group to buy entry level physical books 
about a specific language

Conclusion: There is high demand for Java books.


    Yes it does.

If a book's not on a shelf, Bookscan doesn't measure it. Bookscan tells you what sold. 
It doesn't tell you why. It also doesn't tell you why not.

■_ The art of Prolog

推薦図書/必読書のためのスレッド 67

100 営利利用に関するLR審議中@詳細は自治スレへ [sage] 2012/04/09(月) 05:12:45.47 ID: Be:
    Prologの技芸の翻訳を6000円以下で手に入れる方法は? 

101 営利利用に関するLR審議中@詳細は自治スレへ [sage] 2012/04/09(月) 05:32:44.82 ID: Be:
    自分で翻訳する 

102 営利利用に関するLR審議中@詳細は自治スレへ [sage] 2012/04/09(月) 05:58:47.10 ID: Be:
    復刊リクエストに投票する http://www.fukkan.com/fk/VoteDetail?no=32064

103 営利利用に関するLR審議中@詳細は自治スレへ [sage] 2012/04/09(月) 06:00:21.27 ID: Be:
    >>100
    神保町へGO
    専門書ばかり扱った古本屋もあるから、割と遭遇率高い

104 営利利用に関するLR審議中@詳細は自治スレへ [sage] 2012/04/09(月) 07:08:32.52 ID: Be:
    >>100
    図書館で借りて自分のものにし、定価で弁償する
    税込みだとまぁ90円ほど超えるが気にするな 

原書の新しい版(といっても時期的には結構前だけど)を買ったほうがいいんじゃないかなあ。

■_

2012年04月08日

■_

土日ほぼ寝て潰して(土曜日は近くのコンビニへ東スポを買いに出ただけw)、 なんとか快復した感じ?

コスパ
これもまあカタカタ語かの一例ではあるんでしょうけど、 なんでもかんでもコストパフォーマンス(コスパ)言い過ぎな気がします。 Price/performance ratio - Wikipedia, the free encyclopedia cost performance ratioの意味 - 英和辞典 Weblio辞書

日経流通新聞
図書館にあるかなあ。販売店いっても間に合うかしらん Twitter / @comiccraft: 本日(4/8)の日経MJのトップ面は「稼ぐ書店」へと ... Nikkei Marketing Journal 日経MJ - Wikipedia 日経流通新聞ってコンビニに売ってますか? コンビニにない場合どこに行ったら買え... - Yahoo!知恵袋

で、日曜日の夕方にようやく外に出て Colorful Pieces of Game::ハドソン本出来た のためのイベントのカタログを買い行ったついでにこれも買った Amazon.co.jp: 組み込みソフトへの数理的アプローチ: 形式手法によるソフトウェアの仕様記述と検証 (COMPUTER TECHNOLOGYシリーズ): 藤倉 俊幸: 本 Alloy 使ってるようです。

■_ How I do my Computing

なんかこう、ストールマン語録。という気がしないでも。

How I do my Computing

How I do my computing

で、いくつか気になったものをピックアップ

    I never used Unix (not even for a minute) until after I decided to develop a free replacement
    for it (the GNU system). I chose that design to follow because it was portable and seemed
    fairly clean. I was never a fan of Unix; I had some criticisms of it too. But it was ok
    overall as a model.
  
    Why I coined the name POSIX.
  
    The most powerful programming language is Lisp. If you don't know Lisp (or its variant,
    Scheme), you don't appreciate what a powerful language is. Once you learn Lisp you will see
    what is missing in most other languages.
  

Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012 Richard Stallman

Verbatim copying and distribution of this entire article is permitted in any medium, 
provided this notice is preserved.

■_ FORTRAN→

なんかこう、回答者が重大な見落としをしている気がするんですが

FORTRANプログラムについてお聞きします。 | OKWave


仕事で1970年代にFORTRAN77で作られた技術計算(発電所の熱精算)プログラムを使っています。
(私はプログラムは使っていても、作ったことのない、ほとんど素人です)

このプログラムの規模として、総ステップ数が約60kステップ有ります。

このたび、このプログラムをMATLABに移植することになりました。

移植の理由は、FORTRANそのものが古い言語で、機能拡張などのメンテナンスを依頼しているソ
フト会社には、FORTRANの分かるエンジニアがいなくなったこと、だそうです。

(MATLAB使用は会社の指示です)
そこでお聞きしたいのは以下の点です。
1.FORTRANとは、そんなに古い言語になってしまったのか?
2.MATLABはある精度内で収束するように繰り返し計算するようなプログラムに向いているのか?
3.MATLABのネット記事のほとんどが大学関係者ばかり。企業では使われていないのか?だとしたら、その理由は?
4.MATLABの利点と欠点を述べた記事などがあったら紹介して下さい。

宜しくお願いします。

Copyright © OKWave. All rights reserved.

どんな回答がついているかは元記事を見ていただくとして、 どうも MATLAB 版は質問者自身(か、社内の誰か?)が書くように見受けられるし、さらに 元の FORTRANプログラムがどういったものかもわからないのに (回答に対する返事でちょっと書かれてますが) それと同じ(少なくとも同じ結果を返す)動作するものを作れるのだろうか? ということです。 計算の種類にもよりますが、FORTRANのコード眺めてその意味を把握するのはきつい作業じゃないかと。 仕様書…ないんだろうなあ

そもそも MATLAB 使えってのはどういう経緯で出された「指示」なんだろか。

それと現状このFORTRANプログラムはどういった環境で動かしてるんでしょ?

■_

あとで聴く。「観た」方がいいんだろうけどもごにょごにょ A Means to Many Ends: 10+ Years of Haskell at Galois | Lang.NEXT 2012 | Channel 9 Julia | Lang.NEXT 2012 | Channel 9 C++: A Language for Modern Times | The Knowledge Chamber | Channel 9

■_

■_ 不思議

初心者のためのC#プログラミング本格入門64 - 入力値を網羅したテストの作り方(序論)
  //全演算子をテスト
   char[] signs = new char[] { '+', '-', '*', '/', '%' };

  

「演算子」を収めているテーブルなのになんで「signs」なんだろう…?

■_

これ、shiro さんが IRC (twitter に流れてきたのを見たんですが) で言ってた件だろうか Go: Severe memory problems on 32bit systems : programming Severe memory problems on 32bit Linux - Google グループ だいぶ盛り上がってるんだけど、今読み始めるときついからあとにしよう。

2012年04月07日

■_

買おうかどうしようか悩んでいる本がありまして。 というのもいちまんえんいじょうする(した)からなんですが、 ペーパーバック版が出てたのね。これ。 電書版が一番いいんだけど、この際まあいいや。 Amazon.com: Flexible Pattern Matching in Strings: Practical On-Line Search Algorithms for Texts and Biological Sequences (9780521813075): Gonzalo Navarro, Mathieu Raffinot: Books Amazon.co.jp: Flexible Pattern Matching in Strings: Practical On-Line Search Algorithms for Texts and Biological Sequences: Gonzalo Navarro, Mathieu Raffinot: 洋書

■_ Perl Unicode Cookbook

Editor's note に書かれてることが気になる。 週明けくらい?

Perl Unicode Cookbook: The Standard Preamble - Perl.com

Perl Unicode Cookbook: The Standard Preamble

By Tom Christiansen on April 2, 2012 6:00 AM

Editor's note: Perl guru Tom Christiansen created and maintains a list of 44 recipes for working
with Unicode in Perl 5. Perl.com is pleased to serialize this list over the coming weeks.

℞ 0: Standard preamble

Unless otherwise noted, all examples in this cookbook require this standard preamble to work
correctly, with the #! adjusted to work on your system:

 #!/usr/bin/env perl

 use utf8;      # so literals and identifiers can be in UTF-8
                # リテラルと識別子にUTF-8を使えるように
 use v5.12;     # or later to get "unicode_strings" feature
                # unicode 文字列機能を使えるように
 use strict;    # quote strings, declare variables
                # 文字列はクォートし、変数は宣言するように
 use warnings;  # on by default
 use warnings  qw(FATAL utf8);    # fatalize encoding glitches
                                  # エンコーディングに関する glitches を fatalize
 use open      qw(:std :utf8);    # undeclared streams in UTF-8
                                  # 
 use charnames qw(:full :short);  # unneeded in v5.16
                                  # v5.16 では不要

This does make even Unix programmers binmode your binary streams, or open them with :raw, but
that's the only way to get at them portably anyway.

WARNING: use autodie and use open do not get along with each other.
警告: use autodie と use open を同時に使わないこと
#でいいのかな


This combination of features sets Perl to a known state of Unicode compatibility and strictness,
so that subsequent operations behave as you expect.

■_ Lisp Hackers: Marijn Haverbeke

Lisp Hacker へのいんたびゅー

Lisp, the Universe and Everything: Lisp Hackers: Marijn Haverbeke

What's the most exciting use of Lisp you had?

    I think that'd be CL-JavaScript, a JavaScript-to-Common-Lisp transpiler that I wrote
    together with a friend. It actually handles the whole ECMAScript 3 language and produces
    programs that run reasonably fast—about on par with the 2009 generation of browser
    JavaScript engines. This is quite amazing, given that it's less than 4000 lines of code, at
    least an order of magnitude smaller than those engines. The Lisp compiler handles most of
    the optimization for us. (I should point out that the browser JS engines have a much higher
    speed of compilation, which is a necessity for handling web content.)

What you dislike the most about Lisp?

    I must say that the lack of static typing really gets in the way on larger projects. Being
    able to confidently change datatypes and function signatures, knowing that the compiler will
    point out most inconsistencies that you introduce, is something that I've really come to
    appreciate after working with Rust and Haskell. Test coverage helps, of course, but I'm not
    a very diligent test writer, and tend to feel that type signatures are easier to maintain
    than an exhaustive test suite.

■_ The Heroes of Java: David Blevins

Java の

Enterprise Software Development with Java: The Heroes of Java: David Blevins

You're programming in Java. Why?

I did my first major work in Java on version 1.1.2 and have used it steadily since. The the
evolution of the language has played a major part in keeping it fun and enjoyable for me. But I
have to say I wouldn't still be using Java if tools like Intellij or Eclipse hadn't been
invented, which I view as “structure” editors rather than text editors. They read in and
understand the bytecode and can fundamentally edit logic. You can digest and transform a
massive codebase with ease if you know what you're doing.

The thought of going to another language where this is not possible and you have to deal with a
large program as plain text seems like going back to the stone age.

What's least fun with Java?

I guess it would be that even a small program is still large. Not a serious issue as the
inverse is also true; large programs in Java can be quite small. But there are definitely
problems too small for Java.

If you could change one thing with Java, what would that be?

I've blogged about it, so I guess I should keep my stance that I think 'final' should be the
default and there should be a 'mutable' or some other keyword. In practice it's far rarer to
actually need to re-initialize an already initialized variable. It's too late to make that
change, though.

One thing that isn't too late is I'd love an "import org.acme.Foo as Bar;" syntax. I
hate needlessly long and ugly class names, which I would describe as "preemptively ugly"
for the sake of not conflicting with other classes. If two class names conflict, let me import
them with different names of my choosing that makes my source more readable. Imports are not
represented in bytecode and are little more than syntactic sugar. Making that sugar a bit
sweeter would be great.


Copyright © 2007-2011 by Markus Eisele.. Powered by Blogger.

final なのをデフォルトにして、むしろ変化する(させる)ものに mutable をつけるようにしたい。 というのはほかでも見る意見ですね。

■_ LINQ

一つ一つはわかっても組み合わさるとよくわからんというありがちな問題な気も。

LINQ | OKWave

  var linq1 = from x in TableA select x;
  var linq2 = from x in TableB select x;

  var linq3 = from x in linq1 join y in linq2 on new {Code = x.Code, Number = x.Number} equals new {y.Shohin, y.Code} into tt from z in tt.DefaultIfEmpty() select new{ x, Code = (z == null) ? "" : z.Code ?? ""}


リンクでこんな感じのがでてきたんですがlinq3何やってるか分かる人いないですか?

join into からあとの部分が全体にどう影響するのかがよくわからんちん。

■_

2012年04月06日

■_

ベイスターズがノーノー(ノーヒットノーラン)食らったからではありませんが 夕食後から本格的に体調が悪くなってしまい、 今日はほんと何もやってない状態。

■_

2012年04月05日

■_

鼻水じゅるじゅる。ここにきて花粉症? (のどの痛みはちょっとあるけど、熱はないし咳も出ない)

■_ サビ

【怪奇の事件は】電人ザボーガーVol.4【Σの仕業】

396 どこの誰かは知らないけれど [sage] 2012/04/03(火) 23:29:49.81 ID:FNxwqwLs Be:
    どうでもいいけどOPの「ファイトマシーンがとどろいて」って所にものすごくかっこよさを感じる 

397 どこの誰かは知らないけれど [sage] 2012/04/04(水) 01:28:44.17 ID:3zDU0coE Be:
    OP主題歌はレコードサイズよりTVサイズの歌い回しの方が好きだ。

    「怒りの電流~」の部分、レコードサイズでは「い~かりのでん、りゅう~」だが、
    TVサイズでは「い~かりのでぇ~んりゅう~」となっていて、こっちの方がカッコイイ。 

398 どこの誰かは知らないけれど [] 2012/04/04(水) 09:45:41.30 ID:7VYTIN1F Be:
    >397
    同感。カラオケでもそっちで唄ってる。 

403 どこの誰かは知らないけれど [] 2012/04/04(水) 19:48:08.72 ID:dMQo1i8R Be:
    >>398

    俺は12年前から歌っていたぜ
    って言うかアニソンしか歌わないwww 

404 どこの誰かは知らないけれど [sage] 2012/04/04(水) 20:08:43.04 ID:2kYI9lWP Be:
    >>403
    アニソンって言うなー!! 

406 どこの誰かは知らないけれど [] 2012/04/05(木) 13:44:02.09 ID:ID0hmPrn Be:
    >>397
    俺も。
    他に「ロボット刑事」(OP)「合体!ゲッターロボ」も
    テレビ用の歌い回しが好きだな。
    おっと、全部、菊池俊輔だw


ロボット刑事とゲッターロボはわからんなあ。 tv 版なんて意識して聴かないし(フルコーラス版収録でないと買わなかったり)

■_ 素猫

あとでチェックしよ

GA 芸術科アートデザインクラス 素猫55匹目

342 名無しさん@お腹いっぱい。 [sage] 2012/04/04(水) 11:22:45.29 ID:nVYqX+1R0 Be:
    衛星の8日3時のBS11でやるAnotherの番組説明が素猫になっている。 

■_ 順序

むしろ何かの順に整列されてるのが自然と思うのを不思議に感じる昭和世代。 awk の for 文に始まり、perl の keys/values/each やら FAQ でも良く見たし。 はっ。Ruby 1.9 のあの変更の影響?

連想配列の並び順は保証されない

連想配列の並び順って確か保証されてなかったよなー、でも追加順なのかなと思って調べていたら、下記サイトのブログ記事を見つけました。

C#でHashtableのfor eachの順序
http://blog.mbc-net.com/index.php?itemid=14

この記事では、Hashtableを使っていたところで、Windows 7の64bitの環境になったら不具合が発生したそうです。

Windows XP/Vista 32 bit 環境は、追加された順番
Windows 7 64 bit 環境は、key のアルファベット順

ということで、連想配列の順序は保証されないと思って開発した方がいいみたい。

そういやむかーーーしの gawk (jgawk) で、たまたまあるバージョンでは あるユーザーの期待通りに for (v in 連想配列) で列挙がされていたのが 次のバージョンで変わったのを見てバグだって大騒ぎしてた人がいたなあ。 実はその前のバージョンでもほかのデータで試すと 期待通りに並べちゃいないってのがすぐわかったのだけど。

■_

元の記事はもう5年前ですか。 しかしなんでまた今頃 reddit と Hackers news で話題になったんだろか

Larry Wall: Programming is Hard, Let's Go Scripting... : programming


So, this is from 2007. Five years later, is Perl 6 a thing yet?


Yes, but it's probably not a thing you'd use.


Is there a short explanation of what went/is going wrong? Python 3000 has come and gone. Go
went from a couple of Google engineers goofing off to 1.0. Even C++0x came out. Why is Perl 6
still not ready for prime time?

To make a long story short, the differences between Perl 5 and Perl 6 are orders of magnitudes
bigger than between Python 2 and Python 3k.

Is there some place I can go to read a longer but not too long version of the story?


I would recommend you the Perl 5-to-6 series of blog posts by Moritz Lenz.

There's also plenty of material from three years of advent calendar blogging about Perl 6.

For the more technical details, the Perl 6 specification is still the most current and accurate
out there. We're working on a Perl 6 book for beginners, but it's nowhere near finished yet.

Thanks.


    Why is Perl 6 still not ready for prime time?

    It's an attempt at language revolution, not just evolution.

    It's a deliberate attempt to improve on what's come before rather than blindly adopting
    existing designs just because they're existing and well established designs. 35 years of
    accretion in regex syntax and semantics made a semi-consistent mess of craziness. Fixing
    that design takes time.

    The first implementation capable of giving any sort of realistic feedback started in 2005
    rather than 2000.

    No implementation has been useful or usable enough for any serious use.

    (Seriously biased opinion here) No current implementation makes a priority of addressing #4.

■_

Hackers news での反応

Programming is hard, let's go scripting.. | Hacker News

Perl 6 has very ambitious goals. One aspect of Perl 6 is it pays extreme emphasis on 
sane, safe extensibility. Perl 6 grammars are killer features. For all those people 
who wanted lisp like extensibility inside C kind of a language, Perl 6 will be a 
perfect match.

Given those goals, Perl as a language has a long bright future. Because flexible and 
extensible languages evolve their way out of time.

Compared to all languages in its class, Perl hasn't broken backwards compatibility 
since past 25 years. Python had to break it for some very simple syntax changes. Perl 
has never done it, not even once in past 25 years. That is quite a feat considering so 
much syntax has been added to the language since then. Perl 5 has also found a way to 
add more syntax without dealing with the core by modules like Devel::Declare.

So Perl evolution is set for many years. You will see it evolve grow. New neat ideas 
and many like Moose will find their way into Perl.

Basically what makes it special is its hackable, flexible and extensible. And such 
languages generally stay around for a long time.

As a new programmer, should I wait for Perl 6, or just learn Perl 5, this article 
makes Perl 6 look quite compelling.

5


Thanks!
Programming is not hard. Getting people to buy your product or give you money... that's hard.


Being bad at programming is not hard, anyway.

■_

2012年04月04日

■_

コンパクト
最近、NHK の朝の番組で「~をコンパクトにお伝えします」というのをよく耳にするのですが、 手短に、ざっと、という意味合いで言ってるんだと思うのですけど それは「compact」とは言わないんじゃないかなあと 気にしてしまう今日この頃。 カタカナ書きになった時点で元の単語の意味なんてほぼ無視されるなんてのは良くあることではありますが。

爆弾低気圧 - jarp, 13時半に早くも帰宅命令が出た。 春の大嵐 (ただし今回は帰宅難民化は回避) - ただのにっき(2012-04-03) きっとまた手遅れになってから帰宅指示が出るんだぜ……とか言ってたら、昼休みにまさかの発令。 やっぱ15時は遅いよねえ。>某社

「等幅フォント」の読み方 - 頭ん中 「自分も『とうふく』だと思ってた」という方は挙手をお願いします。

■_

■_

glibcの歴史 - karasuyamatenguの日記 A turning point for GNU libc | Hacker News A turning point for GNU libc [LWN.net]

元記事のコメント欄がなにやら楽しげな事態に

A turning point for GNU libc [LWN.net]

A turning point for GNU libc

Posted Mar 28, 2012 16:13 UTC (Wed) by Cyberax (subscriber, #52523) [Link]
Can we finally get better interface, not limited to POSIX crap?

Can we:
1) Convert between title case/lower case in a specific locale (opened by iconv_open)
2) Convert between UTC and arbitrary timezones without changing a global variable.
3) Get the next/previous DST change instant (and the DST changes history in general) for a specific timezone.

Please?

Posted Mar 28, 2012 16:25 UTC (Wed) by JoeBuck (subscriber, #2330) [Link]

If you want to use strlcpy/strlcat, you already can; you just have to link with a 
different library (libbsd). If your project standards forbid strncat, #define it to 
DONT_USE_strncat_YOU_IDIOT in some widely-included header.


Posted Mar 29, 2012 20:53 UTC (Thu) by cmccabe (subscriber, #60281) [Link]
> While we're at it, could we please get rid of the broken behaviour
> that leading zeros make strings into Octal? This behavior is
> implemented so fundamentally in eg atoi() that many other programming
> languages, even those that do dynamic typing, inherit the bug. If I
> write "064", I generally don't mean "52"!

It's a standard, like the QWERTY keyboard and the English language. Sorry, it's not going anywhere.

> At the same time, can I plead for a "streq()" function, being defined
> as "!strcmp()"

Why don't you define it yourself? It's a one-line function.


Posted Mar 28, 2012 20:43 UTC (Wed) by HelloWorld (subscriber, #56129) [Link]
There *are* better and less error prone alternatives, such as GString from glib. So 
stop whining already.


Posted Mar 29, 2012 16:12 UTC (Thu) by HelloWorld (subscriber, #56129) [Link]
> Saying "just use glib" is cargo cult programming, IMNSHO. Why would I use a 300k SLoC library just for a saner way to copy a string?
Glib provides a hell of a lot more than just a sane (well, sane by C standards) string implementation.

> Some people like coding in plain, vanilla C, especially when our code has to be ported to many different environments.
Well, you don't seem to be one of them, as strlcpy is clearly *not* standard C. Besides, how is
providing strlcpy going to help with portability? Microsofts C implementation doesn't include
it either, so you can't rely on it either way.

> Do my enum-to-human-readable-string mappings need an indefinite buffer?
Of course not, but for that use case, strcpy is perfectly sufficient as the required buffer length is known at compile time.

Posted Mar 30, 2012 22:24 UTC (Fri) by jengelh (subscriber, #33263) [Link]
>Glib provides a hell of a lot more than just a sane (well, sane by C standards) string implementation.

I agree - it has utterly pointless typedefs like gchar (char is standardized by C, you know).
Hiding an indirection (behind gpointer) is not nice either.

いやまあ話題があっちいったりこっちいったり (GPLがどうこうなんてのもあった)。

2012年04月03日

■_

天気
午後半休を取って自主的に風雨避け(雨が強くなった辺りで帰宅できた)。 どうやら15時辺りに帰宅命令が出たらしいのだけどこれもなー

■_ 1.0

4.0.1 がリリースされたのでtar玉を取りに行ったら1.0.1というtar玉を発見 (2.xからしか見たことないような気がする)。 さっそくダウンロードしてみた。

-rw-r--r-- 19/10          6513 1987-06-16 15:41 COPYING
-rw-r--r-- 19/10           968 1987-10-28 07:34 Makefile
-rw-r--r-- 19/10          1283 1987-10-20 07:05 README
-rw-r--r-- 19/10          7362 1987-09-16 03:21 awk.h
-rw-r--r-- 19/10         50624 1987-10-28 07:29 awk.tab.c
-rw-r--r-- 19/10         22689 1987-10-28 07:28 awk.y
-rw-r--r-- 19/10         15748 1987-09-16 03:21 awk1.c
-rw-r--r-- 19/10         27961 1987-10-27 06:37 awk2.c
-rw-r--r-- 19/10         17531 1987-10-20 07:03 awk3.c
-rw-r--r-- 19/10          9327 1987-09-16 03:21 debug.c
-rw-r--r-- 19/10          8267 1987-01-07 03:29 obstack.h
-rw-r--r-- 19/10          6242 1986-12-12 15:43 obstack.c
-rw-r--r-- 19/10          9861 1987-08-05 02:32 regex.h
-rw-r--r-- 19/10         45820 1987-08-05 02:23 regex.c

↓が4.0.1。全部だとさすがに多いのでディレクトリは一番上のレベルのものだけですが 全然違いますね

drwxr-xr-x 1000/1000         0 2012-03-29 05:03 gawk-4.0.1/awklib/
drwxr-xr-x 1000/1000         0 2012-03-29 05:03 gawk-4.0.1/doc/
drwxrwxr-x 1000/1000         0 2012-03-29 05:02 gawk-4.0.1/extension/
drwxrwxr-x 1000/1000         0 2012-03-29 05:02 gawk-4.0.1/m4/
drwxrwxr-x 1000/1000         0 2012-03-29 05:02 gawk-4.0.1/missing_d/
drwxrwxr-x 1000/1000         0 2012-03-29 05:02 gawk-4.0.1/pc/
drwxr-xr-x 1000/1000         0 2012-03-29 05:03 gawk-4.0.1/po/
drwxrwxr-x 1000/1000         0 2012-03-29 05:02 gawk-4.0.1/posix/
drwxrwxr-x 1000/1000         0 2012-03-29 05:02 gawk-4.0.1/README_d/
drwxr-xr-x 1000/1000         0 2012-03-29 05:03 gawk-4.0.1/test/
drwxrwxr-x 1000/1000         0 2012-03-29 05:02 gawk-4.0.1/vms/
-rw-r--r-- 1000/1000     48465 2012-03-29 04:47 gawk-4.0.1/regex_internal.c
-rw-r--r-- 1000/1000     14615 2012-03-29 04:52 gawk-4.0.1/re.c
-rw-r--r-- 1000/1000     30373 2012-03-29 04:47 gawk-4.0.1/profile.c
-rw-r--r-- 1000/1000    113046 2012-03-29 04:47 gawk-4.0.1/regcomp.c
-rw-r--r-- 1000/1000    129593 2012-03-29 04:47 gawk-4.0.1/regexec.c
-rw-rw-r-- 1000/1000     18853 2010-10-31 19:25 gawk-4.0.1/random.c
-rw-r--r-- 1000/1000      4468 2012-03-29 04:47 gawk-4.0.1/NEWS
-rw-r--r-- 1000/1000      1979 2012-03-29 04:47 gawk-4.0.1/FUTURES
-rw-r--r-- 1000/1000     35497 2012-03-29 05:03 gawk-4.0.1/Makefile.in
-rw-r--r-- 1000/1000     34184 2012-03-29 04:47 gawk-4.0.1/getopt.c
-rw-rw-r-- 1000/1000      2233 2011-11-02 05:09 gawk-4.0.1/custom.h
-rwxr-xr-x 1000/1000    358568 2012-03-29 05:03 gawk-4.0.1/configure
-rw-rw-r-- 1000/1000       495 2010-10-31 19:25 gawk-4.0.1/AUTHORS
-rw-r--r-- 1000/1000    137102 2012-03-29 04:54 gawk-4.0.1/debug.c
-rw-r--r-- 1000/1000    239974 2012-03-29 05:03 gawk-4.0.1/awkgram.c
-rw-r--r-- 1000/1000     42738 2012-03-29 04:47 gawk-4.0.1/field.c
-rw-r--r-- 1000/1000      3045 2012-03-29 04:47 gawk-4.0.1/regex.c
-rw-rw-r-- 1000/1000     10098 2010-12-23 04:16 gawk-4.0.1/gettext.h
-rw-r--r-- 1000/1000      2667 2012-03-29 04:52 gawk-4.0.1/mbsupport.h
-rw-r--r-- 1000/1000       968 2012-03-29 04:47 gawk-4.0.1/eval_p.c
-rw-r--r-- 1000/1000      4756 2012-03-29 04:47 gawk-4.0.1/getopt_int.h
-rw-r--r-- 1000/1000       964 2012-03-29 04:47 gawk-4.0.1/eval_d.c
-rw-r--r-- 1000/1000       977 2012-03-29 04:47 gawk-4.0.1/profile_p.c
-rw-r--r-- 1000/1000      3162 2012-03-29 04:47 gawk-4.0.1/msg.c
-rw-r--r-- 1000/1000     93787 2010-12-23 04:09 gawk-4.0.1/ABOUT-NLS
-rw-r--r-- 1000/1000    103888 2012-03-29 05:03 gawk-4.0.1/command.c
-rw-rw-r-- 1000/1000      9416 2010-10-31 19:25 gawk-4.0.1/INSTALL
-rw-r--r-- 1000/1000     22334 2012-03-29 04:47 gawk-4.0.1/regex_internal.h
-rw-rw-r-- 1000/1000    380727 2011-06-23 15:27 gawk-4.0.1/ChangeLog.0
-rw-r--r-- 1000/1000     35237 2012-03-29 05:03 gawk-4.0.1/aclocal.m4
-rw-rw-r-- 1000/1000      1477 2010-10-31 19:25 gawk-4.0.1/random.h
-rw-r--r-- 1000/1000     81756 2012-03-29 04:47 gawk-4.0.1/io.c
-rw-rw-r-- 1000/1000     35147 2010-10-31 19:25 gawk-4.0.1/COPYING
-rw-r--r-- 1000/1000    143726 2012-03-29 04:52 gawk-4.0.1/awkgram.y
-rw-r--r-- 1000/1000     38796 2012-03-29 04:47 gawk-4.0.1/main.c
-rw-r--r-- 1000/1000      5588 2012-03-29 04:47 gawk-4.0.1/cmd.h
-rwxrwxr-x 1000/1000     17574 2010-10-31 19:25 gawk-4.0.1/depcomp
-rw-rw-r-- 1000/1000      1681 2011-04-01 05:38 gawk-4.0.1/POSIX.STD
-rw-rw-r-- 1000/1000      3226 2011-02-27 15:00 gawk-4.0.1/floatcomp.c
-rw-r--r-- 1000/1000     39334 2012-03-29 04:47 gawk-4.0.1/awk.h
-rw-r--r-- 1000/1000     78490 2012-03-29 04:54 gawk-4.0.1/builtin.c
-rw-r--r-- 1000/1000     21458 2012-03-29 04:47 gawk-4.0.1/node.c
-rw-rw-r-- 1000/1000       678 2010-10-31 19:25 gawk-4.0.1/PROBLEMS
-rwxr-xr-x 1000/1000     18442 2010-12-23 04:09 gawk-4.0.1/config.rpath
-rw-r--r-- 1000/1000      3383 2012-03-29 04:47 gawk-4.0.1/README
-rw-r--r-- 1000/1000     66847 2012-03-29 04:54 gawk-4.0.1/eval.c
-rw-r--r-- 1000/1000      6678 2012-03-29 04:47 gawk-4.0.1/getopt.h
-rw-rw-r-- 1000/1000       768 2011-06-23 15:30 gawk-4.0.1/TODO
-rw-r--r-- 1000/1000      5384 2012-03-29 04:47 gawk-4.0.1/Makefile.am
-rw-rw-r-- 1000/1000      9537 2011-11-02 05:09 gawk-4.0.1/xalloc.h
-rwxr-xr-x 1000/1000     44208 2012-03-23 17:22 gawk-4.0.1/config.guess
-rw-r--r-- 1000/1000      2752 2011-12-09 04:12 gawk-4.0.1/replace.c
-rw-r--r-- 1000/1000     38660 2012-03-29 04:53 gawk-4.0.1/command.y
-rwxr-xr-x 1000/1000     32560 2012-03-23 17:22 gawk-4.0.1/config.sub
-rwxr-xr-x 1000/1000     13184 2012-03-23 17:22 gawk-4.0.1/install-sh
-rw-rw-r-- 1000/1000      4353 2011-02-27 15:00 gawk-4.0.1/protos.h
-rw-rw-r-- 1000/1000        70 2011-06-17 17:07 gawk-4.0.1/version.in
-rw-rw-r-- 1000/1000      1879 2010-10-31 19:25 gawk-4.0.1/floatmagic.h
-rwxrwxr-x 1000/1000      3495 2010-10-31 19:25 gawk-4.0.1/mkinstalldirs
-rw-r--r-- 1000/1000      7416 2012-03-29 04:52 gawk-4.0.1/ext.c
-rw-r--r-- 1000/1000        67 2012-03-29 05:03 gawk-4.0.1/version.c
-rw-r--r-- 1000/1000     85116 2011-04-24 21:38 gawk-4.0.1/NEWS.0
-rw-r--r-- 1000/1000      4523 2012-03-29 04:47 gawk-4.0.1/dfa.h
-rw-r--r-- 1000/1000      4770 2012-03-29 04:47 gawk-4.0.1/getopt1.c
-rwxrwxr-x 1000/1000     11135 2010-10-31 19:25 gawk-4.0.1/missing
-rw-r--r-- 1000/1000     12874 2012-03-29 05:03 gawk-4.0.1/configh.in
-rw-r--r-- 1000/1000     22221 2012-03-29 04:47 gawk-4.0.1/regex.h
-rw-r--r-- 1000/1000      9528 2012-03-29 05:01 gawk-4.0.1/configure.ac
-rw-rw-r-- 1000/1000       891 2010-10-31 19:25 gawk-4.0.1/LIMITATIONS
-rw-rw-r-- 1000/1000      1657 2011-02-27 15:00 gawk-4.0.1/gawkmisc.c
-rw-r--r-- 1000/1000     44882 2012-03-29 04:47 gawk-4.0.1/array.c
-rw-r--r-- 1000/1000    125019 2012-03-29 04:47 gawk-4.0.1/dfa.c
-rw-r--r-- 1000/1000     15590 2012-03-29 05:02 gawk-4.0.1/ChangeLog
-rw-rw-r-- 1000/1000      6193 2010-10-31 19:25 gawk-4.0.1/ylwrap
-rw-rw-r-- 1000/1000      1216 2010-10-31 19:25 gawk-4.0.1/bisonfix.awk

obstack っていつまで使ってたんだろ

■_

■_

寒気がするのでとっとと寝ます ○| ̄|_

2012年04月02日

■_

もうすぐ。 Amazon.co.jp: Scipy and Numpy: An Overview for Developers: Eli Bressert: 洋書 発売日: 2012/4/22 あれ、RSSで見たときは4/3だったと思うのだけど

■_ Scalaの真実

Truth about Scala | Cake Solutions Team Blog

Truth about Scala
March 1, 2012 by Jan Machacek	

And so it came to pass that the daughters and sons of Maderakka made a statically typed,
object-functional language. A language that was so complex that no programmer could possibly
comprehend it. A type constructor of Towers of Babel.

As mere programmers try to learn and use the language, they pass through 7 stages; each with
more and more putrid cake, left by Jambe-akka, who welcomes those who reach the last stage.
Follow the terrifying journey with us and be sore afraid!

1: Bait

The project includes three Scala classes; compiler runs swiftly, IDE obediently suggests
syntactically correct completions. The programmers embrace the concept of polyglot application
tous ensemble.

The number of Maven dependencies: 5; build time 12 s.

略


■_ ポイントフリー

ポイントフリーの利点を教えて欲しいというお悩み 'Point-Free style: What is it good for?' - OJ's rants

Point-Free Style: What Is It Good For? : programming

This doesn't seem to cover what I see as the main advantage of point-free: less variables means
less possibility for mistakes. Let's take a simple (if artificial) example: you want to take a
list of numbers, keep the positive ones, double them and sort them. Here's the code in
non-point-free style:

  f :: [Int] -> [Int]
  f xs = let ys = filter (> 0) xs
             zs = map (*2) ys
             rs = sort zs
         in rs

That does what you want, and all the variables are nicely spelled out. But xs, ys, zs and rs
all have exactly the same type, meaning you are free to typo any of them and the code will still
compile (but won't work right). You can even, in Haskell, use the result of a "later"
function and the compiler is fine with that. So this is fine by the compiler:

  f :: [Int] -> [Int]
  f xs = let ys = filter (> 0) xs
             zs = map (*2) rs
             rs = sort ys
         in rs

Spot the difference! In general, we don't want code to be that fragile. Point-free eliminates
the variables, and thus eliminates this mistake:

  f :: [Int] -> [Int]
  f = sort . map (*2) . filter (> 0)

Once you know how to read the order (back-to-front), it's incredibly clear what the code is
doing, and the ordering can be quickly checked for mistakes, unlike the version with variables.



You can write:

  f xs = sort $ map (*2) $ filter (> 0) xs

And avoid the errors you mention. Here it is mostly function composition that reduces 
the number of variables not point free style. But sure,

  f = sort . map (*2) . filter (> 0)

looks cleaner and more idiomatic. But that's not always the case.

議論はこの後もけっこう続いています

■_

Scala勉強会( #rpscala )の渋谷やめます - scalaとか・・・

一度は行こうと思ってたんですが(いまさら

こういうのは無理して続けるものではないですよね。 お疲れさま(でいいのだろうか)

■_

2012年04月01日

■_

参加してきました Tokyo.Lang.R #1 : ATND

今回は更新が早い。が、読むのは明日。 泳ぐやる夫シアター やる夫で学ぶ第一次世界大戦  第二十七夜「ブレスト・リトフスク条約」

■_ Lisp Hackers: Christophe Rhodes

半月ほど前の記事ですが。

Lisp, the Universe and Everything: Lisp Hackers: Christophe Rhodes

Lisp, the Universe and Everything

2012-03-26
Lisp Hackers: Christophe Rhodes

Next in our series of interviews with inspiring lispers is a conversation with SBCL's principal
maintainer Christophe Rhodes. He was among the first two people to join the project, after it
was solely developed for more than a year by William Newman. And he is, probably, the most
"stable" contributor, still remaining very active in the community, after more than a
decade. What fascinates me personally about him, is the aura of a profoundly creative mind,
fiddling with reality in interesting and unexpected ways.

What brought you to Lisp? What holds you?

    Two seminal moments on my road to Lisp: the first was, as an undergraduate, getting a job
    in the summer of 1997 to work on simulating fluid dynamics in the context of galaxy
    formation, to assist in trying to understand how the spiral arm structures form. I'd being
    told "here is K&R, here is USENET, here is XEmacs, here is Tcl; in five weeks let's
    see what you've come up with" — I distinctly remember reading comp.lang.lisp and a
    "Lisp is slow" thread, with active participants combating the troll with disassembly.

    The second, a few years later, was wandering into the #lisp IRC channel on openprojects, to
    find an almost-empty channel, about 10-20 participants; one of whom was there twice (dan_b
    and dan`b), using the channel to paste bits of alpha assembly between his laptop and his
    desktop, in his efforts to get SBCL on alpha working.

    As for what keeps me, well, when what I have to do is solve problems that no language has
    built-in libraries for (scalable audio similarity detection, say, or musical structure
    inference) then I want to be working in a language where I can focus on the problem itself,
    rather than the detail of that language — and for me, Lisp permits that kind of separation
    of concerns, given its easy support for DSL and embedded language generation, protocols,
    and the ability to run partial programs.

■_

■_ unless

unless の条件で複雑なものを書くなって Perl のえらいひとがいってた。

■_

Kotlin M1 Candidate | Project Kotlin


一つ前へ 2012年3月(下旬)
一つ後へ 2012年4月(中旬)

ホームへ


リンクはご自由にどうぞ

メールの宛先はこちらkbk AT kt DOT rim DOT or DOT jp