Transpiled version (14668L) is out of date.
// supports max 3 arguments so far // example use: // java gazelle_guilds // // proc { // for $guild in gazelle_guilds(): // say (I am in guild $guild) // } svoid philosophyBot_autoJava(PhilosophyBot1 bot) { bot.addFactPreprocessor(s -> { LS tok = bot.mainTokenize(s); if (countTokens(tok) == 2 && eq(firstToken(tok), "java")) { S name = secondToken(tok); if (!isIdentifier(name)) ret false; print("Importing java function " + name); if (!canCallAndMakeFunctionNamed(name)) ret false with print("Warning: Java function not found: " + name); bot.addNativePredicate(name + "()", () -> callAndMake(name)); bot.addNativePredicate(name + "($a)", map -> callAndMake(name, unquote(map.get("$a")))); bot.addNativePredicate(name + "($a, $b)", map -> callAndMake(name, unquote(map.get("$a")), unquote(map.get("$b")))); bot.addNativePredicate(name + "($a, $b, $c)", map -> callAndMake(name, unquote(map.get("$a")), unquote(map.get("$b")), unquote(map.get("$c")))); true; } false; }); }
download show line numbers debug dex old transpilations
Travelled to 7 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, pzhvpgtvlbxg, tvejysmllsmz, vouqrxazstgt, xrpafgyirdlv
No comments. add comment
Snippet ID: | #1025793 |
Snippet name: | philosophyBot_autoJava |
Eternal ID of this version: | #1025793/5 |
Text MD5: | 9fdadaf2432c4cf6b23f665aae1ccd3f |
Author: | stefan |
Category: | javax |
Type: | JavaX fragment (include) |
Public (visible to everyone): | Yes |
Archived (hidden from active list): | No |
Created/modified: | 2020-03-18 15:42:53 |
Source code size: | 1137 bytes / 32 lines |
Pitched / IR pitched: | No / No |
Views / Downloads: | 237 / 371 |
Version history: | 4 change(s) |
Referenced in: | #1006654 - Standard functions list 2 (LIVE, continuation of #761) #1025937 - philosophyBot_autoOpenTheoriesHandler #1027310 - philosophyBot_autoJava (backup v1 without arguments) |