String JS <=> Moonbit
struct MyCtx {
result: String
mut cur: Int
input: @vec.Vec[Int]
}
pub fn app() -> MyCtx {
pub trait ToJson { | |
write_json_string(Self, Buffer) -> Unit | |
} | |
fn ToJson::write_json_string(self : Int, buf : Buffer) -> Unit { | |
buf.write_string(self.to_string()) | |
} | |
fn ToJson::write_json_string(self : Bool, buf : Buffer) -> Unit { | |
buf.write_string(self.to_string()) |
String JS <=> Moonbit
struct MyCtx {
result: String
mut cur: Int
input: @vec.Vec[Int]
}
pub fn app() -> MyCtx {
This is translation of https://zenn.dev/mizchi/articles/introduce-moonbit from japanese
Recently, I came across a language called MoonBit, and the more I looked into it, the more I liked it, so I'd like to introduce it.
import { defineAgent, ok, err, runAgent, stepAgent, chain, initAgent } from "./agent.ts"; | |
import { Agent, AgentError, AgentErrorCode } from "./types.ts"; | |
import { expect } from "https://deno.land/std@0.214.0/expect/mod.ts"; | |
Deno.test("stepAgent: simple", async () => { | |
const simple = defineAgent((_init) => { | |
return { | |
async invoke(input, _options) { | |
return `Hello, ${input}`; | |
}, |
// prompt can not catch ctrl-c | |
const ret = prompt('input>'); | |
console.log(ret); // SIGINT interrupt before this line | |
// returns null with ctrl-c if signal handler is registerred. | |
function getInput(message: string): string | null { | |
const handler = () => {}; | |
Deno.addSignalListener('SIGINT', handler); | |
const ret = prompt(message); | |
Deno.removeSignalListener('SIGINT', handler); |
Issue draft for https://github.com/openai/openai-deno-build or deno itself
This is bug for https://github.com/openai/openai-deno-build
/* | |
Universal testing library for Deno, Node.js, Vitest and the browser. | |
// foo.test.{js,mjs,ts} | |
import { test, eq } from './unitest.mjs'; | |
test('1 === 1', () => { | |
eq(1, 1); | |
}); | |
$ deno test foo.test.ts |
タロンで3/4/5で勝利した試合の反省。
https://www.op.gg/summoners/jp/mizchi2-JP1
正直対面には負けた試合だったがマクロの判断でいくつか勝って、学びが多い回だった。
うろ覚えで書いているので、動画見ながら読むといくつか齟齬があるかも。