Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • Feb 05 18:03

    Chemaclass on v0.9.0

    (compare)

  • Feb 05 18:00

    Chemaclass on update-changelog-date-for-0.9

    (compare)

  • Feb 05 18:00

    Chemaclass on master

    Set release 0.9 in changelog Merge pull request #566 from ph… (compare)

  • Feb 05 18:00
    Chemaclass closed #566
  • Feb 05 12:50
    Chemaclass edited #566
  • Feb 05 12:47
    Chemaclass review_requested #566
  • Feb 05 12:47
    Chemaclass review_requested #566
  • Feb 05 12:47
    Chemaclass assigned #566
  • Feb 05 12:47
    Chemaclass opened #566
  • Feb 05 12:46

    Chemaclass on update-changelog-date-for-0.9

    Set release 0.9 in changelog (compare)

  • Feb 03 09:51

    Chemaclass on simplify-api-facade

    (compare)

  • Feb 03 09:51
    Chemaclass closed #565
  • Feb 03 09:51

    Chemaclass on master

    ApiFacade returns a list of Phe… Add test_no_functions_found for… Update and apply phpcs and 1 more (compare)

  • Feb 03 09:18
    Chemaclass synchronize #565
  • Feb 03 09:18

    Chemaclass on simplify-api-facade

    Update and apply phpcs (compare)

  • Feb 03 09:18

    Chemaclass on allow-underscores-in-decimal-numbers

    (compare)

  • Feb 03 09:18

    Chemaclass on master

    Allow decimal number with under… Refactor AtomParser applying ex… Update changelog and 5 more (compare)

  • Feb 03 09:18
    Chemaclass closed #564
  • Feb 03 09:08
    Chemaclass opened #565
  • Feb 03 09:08
    Chemaclass review_requested #565
Jose Maria Valera Reales
@Chemaclass
I created some good first issues for Phel, in case you are looking for a testing challenge/opportunity in a new project, like a testing kata. They are about adding unit tests for some SpecialForm that I did miss a year ago when I was working on them, and I learned a lot by doing this. I found this now, so instead of doing them myself, I think it's good to let others try themselves if someone wants to contribute doing anything but they don't know where to start. These are like "exclusives testing katas" with a lot of learning opportunities :)
Jens Haase
@jenshaase
👍
Anas Saoui
@Anas-debug
Hello everyone.
Jens Haase
@jenshaase
Hi
1 reply
Michał Majchrzak
@m_a_j_ch_rz_a_k_twitter
Hello there :) Is there pattern matching in Phel? I can not find it in the docs.
9 replies
Jose Maria Valera Reales
@Chemaclass
This Thursday 23rd June at 20:00, I will have a live chat about Phel for the Spanish community:
https://www.youtube.com/watch?v=9pElbTEcyGA It will be in ES, so if you can speak Spanish you will have a great time for sure!
Jose Maria Valera Reales
@Chemaclass
Hey everyone! I wanted to share what I did last week: the snake game fully written in phel: https://github.com/Chemaclass/phel-snake 🐍
Michał Majchrzak
@m_a_j_ch_rz_a_k_twitter
Ha! nice :D
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