3
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

L言語でHello, World!を書いてみる

Last updated at Posted at 2025-12-10

以下のソースコードがL言語のHello, Worldです。

print{ "Hello, world!\n"}

L言語はC言語のような構文でありながら高階関数やポリモーフィズムなどの先進的な機能を備えた言語です。
近代的な言語にある多くの機能が実装されている一方で、L言語独自の尖った機能もあまりないような印象です。

個人的には静的な型推論機能が面白かったので紹介します。既に型推論機能がついた静的言語を使ったことのある方にとっては当たり前に見える機能ですが、個人開発の言語でこの機能がついているのは珍しいため紹介します。

def applyn( f, n, x) = 
  if( n == 0) x
  else f( applyn( f,n-1, x))

applyn( 3, { _ + 2 }, 10) // => Type error: expected t -> t, got Int
applyn( { _ + 2 }, 3, 10) // => 16
applyn( { _ * 2 }, 10., 3) // => Type error: exected Int, got Float
applyn( { _ * 2 }, 3, 10.) // => 80.

参考: https://l-lang.org/documentation/intro/long/

3
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?