This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="ja"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>JavaScript Prolog インタプリター</title> | |
<style> | |
body { | |
font-family: Arial, sans-serif; | |
margin: 20px; | |
background-color: #f2f2f2; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Mapping out the solution | |
I’m piecing together a JavaScript-based Prolog interpreter, leveraging HTML for browser functionality and CSS for a sleek interface. This requires implementing a minimal Prolog subset like basic facts and queries. | |
Planning the layout | |
I’m crafting an HTML file with embedded CSS and JavaScript for a Prolog interpreter. It includes areas for Prolog code input, query input, a button to run queries, and an output division. | |
Mapping a plan | |
Crafting a JavaScript-based Prolog interpreter with depth-first search resolution for Horn clauses. Including a simple parser and basic query handling. | |
Breaking down the solution | |
I’m developing a JavaScript code to parse Prolog rules, store them in a database, and implement a resolution algorithm for queries. Clauses will be represented as {head: Term, body: [Term]}. | |
Mapping out Prolog parsing | |
I’m considering a simplified parser for Prolog terms, focusing on atoms and structures with functor and arguments, while adhering to a limited format like “parent(jo |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Classfile /Users/kota.mizushima/repo/S.class | |
Last modified 2025/01/29; size 1141 bytes | |
SHA-256 checksum 65b4550564c5c46318684ff0631b603d4030a9d58ccc738d1ea2c355dd195f6f | |
Compiled from "S.java" | |
class S | |
minor version: 0 | |
major version: 65 | |
flags: (0x0020) ACC_SUPER | |
this_class: #14 // S | |
super_class: #2 // java/lang/Object |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Classfile /Users/kota.mizushima/repo/HighAndLow.class | |
Last modified 2025/01/29; size 1509 bytes | |
SHA-256 checksum 9f7e5f532ca17d7e41b24a14633833e16c0b95df2335adf465b063ab624bd730 | |
Compiled from "HighAndLow.java" | |
public class HighAndLow | |
minor version: 0 | |
major version: 65 | |
flags: (0x0021) ACC_PUBLIC, ACC_SUPER | |
this_class: #56 // HighAndLow | |
super_class: #2 // java/lang/Object |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Classfile /Users/kota.mizushima/repo/Fib.class | |
Last modified 2025/01/29; size 953 bytes | |
SHA-256 checksum 58d114f5e4a48ff95933c8c9d90b42e8998060a6bc5f8e56fa4c1464ce4f1832 | |
Compiled from "Fib.java" | |
public class Fib | |
minor version: 0 | |
major version: 65 | |
flags: (0x0021) ACC_PUBLIC, ACC_SUPER | |
this_class: #8 // Fib | |
super_class: #2 // java/lang/Object |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const readline = require('readline'); | |
const fs = require('fs'); | |
const readLineSync = require('readline-sync'); | |
const { type } = require('os'); | |
function input(prompt) { | |
return readLineSync.question(prompt); | |
} | |
function arrayEquals(arr1, arr2) { | |
return ( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Here is my program lang. Could you provide number guessing game in the lang? | |
const readline = require('readline'); | |
const fs = require('fs'); | |
const readLineSync = require('readline-sync'); | |
function input(prompt) { | |
return readLineSync.question(prompt); | |
} | |
//プログラム全体 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Program class | |
class Program { | |
constructor(defs, ...expressions) { | |
this.defs = defs; | |
this.expressions = expressions; | |
} | |
} // Function definition class | |
class FunDef { | |
constructor(name, args, body) { | |
this.name = name; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
もちろんです!以下に、Chrome拡張機能を作成するためのコードの例を示します。これは、指定された仕様を満たすシンプルな拡張機能です。 | |
まず、プロジェクトディレクトリに3つのファイルを作成してください。 | |
manifest.json | |
background.js | |
content.js | |
manifest.json: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function doPost(e) { | |
// slack appsのEvent Subscriptionsのchallenge。同期する時に利用。 | |
var params = JSON.parse(e.postData.getDataAsString()); | |
if('challenge' in params) | |
{ | |
return ContentService.createTextOutput(params.challenge); | |
} | |
// ユーザ名とtextを取得 | |
var userName = params.event.user; |
NewerOlder