Hatena::Groupocaml-nagoya

Happy OCaml!!

2009-09-27

_xを使えば、unused variable警告を抑制できるよ

| はてなブックマーク - _xを使えば、unused variable警告を抑制できるよ - Happy OCaml!!

みなさん、コンパイルするときに"-w A -warn-error A"つけてますか? わりと適切な警告がでて便利ですよ。

例えば、こんなコード書くと警告してくれます。

# let f x = ();;
Warning Z: unused variable x.
val f : 'a -> unit = <fun>

うん、うん、xを使ってないことを教えてくれたんだね、ありがとう。

で、普段はなんの問題もないんだけど、コードを自動生成したときとかは、この警告がうざいこともある。

そんなときは、先頭に_をつければ、警告を抑制できるよ。

# let f _x = ();;
val f : 'a -> unit = <fun>

ワイルドカード・パターン(_)とは違うから、ちゃんと変数を使うこともできる。

# let f _x = _x +1;;
val f : int -> int = <fun>

JeffJeff2012/04/10 00:02Deep thought! Thanks for contbriutnig.

suhixtsuhixt2012/04/11 03:54BSueQK , [url=http://julmwqvgqxbd.com/]julmwqvgqxbd[/url], [link=http://ojovhfygosjw.com/]ojovhfygosjw[/link], http://ebsqzkhxclfi.com/

pyaavdpyaavd2012/04/14 00:411XqumQ , [url=http://vinxudtgwvnq.com/]vinxudtgwvnq[/url], [link=http://prbmlajygpsu.com/]prbmlajygpsu[/link], http://udmahctyaqoo.com/

MatSaloMatSalo2018/06/12 11:43Medicament Generique Du Viagra Cialis Original Comprar <a href=http://cialicheap.com>generic 5mg cialis best price</a> Low Cost Sildenfil Citrate

MatSaloMatSalo2018/08/26 02:39Priligy Dapoxetina Precio <a href=http://ciali5mg.com>cheapest cialis</a> Acheter Kamagra Medicament Topimax Without A Prescription Canada

JospehunumbJospehunumb2019/02/02 02:51generic cialis no prescription mastercard
cialis negative reviews
cialise
www.cialiscanada.ca

cost of cialis in mexico
cialis billig
cialis online lloyds
cialis and canadian pharmacy
https://stowe365.com/#Buy-Cialis

WilliamhannaWilliamhanna2019/02/02 09:54sildenafil vs cialis
generic cialis with mastercard
<a href=https://greatwinesgrandhouses.com>Cialis 20 mg</a>
buy cialis with discover card
20 mg cialis reviews
https://kellyannehulme.com
does cialis require a prescription in canada
average cost of cialis daily use
<a href=https://kellyannehulme.com>cialis</a>
female cialis 20mg
best place to buy cialis online yahoo
https://kellyannehulme.com

WilliamhannaWilliamhanna2019/02/02 09:55cialis softgel
buy cialis soft fast shipping
<a href=https://greatwinesgrandhouses.com>Cialis 20 mg cheap price</a>
buy cialis online melbourne
buy cialis over the counter
https://greatwinesgrandhouses.com
free samples of cialis sold in the usa
us made cialis
<a href=https://greatwinesgrandhouses.com>buy Cialis 20 mg</a>
cost of cialis in manitoba
cialis online offer
https://kellyannehulme.com

WilliamhannaWilliamhanna2019/02/02 09:56best online cialis site
best cialis online
<a href=https://greatwinesgrandhouses.com>cialis</a>
order cialis pills
wholesale cialis
https://kellyannehulme.com
phone number for cialis
cialis mit ec karte kaufen
<a href=https://greatwinesgrandhouses.com>20 mg cialis buy</a>
cialis cialis cialis
cialis drug
https://kellyannehulme.com

ArnoldPoumnArnoldPoumn2019/02/05 17:59sudafed and cialis
buy cialis canada yahoo answers
<a href="http://xcialisxx.com">Buy Cialis Online</a>
vendita cialis originale on line
original cialis price
<a href="http://cialisfurr.com">Buy Cheap Cialis Online</a>
low cost daily cialis
cialis tyskland
<a href="http://cialistlm.com">Buy Cheap Cialis Online</a>

ArnoldPoumnArnoldPoumn2019/02/05 18:00cialis 10mg online bestellen
cialis for bph reviews
<a href="http://xcialisxx.com">buy cialis</a>
cialis online without rx
best price cialis canadian pharmacy
<a href="http://cialistlm.com">Cheap Cialis buy</a>
buy cialis 10mg australia
generic cialis from usa
<a href="http://xcialisxx.com">Buy Cheap Cialis Online</a>

ArnoldPoumnArnoldPoumn2019/02/05 18:01cialis sales rayh health care
generic cialis t20
<a href="http://cialistlm.com">Buy Cheap Cialis</a>
cialis probe kostenlos
best online store for cialis
<a href="http://cialistlm.com">buy cialis</a>
cost of cialis in singapore
cialis direct mexico
<a href="http://cialistlm.com">Cheap Cialis buy</a>

olaestixmaolaestixma2019/02/21 02:13**97653985320493959 <a href="http://lookevision.org/forums/topic/ciprofloxacin-500mg-sale">ciprofloxacin 500mg sale</a> 52220652415 &&

rlaestzwywrlaestzwyw2019/03/01 19:05**979921487521531195 <a href="http://lookevision.org/forums/topic/ciprofloxacin-500mg-sale">ciprofloxacin 500mg sale</a> 864614944549 &&

hlaestovauhlaestovau2019/03/01 22:06**8689306979059675 <a href="http://lookevision.org/forums/topic/ciprofloxacin-500mg-sale">ciprofloxacin 500mg sale</a> 42374970151 &&

alaestgfxfalaestgfxf2019/03/02 04:12**3885240392522901 <a href="http://lookevision.org/forums/topic/ciprofloxacin-500mg-sale">ciprofloxacin 500mg sale</a> 288812492 &&

nlaestsurjnlaestsurj2019/03/09 15:23**529825672203937275 <a href="http://lookevision.org/forums/topic/ciprofloxacin-500mg-sale">ciprofloxacin 500mg sale</a> 916244444295 &&

plaestttnbplaestttnb2019/03/09 18:06**625746774444809791 <a href="http://lookevision.org/forums/topic/ciprofloxacin-500mg-sale">ciprofloxacin 500mg sale</a> 118292260967 &&

alaestrclxalaestrclx2019/03/09 20:31**904448965867347 <a href="http://lookevision.org/forums/topic/ciprofloxacin-500mg-sale">ciprofloxacin 500mg sale</a> 37917752543 &&

zlaestxobuzlaestxobu2019/03/09 22:53**249793121367654917 <a href="http://lookevision.org/forums/topic/ciprofloxacin-500mg-sale">ciprofloxacin 500mg sale</a> 219154676380 &&

LesSanyLesSany2019/05/11 07:40Cialis Dailey Drugs From Canada Kamagra In Deutschland Viagra 100 <a href=http://dan5325.com>viagra</a> Female Indian Viagra Tablets Venta De Cialis Professional Viagra Occhi Rossi

MatSaloMatSalo2019/05/13 06:36How To Buy Acticin Acheter Levitra Sur Le Net Discount Tadalafil Tablets <a href=http://vhsfp.com>viagra</a> Viagra Prezzo Migliore

BbokgoaNEEWSBbokgoaNEEWS2019/05/20 03:57Concomitant administration of strong CYP3A inducers is expected to substantially decrease plasma concentrations of sildenafil. <a href="https://viagraoktobuy.com/">buy female viagra pills near me</a> The overall MI rate for double-blind and open-label sildenafil citrate-treated patients was 0.58/100 PY.

JerryCourbJerryCourb2019/05/23 01:24http://erectiledysfunctionpillsest.com
is erectile dysfunction a chronic disease
<a href=http://erectiledysfunctionpillsest.com/>erectile dysfunction medications</a>
best erectile dysfunction treatment
<a href="http://erectiledysfunctionpillsest.com/">ed drugs generic</a>

LesSanyLesSany2019/08/21 03:06Best Buy Progesterone With Free Shipping With Doctor Consult <a href=http://cialonlineno.com>п»їcialis</a> Doxycycline 100mg Canada Viagra Dopo L'Eiaculazione

LesSanyLesSany2019/08/23 01:14Comprare Viagra Thailandia <a href=http://drugs2k.net>cialis 5mg best price</a> Efficienza Propecia Sildenafil Citrate For Sale

2009-09-02

SnowLeopardでOCamlは動くよ。しかも64bitで

| はてなブックマーク - SnowLeopardでOCamlは動くよ。しかも64bitで - Happy OCaml!!

生協にジュースを買いに行ったら、なぜかSnowLeopardを買ってしまいました。

とりあえず最新のMacPortsを入れてport install ocamlをしたら、あっさりocamlがインストールできました。

しかも64bitでビルドされていました。

$ ocaml
        Objective Caml version 3.11.1

# Sys.word_size;;
- : int = 64

f:id:mzp:20090902203631p:image

これで、31bitのintに苦しめられることもありません。やったね!

MafrapaMafrapa2012/04/15 00:41I spupsoe that sounds and smells just about right.

jfbmokdjewjfbmokdjew2012/04/16 20:16XHXo3s , [url=http://nnqycehppvhh.com/]nnqycehppvhh[/url], [link=http://gglviieziarp.com/]gglviieziarp[/link], http://gfpfgeltcirt.com/

2009-08-02

Macでxml-lightを使おう

| はてなブックマーク - Macでxml-lightを使おう - Happy OCaml!!

xml-light便利ですよね。厳密なスキーマのチェックとかが要らなくて、とりあえずXMLを扱いたいときとかにぴったり。

でもMacPortsxml-lightをインストールしても、ocamlfindから見えなくて結構不便です。

なんとかしましょう。

何が問題なの?

# xml-lightをインストールした!
$ sudo port install xml-light
....
# でもocamlfindからは見えない><
$ ocamlfind list | grep xml-light

なぜocamlfindから見えないかというと、xml-lightのMakefileがocamlfindに対応していないからです。

ここで解決方法は2つあります。

  1. 自分でxml-lightをビルドする
  2. ボクの作ったPortfileを使う

方法1:自分でxml-lightをビルドする

普通にビルドする。うっかりmake installしちゃわないように注意してください。

$ wget http://tech.motion-twin.com/zip/xml-light-2.2.zip
$ unzip xml-light-2.2.zip
$ cd xml-light
$ make all
$ make opt

適当にMETAファイルを作ってやる。ボクは以下の内容をMETAというファイルに保存して使ってます。

name="xml-light"
version="2.2"
description="minimal XML parser & printer"
requires=""
archive(byte) = "xml-light.cma"
archive(native) = "xml-light.cmxa"

ocamlfindを使ってインストールする。

$ vi META
# 上記の内容を保存する
....

$ ocamlfind install xml-light META xml-light.a xml-light.cma xml-light.cmxa *.cmo *.cmi *.cmx *.cmx"

これでocamlfindから使えるようになりました。

$ ocamlfind list | grep xml-light
xml-light           (version: 2.2)

方法2: ボクの作ったPortfileを使う

上で書いた内容をやってくれるPortfileを作りました。

port installするだけでxml-lightをインストールできます。

$ wget http://howdyworld.org/patches/Portfile
$ sudo port install
$ ocamlfind list | grep xml-light
xml-light           (version: 2.2)
Portfile

念のためPortfileの中身をここにも貼っておきますね。META.zipは、上記のMETAファイルをzipで圧縮しただけのファイルです。

続きを読む

propellapropella2009/08/08 08:32書いてある通りにしたら上手く行きました。ありがとうございます!

2009-07-05

imenu.elで、関数定義にジャンプ

| はてなブックマーク - imenu.elで、関数定義にジャンプ - Happy OCaml!!

f:id:mzp:20090705192713p:image

imenu.elを使うと、バッファ内の関数定義一覧を出して、そこにジャンプすることができるよ。TAGSと違って、ファイルの更新が不要だから、お手軽だよ。

インストール方法

imenu.el の使い方と応用 — ありえるえりあ を参考に、imenu.elとanything.elを設定する。

tuareg-imenu.elからtuareg-imenu.elをダウンロードして、load-pathの通ってるディレクトリに置く。

.emacsに設定を追加する。

(autoload 'tuareg-imenu-set-imenu "tuareg-imenu" "Configuration of imenu for tuareg" t)
(add-hook 'tuareg-mode-hook
	  (lambda ()
	    (tuareg-imenu-set-imenu))

omakeをインストールしよう

| はてなブックマーク - omakeをインストールしよう - Happy OCaml!!

MacPortsomakeをインストールしようとすると、 omakeがインストールできない - fu7mu4’s diaryって怒られてしまいます。

OCaml3.11でomakeをビルドすると、発生するらしいです。

そんなときは慌てず騒がず、/opt/local/src/exec/omake_exec.mlからsyncをコメントアウトしましょう。

(* external sync : unit -> unit = "caml_sync" *)

パッチが、もうでてるんで、そのうち直るでしょう。

LenLen2012/04/15 03:12Articles like this just make me want to visit your wesbite even more.

xkfedqyptxkfedqypt2012/04/15 13:00Q7HOHE <a href="http://bnqleelrubpe.com/">bnqleelrubpe</a>

AagibpaggiptAagibpaggipt2018/04/09 18:00 This condition is very limited by the reproductive system and can have several causes like a result of injury or abnormal blood circulation within the testicles. He is content, along with the the complete opposite of what we think old age has in store for us.
https://www.cialissansordonnancefr24.com/sildenafil-et-cialis/

AHauhsoychoabsAHauhsoychoabs2018/06/30 23:30Pression arterielle est comment calleux votre sang pousse contre les parois de vos arteres lorsque votre coeur essence pompe le sang. Arteres sont les tubes qui transportent perseverent b gerer offre sang loin de votre coeur. Chaque temps votre coeur bat, il pompe le sang tout au long vos arteres a la flanerie de votre corps.
https://www.cialispascherfr24.com/cialis-douleurs-jambes/

AlbertSoomoAlbertSoomo2018/09/07 20:28The prostate is an essential part of a male's reproductive system. It secretes fluids that assist the transportation and activation of sperm. The prostate can be found just as you're watching rectum, below the bladder and around the urethra. When there is prostate problem, it will always be very uncomfortable and inconvenient for your patient as his urinary product is directly affected.

The common prostate health problems are prostate infection, enlarged prostate and cancer of prostate.



Prostate infection, also referred to as prostatitis, is easily the most common prostate-related problem in men younger than 55 yrs . old. Infections with the prostate gland are classified into four types - acute bacterial prostatitis, chronic bacterial prostatitis, chronic abacterial prostatitis and prosttodynia.

Acute bacterial prostatitis may be the least common of forms of prostate infection. It is due to bacteria located in the large intestines or urinary tract. Patients may experience fever, chills, body aches, back pains and urination problems. This condition is treated by using antibiotics or non-steroid anti-inflammatory drugs (NSAIDs) to ease the swelling.

Chronic bacterial prostatitis is often a condition associated with a particular defect within the gland along with the persistence presence of bacteria within the urinary tract. It can be caused by trauma towards the urinary tract or by infections via other areas from the body. A patient may experience testicular pain, small of the back pains and urination problems. Although it is uncommon, it may be treated by removal of the prostate defect as well as the utilization antibiotics and NSAIDs to treat the soreness.

Non-bacterial prostatitis is the reason for approximately 90% of all prostatitis cases; however, researchers have not even to ascertain the causes of these conditions. Some researchers believe that chronic non-bacterial prostatitis occur because of unknown infectious agents while other think that intensive exercise and heavy lifting may cause these infections.

Maintaining a Healthy Prostate

To prevent prostate diseases, an effective diet is important. These are some of the actions you can take to keep your prostate healthy.

1. Drink sufficient water. Proper hydration is necessary for health and wellness and will also also keep your urinary track clean.

2. Some studies claim that a few ejaculations each week will prevent cancer of the prostate.

3. Eat steak without excess. It has been shown that consuming a lot more than four meals of beef every week will heighten the probability of prostate diseases and cancer.

4. Maintain a proper diet with cereals, vegetable and fruits to make certain sufficient intake of nutrients essential for prostate health.

The most significant measure to take to ensure a proper prostate is always to opt for regular prostate health screening. If you are forty years of age and above, you need to go for prostate examination one or more times 12 months.

AodosseinsurneAodosseinsurne2018/09/28 15:01Pression arterielle est comment calleux votre sang pousse contre les parois de vos arteres lorsque votre coeur determination pompe le sang. Arteres sont les tubes qui transportent perseverent b gerer offre sang loin de votre coeur. Chaque temps votre manque de sensibilite bat, il pompe le sang a tous egards vos arteres a la reste de votre corps.
https://www.cialispascherfr24.com/ou-acheter-du-tadalafil/

AodosseinsurneAodosseinsurne2018/10/13 00:23 Torsion bras de quelqu'un est comment calleux votre sang pousse contre les parois de vos arteres lorsque votre coeur determination pompe le sang. Arteres sont les tubes qui transportent prendre offre sang loin de votre coeur. Chaque set votre moelle bat, il pompe le sang par de vos arteres a la vacances de votre corps.
https://www.cialispascherfr24.com/tadalafil-pour-femme-noire/

WilliamhannaWilliamhanna2019/02/02 12:49cialis colombia
cialis priligy
<a href=https://greatwinesgrandhouses.com>cialis</a>
cialis professional does it work
cheap generic female cialis
https://greatwinesgrandhouses.com
costco pharmacy cialis cost
cialis without a doctor's prescription
<a href=https://kellyannehulme.com>20 mg cialis buy</a>
take 2 cialis pills
what is the average price of cialis
https://greatwinesgrandhouses.com

WilliamhannaWilliamhanna2019/02/02 12:50what is the price of cialis in canada
cialis fara reteta
<a href=https://greatwinesgrandhouses.com>Cialis 20 mg cheap price</a>
generic cialis cipla
cialis actors
https://kellyannehulme.com
genuine cialis online shopping
cialis paiement par cheque
<a href=https://kellyannehulme.com>buy Cialis 20 mg</a>
cheap procialis
order cialis black
https://kellyannehulme.com

ArnoldPoumnArnoldPoumn2019/02/05 23:08cialis international shipping
free bonus cialis
<a href="http://cialistlm.com">Buy Cheap Cialis</a>
bijwerkingen cialis
cheap cialis canada pharmacy
<a href="http://cialisfurr.com">Buy Cheap Cialis Online</a>
cialis quotidien meilleur prix
cialis 10mg prix
<a href="http://xcialisxx.com">buy cialis</a>

ArnoldPoumnArnoldPoumn2019/02/05 23:09buy cialis with priligy
cialis generika indien
<a href="http://xcialisxx.com">Buy Cialis Online</a>
cost of cialis daily dose
cialis online from us pharmacy
<a href="http://cialistlm.com">Buy Cheap Cialis Online</a>
cheap cialis professional online
cialis sales online canada
<a href="http://xcialisxx.com">Buy Cheap Cialis Online</a>

EllbonastEllbonast2019/03/10 08:40Bactrim And Zithromax Drug Shelf Life Of Cephalexin Estrofem No Prescription Australia <a href=http://cthosts.net>cheap cialis</a> Priligy Sicher Kaufen Prix Xenical 120 Trigliceridos Propecia

EllbonastEllbonast2019/04/09 23:30Non Prescription India Pharmacy Finasteride For Sale Internet <a href=http://bakgol.com>achat de viagra france</a> Online Pharmacy No Dr Prescriptions Online Pharmacies Without Scripts Propecia 98 Stuck

LesSanyLesSany2019/08/16 10:11Amoxicillin And Diarrhea <a href=http://curerxfor.com>viagra</a> Viagra Rezeptfrei Osterreich

StevstomStevstom2019/08/25 06:38No Perscription Wellbutrin <a href=http://cpsmeds.com>cialis</a> Need Direct Amoxicilina Canada Cheapeast Cash On Delivery Propecia Merck Bentyl In Internet

2009-03-11

ocamloptでユニバーサルバイナリが作りたい

| はてなブックマーク - ocamloptでユニバーサルバイナリが作りたい - Happy OCaml!!

何が問題なの?

ocamloptで実行ファイルを作っても、単一のアーキテクチャでしか動かない><。

$ ocamlopt hello.ml -o hello
$ file hello
hello-i386: Mach-O executable i386

"-ccopt"で-archを複数指定してやればいいと思いきや、それでもうまく動かない><。

$ ocamlopt -ccopt "-arch i386 -arch ppc" hello.ml
ld warning: in /var/folders/ER/ERpTAvKHGAeST-apMbQus++++TI/-Tmp-/camlstartup73a88f.o, file is not of required architecture
ld warning: in /opt/manual/ocaml-spot/lib/ocaml/std_exit.o, file is not of required architecture
ld warning: in hello.o, file is not of required architecture
ld warning: in /opt/manual/ocaml-spot/lib/ocaml/stdlib.a, file is not of required architecture
ld warning: in /opt/manual/ocaml-spot/lib/ocaml/libasmrun.a, file is not of required architecture
Undefined symbols for architecture ppc:
  "_main", referenced from:
      start in crt1.10.5.o
ld: symbol(s) not found for architecture ppc
collect2: ld returned 1 exit status
lipo: can't open input file: /var/folders/ER/ERpTAvKHGAeST-apMbQus++++TI/-Tmp-//ccwCVSY5.out (No such file or directory)
File "caml_startup", line 1, characters 0-1:
Error: Error during linking

で、どうすればいいの?

  1. Re: [Caml-list] Re: Building a universal binary on OS X?を参考にして、PPC用ocamloptとi386用ocamloptを作ってやる
  2. PPC用とi386用のバイナリをコンパイルする
  3. lipoで結合する

手順

PPC用のOCamlをビルドする。

$ ./configure -cc "gcc -mmacosx-version-min=10.4 -arch ppc -isysroot /Developer/SDKs/MacOSX10.4u.sdk" -prefix /opt/ppc -host powerpc-apple-darwin8.11.0
$ make world
$ make opt
$ sudo make install

いったんcleanする。

$ make clean

i386用のOCamlをインストールする。

$ ./configure -cc "gcc -mmacosx-version-min=10.4 -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk" -prefix /opt/i386
$ make world
$ make opt
$ sudo make install

じゃあ、コンパイルしてみよう。

$ /opt/ppc/bin/ocamlopt -o hello-ppc hello.ml
$ /opt/i386/bin/ocamlopt -o hello-i386 hello.ml
$ lipo -create -output hello -arch ppc hello-ppc -arch i386 hello-i386
$ file hello
hello: Mach-O universal binary with 2 architectures
hello (for architecture ppc):   Mach-O executable ppc
hello (for architecture i386):  Mach-O executable i386

やった! できた!!

ついでだから、ocamlopt-pccみたいなシンボリックリンクを作っておくと便利だよ!

謝辞

@banjunにいろいろ教えてもらいました。ありがとう!

PradeepPradeep2012/07/08 21:08Weeeee, what a quick and easy slotouin.

lollugklollugk2012/07/10 02:21AJTAt6 , [url=http://otgfehdhfbzi.com/]otgfehdhfbzi[/url], [link=http://njpgyhjylsno.com/]njpgyhjylsno[/link], http://mhptlaemahff.com/

rezmbzyrezmbzy2012/07/11 02:01Ew6S95 <a href="http://czvhptympwka.com/">czvhptympwka</a>

ihtejkihtejk2012/07/11 05:391V0aPO , [url=http://chexpyesofal.com/]chexpyesofal[/url], [link=http://rejdptzqbmvw.com/]rejdptzqbmvw[/link], http://holgbxjkkwom.com/

quianbyxppquianbyxpp2014/03/18 17:16krcowpdbnm.obhpzb, <a href="http://www.wiiijrioxz.com/">qfcldeaozd</a> , [url=http://www.wqgllhygxa.com/]cjmurdgrdm[/url], http://www.teflvcdhpj.com/ qfcldeaozd