{"id":17979047,"url":"https://github.com/lykhonis/fjava","last_synced_at":"2025-04-04T00:40:40.896Z","repository":{"id":2319772,"uuid":"3280214","full_name":"lykhonis/FJava","owner":"lykhonis","description":"F(unctional)Java translator v0.1. by Vladimir Lichonos.","archived":false,"fork":false,"pushed_at":"2012-01-29T23:34:21.000Z","size":122,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-02-09T12:29:34.596Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://vladli.com","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/lykhonis.png","metadata":{"files":{"readme":"Readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-01-27T04:38:07.000Z","updated_at":"2015-05-15T22:40:46.000Z","dependencies_parsed_at":"2022-09-05T14:50:22.763Z","dependency_job_id":null,"html_url":"https://github.com/lykhonis/FJava","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lykhonis%2FFJava","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lykhonis%2FFJava/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lykhonis%2FFJava/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/lykhonis%2FFJava/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/lykhonis","download_url":"https://codeload.github.com/lykhonis/FJava/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247103301,"owners_count":20884023,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-29T17:36:04.601Z","updated_at":"2025-04-04T00:40:40.878Z","avatar_url":"https://github.com/lykhonis.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"##DESCRIPTION:\nF(unctional)Java translator by Vladimir Lichonos.\n\n- Simple tool should run before Java compiler to translate some structures of the language to 'clean' Java code.\n- All arguments passes to this tool has to be *.fjava files, that can even have no FJava structures. Tool will create .java file with same name in same package (folder) so newly created java file can be compiled by Java compiler.\n- Be able to use this tool it's required to add com.fjava.library to classpath to your project. There are no files to be attached to your code, except if you use, for example, () =\u003e {} structure, tool will replace it with some interface F\u003c...\u003e(...) so this file will be compiled by Java compiler and attached to your project. If you don't use any structured, additional files won't be attached at all.\n  \n##USAGE:\nv0.1:\n\n- Simple class declaration (holders of some values):\n\t- Usage:\n\t\n\t\t\t[...] class \u003cIdentifier\u003e([[\u003cpublic\u003e | \u003cprotected\u003e | \u003cprivate\u003e] \u003cType\u003e \u003cIdentifier\u003e [, ...]]*)\n\t\t\t\n\t- Result in Java:\n\t\n\t\t\t[...] class \u003cIdentifier\u003e {\n\t\t\t\n\t\t\t\t([\u003cpublic\u003e | \u003cprotected\u003e | \u003cprivate\u003e] | \u003cpublic\u003e) final \u003cType\u003e \u003cIdentifier\u003e;\n\t\t\t\t[...]*\n\t\t\t\t\n\t\t\t\tpublic \u003cIdentifier\u003e([\u003cType\u003e \u003cIdentifier\u003e [, ...]]*) {\n\t\t\t\t\tthis.[Identifier] = [Identifier];\n\t\t\t\t\t[...]*\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t- Example:\n\t\n\t\t\tclass Test(String name, String hello)\n\t\t\t\n\t\t\tfinal Test test = new Test(\"Vladimir\", \"Hello, \");\n\t\t\tSystem.out.println(test.hello + test.name);\n\n- Lazy initialization of variables:\n\t- Usage:\n\t\t\n\t\t\tlazy \u003cType\u003e \u003cIdentifier\u003e = \u003cIdentifier\u003e;\n\t\t\n\t\tor\n\t\t\n\t\t\tlazy \u003cType\u003e \u003cIdentifier\u003e = { return \u003cIdentifier\u003e; }\n\t\n\t- Result in Java:\n\t\n\t\t\tfinal Lazy\u003cType\u003e \u003cIdentifier\u003e = new Lazy\u003cType\u003e(new F1\u003cType\u003e() {\n\t\t\t\t@Override\n\t\t\t\tpublic \u003cType\u003e invoke() {\n\t\t\t\t\t/* to do something */\n\t\t\t\t\treturn \u003cIdentifier\u003e;\n\t\t\t\t}\n\t\t\t});\n\t\t\n\t- Example:\n\t\n\t\t\tlazy String s = \"Lazy string\";\n\t\t\tSystem.out.println(s.invoke());\n\t\t\n\t\t\tlazy String s1 = { System.out.println(\"Requesting lazy string...\"); return \"Lazy string 2\"; }\n\t\t\tSystem.out.println(s1.invoke());\n\n- Closure without result and parameters:\n\t- Usage:\n\t\n\t\t\t\u003cIdentifier\u003e = () =\u003e { /* to do something */ }\n\t\t\n\t\tor \n\t\t\t\n\t\t\t\u003cIdentifier\u003e = =\u003e {  }\n\t\n\t- Result in Java:\n\t\n\t\t\tfinal F \u003cIdentifier\u003e = new F() {\n\t\t\t\t@Override\n\t\t\t\tpublic void invoke() {\n\t\t\t\t\t/* to do something */\n\t\t\t\t}\n\t\t\t};\n\t\n\t- Example:\n\t\t\n\t\t\tf = () =\u003e { System.out.println(\"Closure without parameters\"); }\n\t\t\tf.invoke();\n\t\t\n\t\t\tf1 = =\u003e { System.out.println(\"Closure without parameters and less to write\"); }\n\t\t\tf1.invoke();\n\t\t\n\t- As parameter:\n\t\t\n\t\t\tvoid someFunction(( =\u003e) f) { /* to do something */ f.invoke(); }\n\n\t\t!WARNING: in Java code () =\u003e f and =\u003e f are same language constructions, you cannot define two functions above at the same time.\n\t\t\n\t\t\tsomeFunction(() =\u003e { /* to do something */ });\n\t\t\n\t\tor\n\t\t\n\t\t\tsomeFunction( =\u003e { /* to do something */ });\n\t\t\n\t- As anonymous:\n\t\t\n\t\t\t() =\u003e { /* to do something */ }.invoke();\n\t\t\n\t\tor\n\t\t\t\n\t\t\t=\u003e { /* to do something */ }.invoke();\n\t\t\n- Closure without parameters but with result:\n\t- Usage:\n\t\t\n\t\t\t\u003cIdentifier\u003e = (\u003cType\u003e) =\u003e { return \u003cIdentifier\u003e; }\n\t\t\t\n\t\tor\n\t\t\n\t\t\t\u003cIdentifier\u003e = (\u003cType\u003e) =\u003e \u003cIdentifier\u003e;\n\t\n\t- Result in Java:\n\t\t\n\t\t\tfinal F1\u003cType\u003e \u003cIdentifier\u003e = new F1\u003cType\u003e() {\n\t\t\t\t@Override\n\t\t\t\tpublic \u003cType\u003e invoke() {\n\t\t\t\t\t/* to do something */\n\t\t\t\t\treturn \u003cIdentifier\u003e;\n\t\t\t\t}\n\t\t\t};\n\t\t\n\t- Example:\n\t\t\n\t\t\tf = (String) =\u003e { return \"Some closure with result of String\"; }\n\t\t\tSystem.out.println(f.invoke());\n\t\t\t\n\t\t\tf = (String) =\u003e \"Some single line closure\";\n\t\t\tSystem.out.println(f.invoke());\n\t\n\t- As parameter:\n\t\t\n\t\t\tvoid someFunction((String =\u003e) f) { /* to do something */ String s = f.invoke(); }\n\t\n\t\t\tsomeFunction((String) =\u003e { /* to do something */ return \"Some string here\"; });\n\t\n\t- As anonymous:\n\t\t\n\t\t\t(String) =\u003e { /* to do something */ return \"Some string here\"; }.invoke();\n\t\t\t\n\t\tor\n\t\t\n\t\t\t((String) =\u003e \"Some simple result\").invoke();\n\t\t\t\n\t\tor, if you like\n\t\t\n\t\t\t(String) =\u003e \"Some strange result\";.invoke();\n\t\t\n- Closure with arguments and result (now supports only 1 parameter):\n\t- Usage:\n\t\t\n\t\t\t\u003cIdentifier\u003e = (\u003cType\u003e, \u003cType\u003e \u003cIdentifier\u003e [, \u003cType\u003e \u003cIdentifier\u003e]) =\u003e { return \u003cIdentifier\u003e; }\n\t\n\t- Result in Java:\n\t\t\n\t\t\tfinal F2\u003cType, Type\u003e \u003cIdentifier\u003e = new F2\u003cType, Type\u003e() {\n\t\t\t\t@Override\n\t\t\t\tpublic \u003cType\u003e invoke(final \u003cType\u003e \u003cIdentifier\u003e) {\n\t\t\t\t\t/* to do something */\n\t\t\t\t\treturn \u003cIdentifier\u003e;\n\t\t\t\t}\n\t\t\t};\n\t\n\t- Example:\n\t\t\n\t\t\tf = (String, String name) =\u003e { return \"Hello \" + name; }\n\t\t\tSystem.out.println(f.invoke(\"Vladimir\"));\n\t\t\t\n\t\t\tf = (String, String name) =\u003e \"Hello \" + name;\n\t\t\tSystem.out.println(f.invoke(\"Vladimir\"));\n\t\n\t- As parameter:\n\t\t\n\t\t\tvoid someFunction((String, String =\u003e) f) { /* to do something */ String s = f.invoke(\"something\"); }\n\t\t\n\t\t\tsomeFunction((String, String something) =\u003e { /* to do something */ return \"We found \" + something; });\n\t\n\t- As anonymous:\n\t\t\n\t\t\t(String, String something) =\u003e { /* to do something */ return \"We found \" + something; }.invoke(\"Apple\");\n\t\t\t\n\t\tor\n\t\t\n\t\t\t((String, String something) =\u003e \"We found simple \" + something).invoke(\"Apple\");\n\t\t\t\n\t\tor, if you like\n\t\t\n\t\t\t(String, String something) =\u003e \"We found strange \" + something;.invoke(\"Apple\");\n\t\t\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flykhonis%2Ffjava","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flykhonis%2Ffjava","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flykhonis%2Ffjava/lists"}