(Idris version 0.9.7) でテストされています
$ idris a.idr --target javascript -o hello.js
$ node hello.js
hello world| # coding: utf8 | |
| from sys import stdout, stdin | |
| class IO(object): | |
| pass | |
| class Return(IO): | |
| def __init__(self, x): |
(Idris version 0.9.7) でテストされています
$ idris a.idr --target javascript -o hello.js
$ node hello.js
hello world| #include <string> | |
| #include <iostream> | |
| template <unsigned long N> | |
| struct fizzbuzz | |
| { | |
| static void run() | |
| { | |
| fizzbuzz<N-1>::run(); |
| {-# LANGUAGE TemplateHaskell #-} | |
| import Control.Lens | |
| -- 基本となるオブジェクト | |
| data Obj = Obj { | |
| _pos :: Int | |
| } deriving (Show) | |
| -- Obj型のオブジェクトをもつ抽象的なクラスHasObjを作る | |
| makeClassy ''Obj |
| class Symbol | |
| def -@ | |
| { self => true } | |
| end | |
| end | |
| require "json" | |
| p JSON.parse '{"x":42}' # => {"x"=>42} |
| struct T { | |
| T& self; | |
| public: | |
| T() : self(*this) {}; | |
| }; |
| module Let | |
| def let(*args, &block) | |
| raise ArgumentError, "%s: expected an even number, got %d." % [__method__, args.size] unless args.size.even? | |
| args.each_with_index.each_slice(2) do |(x,i),(y,j)| | |
| raise ArgumentError, "%s: expected an symbol, got %s (pos %d)" % [__method__, x.inspect, i] if not x.respond_to? :to_sym | |
| end | |
| a = self.clone |
| 組み合わせ論理の体系 CLw を定義します。 | |
| 基本記号, 表現, 出現 | |
| ================================================================================ | |
| CLw の基本記号は加算個の変数 `u0', `u1', `u2', ... と | |
| `K', `S' を含む定数記号と カッコ `(', `)' です。 | |
| 記号(*)の有限列や記号をある形に配置したもののことを表現といいます。 | |
| その現れる場所も含めて記号を指定するとき、出現という言葉を使います。 |
| def defmodule(name, &block) | |
| mod = Module.new | |
| mod.module_eval(&block) | |
| const_set(name, mod) | |
| end | |
| def defclass(name, &block) | |
| klass = Class.new | |
| klass.class_eval(&block) | |
| const_set(name, klass) |
| cd "`dirname $0`" | |
| export PATH="../bin:$PATH" | |
| export FORMULAV="α β γ" | |
| list-expr () { | |
| foldl -@'|' formula "α | |
| :: | |
| | | |
| β" '|' α '|' β | formula "α |