sotolf, to rust
@sotolf@alpha.polymaths.social avatar

So, to get back onto having fun with programming after some bad experiences with people I decided to do a bit of (skull) to get back into the groove again.

One thing that I really like about nim is just how natural and extremely readable it feels. just being allowed to overload stuff, being able to pretty easily just extend stuff small things like indexing a 2D array with a point or that making a contains functino automatically lets me use the "if point in grid" style syntax is really nice.

The one thing from that I kind of miss is that each struct kind of works like a namespace where you can add your functions that works on that type, it kind of makes the code more ordered, because as I end up doing it in my code, it does become a bit more cluttered since everything is on the top level.

Another really nice thing that I like with nim is that it allows me to use the (oca)ml type function calls, so that I can do "seq.add blah" rather than having to do "seq.add(blah)" it's a small thing, but it's really nice.

https://gist.github.com/sotolf2/fc66ac3ae9e217f9dcc932b8900c23dd

jens,
@jens@social.finkhaeuser.de avatar

@sotolf nim reads well, but I'm less enamoured when writing. It's still reasonable fun!

publicvoit, to programming
@publicvoit@graz.social avatar

What happens, when you join two paths in a language when the second one is an absolute one?

join("foo", "/bar")
returns "foo/bar" or "/bar"?

The wonderful @meisterluk wrote a great article about that you might want to read: https://lukas-prokop.at/articles/2024-05-03-filepath-join-behavior

I can not tell what version I'd actually prefer. There are situations where both versions would be "proper".

#C++

soc,
@soc@chaos.social avatar

@publicvoit @meisterluk Neither of those choices is correct.

The right solution is using the type-system to prevent obviously wrong code from compiling:
✅ join(AbsolutePath, RelativePath)
✅ join(RelativePath, RelativePath)
❌ join(RelativePath, AbsolutePath)
❌ join(AbsolutePath, AbsolutePath)

Another benefit is that AbsolutePath is not restricted to the root of the filesystem, but could express things like "the user's cache directory", increasing portability of paths saved to config files.

publicvoit,
@publicvoit@graz.social avatar

@soc @meisterluk Well, that's not something the compiler is able to decide when the parameters are not known during compilation.

markgritter, to random
@markgritter@mathstodon.xyz avatar

Suppose you modify with the additional rule that taking the last chip in any heap immediately takes all other heaps as well.

It looks to me an awful lot like the Grundy function (for two heaps) is

G(a,b) = 1 + (a-1) XOR (b-1)

But I can only get halfway there on a inductive proof. Is there a clever remapping of the game that shows this formula holds?

Question on Quora (with my partial answer proposing the above): https://www.quora.com/If-you-modify-the-rules-of-nim-so-that-the-game-ends-as-soon-as-any-heap-is-empty-how-to-calculate-the-Grundy-value-of-a-game-from-the-heap-sizes

I haven't even started at looking at whether this handles more than two heaps, either.

ncrav, to nature
@ncrav@mas.to avatar

Time for a re- for newer mastodon souls!

Hello! I'm Nuno and this is Lua :DsaprvingLua: !

I do solution architecture, data processing, statistics, and machine learning for a living.

Lua is a master and a connoisseur of the best gourmet woods.

My interests are:






of ideas











tbss,

@ncrav
Ĉu vi uzas ankaux miavivo.net?

ncrav,
@ncrav@mas.to avatar

@tbss Mi ne konis miavivon! Dankon! Mi provos ĝin!

paul, to random
@paul@snac.notnull.space avatar

Is it just me, or is https://nimble.directory down at the moment?

thindil,
@thindil@mastodon.social avatar

@srtcd424 @paul Seems like it back, at least for me. 😉

paul,
@paul@snac.notnull.space avatar

@thindil @srtcd424 ah good, yep I see it's back too!

gregorni, to Julia
@gregorni@fosstodon.org avatar

Any Nim or Julia people out there that also do app development? Can I get some ✋?

mo8it,
@mo8it@fosstodon.org avatar

@gregorni I just tried it, Letterpress is a very good app made by you :D

ProtonUp is the example that I found in my installed apps. It is not representative and my average impression of Python apps is rather subjective.

I don't have an experience with C# apps on Linux.

gregorni,
@gregorni@fosstodon.org avatar

@mo8it Basically all C# apps are in the Nickvision group. The ones I'm aware of are Cavalier, Denaro and Parabolic.

Nycto, to Playdate

I implemented "game over" and "restart" logic for my game. But I forgot that the terrain logic for recycling the ground sprites doesn't have a way to go backwards, only forwards. So when you jump back to the start, this happens...

video/mp4

beanjbunny,
@beanjbunny@nerdculture.de avatar

@Nycto that art is so pretty

igordsm, to random
@igordsm@fosstodon.org avatar

I've been trying in the last few weeks. It's a strangely nice language with many cool features. It's shame it's not used more...

sotolf, to random
@sotolf@alpha.polymaths.social avatar

Did day 2 in nim :Nim: as well for @futureisfoss to read over, and you can see it's pretty similar to my gleam version, just that I know nim a bit better, so I think at least this might be a bit more readable :)

https://bin.benjaminhollon.com/orrivallbo.nim

futureisfoss, (edited ) to random
@futureisfoss@fosstodon.org avatar

I just made a git repo for my solutions, so if any of you wanna see my spaghetti code you can find it here on - https://codeberg.org/rokosun/AOC

I'm using the programming language since I started learning it a while ago, still very much a beginner tho 🙃

P.S. Also check out @amin's private leaderboard for - https://alpha.polymaths.social/@amin/statuses/01HGA3787ZYTGJ60MQRW09RH5E

CanLehmann, to random
@CanLehmann@mastodon.social avatar

Just added an initial implementation of Gtk.ColumnView to owlkettle. The widget allows displaying large tabular datasets.

https://github.com/can-lehmann/owlkettle/blob/main/examples/widgets/column_view.nim

futureisfoss,
@futureisfoss@fosstodon.org avatar

@CanLehmann Hey man, didn't know you were on fedi, I just wanted to thank you for making the owlkettle library. I help with a small linux distro called TROMjaro and was able to make a few GUI programs in Nim with the help of owlkettle. I also saw your video tutorials on YouTube and those were extremely helpful to understand the logic behind this UI framework.

One of the apps I made with owlkettle - https://git.trom.tf/TROMjaro/theme-switcher-package
(Note: The code may not be that great 'cause I'm sill kind of a noob 😅)

sotolf, to random
@sotolf@alpha.polymaths.social avatar

So I'm kind of experiencing some cognitive dissonance the last days, I really enjoy the programming language, but the BDFL is kind of really getting more and more unhinged with a lot of statements. And as a person that actually cares about people and things like social issues, it's very much grating, they are also in many cases making the community less welcoming, to the point that I would suggest anyone learning the language to stay away from the official forums.

The problem is that I really enjoy using the langauge, there is very few languages that has the clearity and simplicity of working as nim does, it's a really comfortable langauge to work in that just suits how I think. Probably I could just continue on using it and just stay away from the community, I don't know, it's all kind of saddening.

futureisfoss,
@futureisfoss@fosstodon.org avatar

@sotolf I recently started learning Nim after a friend first told me about it. I usually just see tools as tools and don't care much about the developers or their opinions about other things, but I do like to see this language succeed tho and stuff like this doesn't seem to help. Maybe they should try to be a little more organized, but I also hope that more people start to see the value in this language and appreciate it as a tool. Most of the hurdles I face in Nim is due to it being unpopular 😕

tomo, to random
@tomo@floss.social avatar

I've been using at work for the last three days for a non-essential, one-off tool. I like it very much so far.

macleod, to haskell

Various thoughts on too many programming languages, for no discernible reason.

I have been interested in Go since it's very initial release, but their dependence on Google is uncharming to say the least. I still haven't made up my mind on its GC, but its definitely better than most.

I used to do some ML work in .NET and if it wasn't dependent on Microsoft it would be a heavy contender for a great language, but it has far too many Microsoft-isms to ever really go much farther.

Rust is great, I enjoy beating my head against a brick wall battling with the compiler, and their safety is great, but overly complicated and feature-creep is a real problem on that entire project. I do a lot of work these days in Rust, for better (mostly) or worse (mostly-ish).

C is my bread-and-butter, as is Javascript for quick prototyping.

Elixir is great, but Erlang is unwieldy, the community is growing, but not fast enough - and I just can't get my mind to enjoy the syntax no matter how nice it is.

D is a lot of fun, but their GC can be slow at times, and the community is very small and packages are often broken and unmaintained.

Python was my first true love, but I really can't stand the whitespace, again love the language, hate the syntax.

Zig is fun, but just that. Fast, nimble, but early days, a bit confusing, could replace my insistence on C for core projects, but again, early days. I love to use them as a compiler for C, much faster than the defaults on any of the others.

Odin is one I love to keep an eye on, I wish I could get behind using it for more things. When I first took notice ~4 years ago the documentation was a bit scattered, but it looks much better now. The developer behind it is incredibly cool, could be seen as the next Dennis Ritchie imo. Runes are dope. The syntax is by far my favourite.

Julia, I love Julia, but performance last I tested was a bit of a miss, and by miss, it required a decent chunk of compute for basics, but when you gave it the system to throttle, it would be insanely productive to write in. Javascript is something that I prototype even syscalls in, but Julia is just the same but much better and more productive (and less strange) in many regards. I am really hoping this takes over in the ML/Data world and just eats Python alive. I've heard there has been major work in the perf department, but I haven't had reason to try it out lately.

Ada, memory safety before Rust! Great language, especially for critical applications, decades of baggage (or wisdom), slow moving language, insanely stable, compilers are all mostly proprietary, job market is small, but well paid, great for robotics, defense, and space industry types, but the syntax is... rough. Someone should make a meta-language on top of Ada like Zig/Nim/Odin do for C, or Elixir does for Erlang.

The others: Carbon, haven't tried; Nim, prefer when they were "Nimrod" (cue Green Day), decent but not my style; Crystal, seems cool, but not for me; Scala, great FP language, but JVM; Haskell, I'm not a mathematician, but my mathematician friends love it. I see why, but not my thing as much as I love functional languages. I'll try it again, eventually. I did not learn Haskell a great good.

I tend to jump from language to language, trying everything out, it's fun and a total timesuck.

[ # ] :: #haskell #c #d #elixir #julia #nim #odin #odinlang #programming #code #rust #ada #dotnet #zig #python #txt

lfe,

@macleod @marcuse1w You might enjoy part of the intro to the LFE Edition of SICP, "The Hidden Origins of Lisp": https://lfe.io/books/sicp/fm/preface-3/origins.html

It traces Lisp from Peano and Russell through to Church, and of course, McCarthy ... the strong connection between each of those (as links in a chain) was surprising to discover.

leobm,
@leobm@norden.social avatar

@marcuse1w @macleod If you like , is an option. With there is also a stable erlang backend. Or I find very exciting in the erlang world (erlang and Javascript backend). Otherwise you might also like (native and wasm backend) if you are generally into ML languages. I also think is an extremely nice language. I've never understood what many people have against the syntax. I find it extremely simple and beautiful. Well, I also like 😉

CanLehmann, to linux
@CanLehmann@mastodon.social avatar

A pretty large PR by PhilippMDoerner was just merged in Owlkettle! 🎉

It adds a system for automatically generating forms that allow you to interactively play with the fields of each widget.

Here is how it is used in some of Owlkettle's examples:

RadioGroup example with form that allows editing all fields of the RadioGroup widget

  • All
  • Subscribed
  • Moderated
  • Favorites
  • megavids
  • thenastyranch
  • rosin
  • GTA5RPClips
  • osvaldo12
  • love
  • Youngstown
  • slotface
  • khanakhh
  • everett
  • kavyap
  • mdbf
  • DreamBathrooms
  • ngwrru68w68
  • provamag3
  • magazineikmin
  • InstantRegret
  • normalnudes
  • tacticalgear
  • cubers
  • ethstaker
  • modclub
  • cisconetworking
  • Durango
  • anitta
  • Leos
  • tester
  • JUstTest
  • All magazines