Fort like lang. Contribute to BlagojeBlagojevic/blang development by creating an account on GitHub.
GitHub - BlagojeBlagojevic/blang: Fort [sic?] like lang
We're starting with a new release approach, these files will stay available permanently in contrast to the latest nightly. We now recommend most users to stick to 0.0.0-alpha releases instead of ni...
Copied from the release notes:
We're starting with a new release approach, these files will stay available permanently in contrast to the latest nightly.
We now recommend most users to stick to 0.0.0-alpha releases instead of nightly-latest.
This current release is based on commit a089cf2 from the 6th of January 2025. These files are identical to nightly-latest published on the 7th of January 2025.
EDIT: A whole lot more detail in the new 0.0.0-alpha2-rolling release
It's been a while, but my clumsy adding of a comment to the buffer is unnecessary, given zle -M
, which will display a message outside of the buffer. So here's an updated version:
bash
# -- Run input if single line, otherwise insert newline -- # Key: enter # Credit: https://programming.dev/comment/2479198 .zle_accept-except-multiline () { if [[ $BUFFER != *$'\n'* ]] { zle .accept-line return } else { zle .self-insert-unmeta zle -M 'Use alt+enter to submit this multiline input' } } zle -N .zle_accept-except-multiline bindkey '^M' .zle_accept-except-multiline # Enter # -- Run input if multiline, otherwise insert newline -- # Key: alt+enter # Credit: https://programming.dev/comment/2479198 .zle_accept-only-multiline () { if [[ $BUFFER == *$'\n'* ]] { zle .accept-line } else { zle .self-insert-unmeta } } zle -N .zle_accept-only-multiline bindkey '^[^M' .zle_accept-only-multiline # Enter
Tacit Talk: a podcast about programming languages, combinators, algorithms and more!
The given Uiua example (mercifully given using words rather than the symbols):
undefined
[3 4 5 10 23] divide length on /+
For all the talk about "forward" it's uncomfortable to me how the Uiua evaluation within a line happens backward.
An equivalent in Factor, where keep
is close to on
:
undefined
{ 3 4 5 10 23 } [ sum ] keep length /
But this pattern of doing two things in sequence to the same item is common enough that bi
is handy:
undefined
{ 3 4 5 10 23 } [ sum ] [ length ] bi /
Spreadsheets 1/3 - Rye Language
Discussion om lobsters: https://lobste.rs/s/ayiyce/spreadsheets_1_3_rye_language
Day 6
Slow and dumb gets it done! I may revisit this when I give up on future days.
Factor
Nothing smart to see here. I may revisit this when I give up on future days.
Factor
Factor
undefined
: get-input ( -- rules updates ) "vocab:aoc-2024/05/input.txt" utf8 file-lines { "" } split1 "|" "," [ '[ [ _ split ] map ] ] bi@ bi* ; : relevant-rules ( rules update -- rules' ) '[ [ _ in? ] all? ] filter ; : compliant? ( rules update -- ? ) [ relevant-rules ] keep-under [ [ index* ] with map first2 < ] with all? ; : middle-number ( update -- n ) dup length 2 /i nth-of string>number ; : part1 ( -- n ) get-input [ compliant? ] with [ middle-number ] filter-map sum ; : compare-pages ( rules page1 page2 -- <=> ) [ 2array relevant-rules ] keep-under [ drop +eq+ ] [ first index zero? +gt+ +lt+ ? ] if-empty ; : correct-update ( rules update -- update' ) [ swapd compare-pages ] with sort-with ; : part2 ( -- n ) get-input dupd [ compliant? ] with reject [ correct-update middle-number ] with map-sum ;
More Factor solutions for the first 3 days (at time of comment) from okflo, on sourcehut.
Have you had a good look at Factor? FWIW I've got at least the first 3 days with it up here.
Some more Factor solutions for the first 3 days (so far) from soweli Niko, on Codeberg.
Factor
undefined
: get-input ( -- corrupted-input ) "vocab:aoc-2024/03/input.txt" utf8 file-contents ; : get-muls ( corrupted-input -- instructions ) R/ mul\(\d+,\d+\)/ all-matching-subseqs ; : process-mul ( instruction -- n ) R/ \d+/ all-matching-subseqs [ string>number ] map-product ; : solve ( corrupted-input -- n ) get-muls [ process-mul ] map-sum ; : part1 ( -- n ) get-input solve ; : part2 ( -- n ) get-input R/ don't\(\)(.|\n)*?do\(\)/ split concat R/ don't\(\)(.|\n)*/ "" re-replace solve ;
Factor
undefined
: get-input ( -- reports ) "vocab:aoc-2024/02/input.txt" utf8 file-lines [ split-words [ string>number ] map ] map ; : slanted? ( report -- ? ) { [ [ > ] monotonic? ] [ [ < ] monotonic? ] } || ; : gradual? ( report -- ? ) [ - abs 1 3 between? ] monotonic? ; : safe? ( report -- ? ) { [ slanted? ] [ gradual? ] } && ; : part1 ( -- n ) get-input [ safe? ] count ; : fuzzy-reports ( report -- reports ) dup length <iota> [ remove-nth-of ] with map ; : tolerable? ( report -- ? ) { [ safe? ] [ fuzzy-reports [ safe? ] any? ] } || ; : part2 ( -- n ) get-input [ tolerable? ] count ;
Factor
undefined
: get-input ( -- left-list right-list ) "vocab:aoc-2024/01/input.txt" utf8 file-lines [ split-words harvest ] map unzip [ [ string>number ] map ] bi@ ; : part1 ( -- n ) get-input [ sort ] bi@ [ - abs ] 2map-sum ; : part2 ( -- n ) get-input histogram '[ dup _ at 0 or * ] map-sum ;
Day 3
Image:
Day 2:
Image:
Happy Advent of Code 2024 Everyone!
Alright, show me I'm not the only one in this community, and show off some solutions!
Here's my Day 1 solution in Factor (minus imports):
Sadly, Factor doesn't get highlighted properly here, so here it is again as an image:
I probably won't last the week, but what solutions I do have will be up on GitHub.
This example is my justification for posting it here:
haskell
"NeoHaskell is cool" |> Text.toWordList |> List.map Text.length |> List.map (\x -> x * x) |> List.takeIf Int.isEven
To celebrate ChipWits' 40th Anniversary, the original FORTH source code has been open sourced! Learn about the game's history and source code
Changelog ea87548 Add the "dup" operator. 8231403 Improve precision handling a bit. a6148e8 Update README.md with decimal and brew info. 6184a22 Updated CHANGELOG.md to v1.0.0.
I posted this project here before, but it's now reached 1.0.0.
Hey, it includes Factor!
What would Enaml 2.0 look like? | nucleic/enaml | Declarative UI
Hi Everyone! I've been thinking lately that it might be time for me to devote some real effort into an Enaml version "2.0". I'd like some feedback from the community about that should look like. He...
From Enaml's docs:
Enaml brings the declarative UI paradigm to Python in a seamlessly integrated fashion. The grammar of the Enaml language is a strict superset of Python. This means that any valid Python file is also a valid Enaml file, though the converse is not necessary true. The tight integration with Python means that the developer feels at home and uses standard Python syntax when expressing how their data models bind to the visual attributes of the UI.
. . .
Enaml’s declarative widgets provide a layer of abstraction on top of the widgets of a toolkit rendering library. Enaml ships with a backend based on Qt5/6 and third-party projects such as enaml-web and enaml-native provides alternative backends.
A maintainer of Enaml has just opened a brainstorm discussion on the next major development goals.
It's a project I've long admired, though rarely used, and I'd love to see it get some attention
phreda4/r3: r3 programing language - ColorForth inspired
r3 programing language - ColorForth inspired. Contribute to phreda4/r3 development by creating an account on GitHub.