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
Jens Haase
@jenshaase
You can not create real classes in Phel. However, structs are classes and you can add methods to them by using interfaces: https://phel-lang.org/documentation/interfaces/
The struct my-type-with-two-interfaces is a PHP class that implements the interfaces MyFirstInterface and MySecondInterface.
Adam Stokes
@adamstokes:matrix.org
[m]
Ah ok, I did read about that in your docs, I'll give that a go
Jens Haase
@jenshaase
If you want to use Symfony in your project you probably use the router with functions instead of the controller.
Adam Stokes
@adamstokes:matrix.org
[m]
Thanks, I'm slowly training my brain to think that way
Jose Maria Valera Reales
@Chemaclass
Phel got 250 :star2: in GitHub! https://github.com/phel-lang/phel-lang/stargazers
Jens Haase
@jenshaase
Hey everybody, I just publish a new repository in the phel-lang organization. This repository contains a router library. It is still work in progress and requires some changes of Phel that have not been released yet but are already in master. Feel free to check it out: https://github.com/phel-lang/router
1 reply
Mochammad Farid Wajdi
@mfaridw
Hello, I just tried to run repl in powershell but got an error message instead.
stripos(): Argument #1 ($haystack) must be of type string, null given
#0 D:\farid\phel\hello-world\vendor\phel-lang\phel-lang\src\php\Run\Domain\Repl\ReplCommandSystemIo.php(71): stripos(NULL, 'editline')     
#1 D:\farid\phel\hello-world\vendor\phel-lang\phel-lang\src\php\Run\Command\ReplCommand.php(127): Phel\Run\Domain\Repl\ReplCommandSystemIo->isBracketedPasteSupported()
#2 D:\farid\phel\hello-world\vendor\phel-lang\phel-lang\src\php\Run\Command\ReplCommand.php(110): Phel\Run\Command\ReplCommand->addLineFromPromptToBuffer()
#3 D:\farid\phel\hello-world\vendor\phel-lang\phel-lang\src\php\Run\Command\ReplCommand.php(101): Phel\Run\Command\ReplCommand->loopReadLineAndAnalyze()
#4 D:\farid\phel\hello-world\vendor\symfony\console\Command\Command.php(298): Phel\Run\Command\ReplCommand->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#5 D:\farid\phel\hello-world\vendor\symfony\console\Application.php(1015): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#6 D:\farid\phel\hello-world\vendor\symfony\console\Application.php(299): Symfony\Component\Console\Application->doRunCommand(Object(Phel\Run\Command\ReplCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))        
#7 D:\farid\phel\hello-world\vendor\symfony\console\Application.php(171): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#8 D:\farid\phel\hello-world\vendor\phel-lang\phel-lang\phel(42): Symfony\Component\Console\Application->run()
#9 D:\farid\phel\hello-world\vendor\bin\phel(117): include('D:\\farid\\phel\\h...')
#10 {main}
4 replies
Jens Haase
@jenshaase
We just released version 0.7.0 of Phel. This release comes with a lot a small improvements to the core library. Read the blog post for more information: https://phel-lang.org/blog/release-0-7/
3 replies
Jesus Valera Reales
@JesusValera
image.png
Jens Haase
@jenshaase
I think I forgot to update the phel version in the composer.json of the website. I can fix this later.
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.