Andy

joined 2 years ago
MODERATOR OF
13
submitted 8 months ago* (last edited 8 months ago) by Andy@programming.dev to c/concatenative@programming.dev
 

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):

spoiler

: get-input ( -- left-list right-list )
  "aoc-2024.01" "input.txt" vocab-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 ;

Sadly, Factor doesn't get highlighted properly here, so here it is again as an image:

spoiler

syntax-highlighted screenshot of the code above

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:

"NeoHaskell is cool"
  |> Text.toWordList
  |> List.map Text.length
  |> List.map (\x -> x * x)
  |> List.takeIf Int.isEven
 

I posted this project here before, but it's now reached 1.0.0.

 

Hey, it includes Factor!

 

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 and a revamp. I think the bar these days has been raised by projects like QML and Slint, which provide a great context in which to set new goals.

[–] Andy@programming.dev 6 points 1 year ago (2 children)

Congrats on all the labor you saved.

If you think folks here are uniquely unreasonable you could try lemmy.world/c/selfhosted .

[–] Andy@programming.dev 11 points 1 year ago (6 children)

On the off chance that you truly don't understand:

The nice thing to do would be to accept the feedback and add a short description. It's confusing to others why you are staunchly opposed to performing that small courtesy, and instead jump to never posting here again.

[–] Andy@programming.dev 2 points 1 year ago (1 children)

The window shade problem is keeping me from Wayland. AFAIU there's currently no commitment to ever fix it on Wayland, it's only a maybe.

For anyone interested, it's being tracked here.

[–] Andy@programming.dev 3 points 1 year ago

So . . . not relevant to my comment?

[–] Andy@programming.dev 1 points 1 year ago

Beware: it's a nightmare.

[–] Andy@programming.dev 1 points 1 year ago

Pangram

USING: sets.extras unicode ;

: pangram? ( str -- ? )
  >lower "abcdefghijklmnopqrstuvwxyz" superset? ;

[–] Andy@programming.dev 5 points 1 year ago
  • Factor
  • Roc
  • Nim
  • Zsh
  • Execline
[–] Andy@programming.dev 2 points 1 year ago (2 children)

Well FWIW CodeWars has plenty of Factor katas, and I try to gather related resources at https://programming.dev/c/concatenative

I'm trying to keep up with the Perl Weekly Challenges, but with Factor, and am posting some Factor solutions to Exercism's 48in24 series.

[–] Andy@programming.dev 3 points 1 year ago* (last edited 1 year ago)

By default you can use left and right bracket keys [] to adjust speed, and it should do adjustments to make the pitch sound the same.

To adjust the pitch alone, you can have something like this in your input.conf, customized as you like:

ALT+p af toggle @rb
ALT+UP af-command rb multiply-pitch 1.25
ALT+DOWN af-command rb multiply-pitch 0.8
ALT+LEFT af-command rb set-pitch 1.0

I haven't looked at this in a long time. If you always need this there's likely a conf option to always enable the "rubber band" (@rb) filter. And maybe other commands than multiply that would be better.


EDIT: Sorry, I don't have this quite right. Maybe someone can correct me.

[–] Andy@programming.dev 1 points 1 year ago

Scrabble Score 4.0

USING: assocs.extras kernel literals make sequences unicode ;

CONSTANT: charscores $[
  [
    { 1 2 3 4 5 8 10 }
    { "AEIOULNRST" "DG" "BCMP" "FHVWY" "K" "JX" "QZ" }
    [ [ ,, ] with each ] 2each
  ] H{ } make
]

: scrabble-score ( str -- n )
  charscores swap >upper values-of sum ;

[–] Andy@programming.dev 8 points 1 year ago (2 children)

OK, I see some differences between your two screenshots, but what's the relevance to my comment?

[–] Andy@programming.dev 3 points 1 year ago (1 children)

As described at https://docs.kde.org/stable5/en/kwin/kcontrol/windowbehaviour/index.html#titlebar-actions

Shade

Causes the window to be reduced to simply the titlebar.

view more: ‹ prev next ›