Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Dec 04 17:02
    Chemaclass commented on 821457b
  • Dec 04 16:21

    dependabot[bot] on composer

    (compare)

  • Dec 04 16:21

    dependabot[bot] on composer

    (compare)

  • Dec 04 16:21
    dependabot[bot] closed #537
  • Dec 04 16:21
    dependabot[bot] closed #536
  • Dec 04 16:21
    dependabot[bot] edited #537
  • Dec 04 16:21
    dependabot[bot] edited #536
  • Dec 04 16:21
    dependabot[bot] commented #536
  • Dec 04 16:21
    dependabot[bot] commented #537
  • Dec 04 16:21
    dependabot[bot] edited #537
  • Dec 04 16:20
    dependabot[bot] edited #536
  • Dec 04 16:20

    JesusValera on master

    Bump dependencies (compare)

  • Dec 03 11:32
    Chemaclass commented #489
  • Dec 01 10:00
    dependabot[bot] labeled #537
  • Dec 01 10:00
    dependabot[bot] labeled #537
  • Dec 01 10:00
    dependabot[bot] opened #537
  • Dec 01 10:00

    dependabot[bot] on composer

    Bump symfony/console from 5.4.1… (compare)

  • Dec 01 10:00
    dependabot[bot] labeled #536
  • Dec 01 10:00
    dependabot[bot] labeled #536
  • Dec 01 10:00

    dependabot[bot] on composer

    Bump psalm/plugin-phpunit from … (compare)

Mario Bašić
@mabasic
Hi guys, did someone made a tool/service that can convert html to phel structure? I am not sure, but I remember someone creating it...
Jens Haase
@jenshaase
I haven't seen something like this.
Mario Bašić
@mabasic

Hi guys, does anyone know how I can modify a map to convert keys from string to keywords?

{"name" "something" "subject" "something"}

to

{:name "something" :subject "something"}
Jens Haase
@jenshaase
There is a function called keyword that takes a string an returns a keyword
I would then use the for loop with a :reduce to fill up a new map
Mario Bašić
@mabasic
@jenshaase Thank you! I have followed your instructions and got it working:
(defn convert-keys-to-keywords [items]
  (reduce
   (fn [newItems item] (put newItems (first item) (second item)))
   {}
   (for [[key value] :pairs items] [(keyword key) value])))
I am working on some updates to my website. It is going to be only Phel this time :) I'm having fun programming with Phel again, it is very easy to get back to. I will probably ask more questions here when I upgrade to 0.7. I'm still on 0.4
Mario Bašić
@mabasic
I'm getting code malformed issues after upgrading to 0.7 ...
Phel\Compiler\Domain\Evaluator\Exceptions\CompiledCodeIsMalformedException: [:div {:class "black-group"} [:h2 {:class "black-group-title"} "Expertise"] [[:div {:class "unit pb-4"} [:div {:class "unit-title"} "Laravel" [:br] [:span {:class "unit-subtitle"} " " "The best batteries-included PHP framework"]] [:div {:class "unit-intro"} "Still running my first Laravel 3 application in production environment."] nil] [:div {:class "unit pb-4"} [:div {:class "unit-title"} "PHP" [:br] [:span {:class "unit-subtitle"} " " "It gets the job done"]] [:div {:class "unit-intro"} "My main programming language."] nil] [:div {:class "unit pb-4"} [:div {:class "unit-title"} "JavaScript" [:br] [:span {:class "unit-subtitle"} " " "It is like wine"]] [:div {:class "unit-intro"} "The language gets better with years."] nil] [:div {:class "unit pb-4"} [:div {:class "unit-title"} "React.js" [:br] [:span {:class "unit-subtitle"} " " "Simple top-down logic to follow"]] [:div {:class "unit-intro"} "My preferred JavaScript UI library."] nil] [:div {:class "unit pb-4"} [:div {:class "unit-title"} "React-native" [:br] [:span {:class "unit-subtitle"} " " "Native mobile app development"]] [:div {:class "unit-intro"} "Web developers building native mobile apps with web technologies."] nil] [:div {:class "unit pb-4"} [:div {:class "unit-title"} "Vue.js" [:br] [:span {:class "unit-subtitle"} " " "Alternative to React.js"]] [:div {:class "unit-intro"} "If you know React.js you know Vue.js."] nil] [:div {:class "unit pb-4"} [:div {:class "unit-title"} "TypeScript" [:br] [:span {:class "unit-subtitle"} " " "TypeScript is JavaScript with syntax for types"]] [:div {:class "unit-intro"} "Whenever possible I try to use typescript and not use the any type."] nil] [:div {:class "unit pb-4"} [:div {:class "unit-title"} "Phel" [:br] [:span {:class "unit-subtitle"} " " "Lisp inspired functional programming language that compiles to PHP"]] [:div {:class "unit-intro"} "This website is built with Phel."] nil] [:div {:class "unit pb-4"} [:div {:class "unit-title"} "F#" [:br] [:span {:class "unit-subtitle"} " " "Strongly-typed, functional-first programming language"]] [:div {:class "unit-intro"} "This website javascript is written with F#/Fable."] nil] [:div {:class "unit pb-4"} [:div {:class "unit-title"} "Go" [:br] [:span {:class "unit-subtitle"} " " "Small, simple, easy, powerful"]] [:div {:class "unit-intro"} "I like this language a lot, but have not used it very much."] nil] [:div {:class "unit pb-4"} [:div {:class "unit-title"} "Elixir" [:br] [:span {:class "unit-subtitle"} " " "Dynamic, functional language for building scalable and maintainable applications"]] [:div {:class "unit-intro"} "Still reading the documentation and learning."] nil] [:div {:class "unit pb-4"} [:div {:class "unit-title"} "Next.js" [:br] [:span {:class "unit-subtitle"} " " "The React Framework for Production"]] [:div {:class "unit-intro"} "SSR, SSG, ... A React.js framework with batteries included."] nil] [:div {:class "unit pb-4"} [:div {:class "unit-title"} "NestJS" [:br] [:span {:class "unit-subtitle"} " " "Progressive Node.js framework for building server-side applications"]] [:div {:class "unit-intro"} "Backend framework but for Node.js. It supports TypeScript and JavaScript."] nil] [:div {:class "unit pb-4"} [:div {:class "unit-title"} "Nx" [:br] [:span {:class "unit-subtitle"} " " "Smart, Fast and Extensible Build System"]] [:div {:class "unit-intro"} "Used for building monorepos and other stuff."] nil]]] is not a valid element name.
Were there some breaking changes?
Mario Bašić
@mabasic
everything works except the home page, I can go from there :)
Mario Bašić
@mabasic
solved it, it was some edge case with [:div [ [:div "test"] [:div "test"] [:div "test] ]] I had to do (apply list ...) in order for it to work. Don't know why it worked before. Maybe it is fixed now.
Mario Bašić
@mabasic
What is the current workflow for using compiled and non-compiled phel code?

In my index.php I have to manually switch from two modes. One for production and development and one for development.

public/index.php

<?php

declare(strict_types=1);

$projectRootDir  = __DIR__ . '/../';

// Compiles Phel code to PHP on each request and then runs it (Slow).
// require $projectRootDir . 'vendor/autoload.php';
// Phel\Phel::run($projectRootDir, 'app\\boot');

// Runs previously compiled PHP code (Fast).
require_once $projectRootDir . "vendor/autoload.php";
require_once $projectRootDir . "dist/app/boot.php";

How could I tell the application to run in specific mode?

Mario Bašić
@mabasic

All done. Here is the contact form which is now 100% phel and the website is now on 0.7.0 version. If you disable form validation (add novalidate to form) you can see the server side validation and validation error display in action.

https://mariobasic.com/start

Mario Bašić
@mabasic

I have solved the issue when using compiled and non-compiled phel code:

composer.json

"scripts": {
    "dev:slow": "PHEL_MODE=slow php -S localhost:8000 -t public/",
    "dev:fast": "composer compile && PHEL_MODE=fast php -S localhost:8000 -t public/",
    "compile": "vendor/bin/phel compile",
  }

public/index.php

<?php

declare(strict_types=1);

$phelMode = getenv('PHEL_MODE');

file_put_contents("php://stdout", "\nPhel mode: $phelMode\n");

$projectRootDir  = __DIR__ . '/../';

if ($phelMode === 'slow') {
    // Compiles Phel code to PHP on each request and then runs it (Slow).
    require $projectRootDir . 'vendor/autoload.php';
    Phel\Phel::run($projectRootDir, 'app\\boot');

    return;
}

// Runs previously compiled PHP code (Fast).
require_once $projectRootDir . "vendor/autoload.php";
require_once $projectRootDir . "dist/app/boot.php";

works great for now.

4 replies
Anas Saoui
@anas_debug:matrix.org
[m]
How to get started with Phel?
Jose Maria Valera Reales
@Chemaclass
2 replies
Jose Maria Valera Reales
@Chemaclass
Hey @mabasic, I think there is still an open question from @jenshaase in this PR:
https://github.com/phel-lang/phel-lang/pull/489#issuecomment-1170400979
2 replies
Mariano Montone
@mmontone
phel.gif
I'm experimenting with some tool support for Phel for Emacs.
9 replies
I have syntax higlighting, indentation, etc (derived from clojure-mode).
And also some limited evaluation from buffers, REPL, etc.
I will try to provide some completion next.
Mariano Montone
@mmontone
phel2.gif
1 reply
Completions, list of arguments in mode-line, and apropos command.
Very much WIP, but to show the level of IDE integration that could be achieved with some work.
Michał Majchrzak
@m_a_j_ch_rz_a_k_twitter
wowoowowow
Mariano Montone
@mmontone
It will grow to more to support more things. But it already provides quite a few helpful IDE things as it is now.
That's the purpose of my project, to be able to provide IDE support for new interactive languages as cheaply as possible.
Still need to solidify the protocol and more, but hope I'm getting this right and this can become useful one day.
Mariano Montone
@mmontone
Is this a bug:?
(contains? ["str"] "str") => false
1 reply
Mariano Montone
@mmontone
This works btw: (some? (fn [s] (= s "str")) ["str"]) => true
Mariano Montone
@mmontone
phel-docs.gif
Definitions docs ..
Mario Bašić
@mabasic
@mmontone I might get into emacs just because of this! Nice work!
Mariano Montone
@mmontone
:)
I'd like to improve the installation. The installation of Emacs packages is fine, but for the Phel server side, you have to copy the Phel server file: https://codeberg.org/mmontone/interactive-lang-tools/src/branch/master/backends/phel/ilt.phel to your project directory and run it, somehow.
But I'm not sure what would be best to do.
Jose Maria Valera Reales
@Chemaclass

I did some improvements on the phel snake game. https://github.com/Chemaclass/phel-snake#how-to-play The main change is using the compiled phel code instead of compiling it all the time. Aka: compile once, and play as much as you want.

I added some composer scripts to simplify it even more:

  • How to compile the game? ./tools/composer compile
  • How to play the game? ./tools/composer play
  • How to compile and play the game? ./tools/composer start

After the game is compiled, you don't have to compile it again, so using directly the play command will give you a better user experience; the game will load way faster 🚀

# https://github.com/Chemaclass/phel-snake/blob/master/play.php
require_once __DIR__ . "/vendor/autoload.php";

$compiledFile = __DIR__ . "/out/phel_snake/game.php";
if (!file_exists($compiledFile)) {
    exit('You have to compile the game first. Try with: `composer compile`');
}
$GLOBALS['argv'][] = 'play';
require_once $compiledFile;
3 replies
Jose Maria Valera Reales
@Chemaclass
While it's not 100% Phel, it's somehow related, because Phel is the "father" of Gacela and Phel's architecture it's based on Gacela 100% which allowed us to create something totally framework agnostic 💡 And why not, it is great to share it with the community here as well: https://www.reddit.com/r/PHP/comments/xvafzh/gacela_helps_you_to_split_the_logic_of_your_app/
Jose Maria Valera Reales
@Chemaclass
I created this issue with a feature idea 💡 any thoughts about it? 🤔
Add __name__ to identify the execution of a script
phel-lang/phel-lang#523
Jose Maria Valera Reales
@Chemaclass
I created a PR related to this idea ☝️ I think this can be very useful, because I encounter myself a few times where this was an issue and I needed to find some work around to find a solution. Now it looks pretty straightforward:
phel-lang/phel-lang#524
Jose Maria Valera Reales
@Chemaclass

I will talk about Phel next month, the 10. Oct, about Phel for the Software Crafters Madrid community https://www.meetup.com/es-ES/madswcraft/events/289206891/ I think it will be in Spanish, but if you attend, and you have any question in English, feel free to participate.

My plan is to present the language, the story and motivation behind, and most likely do some live coding 🚀

2 replies
Michał Majchrzak
@m_a_j_ch_rz_a_k_twitter
Does anyone have some Phel + webframework examples ?
1 reply
Jose Maria Valera Reales
@Chemaclass
I added an alias to the API page: https://phel-lang.org/api
Now it's even easier figure out the internal API of Phel 💡
aolko
@aolko
Hi, noticed this language, wanna build a subset of php myself, can you help me with that?
16 replies
Michał Majchrzak
@m_a_j_ch_rz_a_k_twitter
Any doing the AdventofCode in phel?
1 reply