@dgkf@fosstodon.org avatar

dgkf

@dgkf@fosstodon.org

data scientist and software engineer, passionate about open software for collective social good

building tools for productivity, expression & creativity - currently focused on #helix #HelixEditor #blender #blender3d

#r #rstats #python #julia #julialang for analysis

#rust for performance

i love #bikeTO, public transit, #vegetarian #vegan food, #green #socialism policy

he/him (they/them also fine)

This profile is from a federated server and may be incomplete. Browse more on the original instance.

dgkf, to random
@dgkf@fosstodon.org avatar

Announcing the first CRAN release of testex!

A package for testing examples - with roxygen2 tags to write tests in-line in your function examples. Integrates with testthat to automatically run tests from your documentation.

CRAN: https://cran.r-project.org/web/packages/testex/
GitHub: https://github.com/dgkf/testex

#r

dgkf, to random
@dgkf@fosstodon.org avatar

And it's live!

Try out localized R keywords in your browser!

https://dgkf.github.io/R

There's no documented keyword index, so you'll have to find all the localizations at https://github.com/dgkf/R/tree/main/src/grammar/localizations

Easter eggs await! Implementation notes to follow...

#r

dgkf,
@dgkf@fosstodon.org avatar

@Mehrad @dgkf I appreciate that you took the time to poke around! In that particular case it’s to allow “función” with or without the accent over the “o”.

For other values like “NULL”/“null”, I prefer the lowercase version, but for now I want to make the syntax R-compatible to help build some momentum.

In an ideal world I’d be able to run R code, but that could be relegated to a specific execution mode (almost like its own localization) while disallowing the uppercase alternatives generally.

dgkf,
@dgkf@fosstodon.org avatar

@Mehrad @dgkf Also, in my ignorance I totally forgot to consider non-left-to-right languages.

I wonder how realistically those could be handled 🤔. If you’re familiar with such a language, I’d be very curious to hear how you feel it should work - should the REPL prompt be on the right? Is that typical of terminals?

Probably a big addition, but I’m aiming for inclusivity if I can manage it.

eddelbuettel, to random
@eddelbuettel@mastodon.social avatar

Dang. %||% coming to base R in R 4.4.0 next April.

dgkf,
@dgkf@fosstodon.org avatar

@eddelbuettel in what’s the best way to discover which features are under consideration? I often see these posts about new features when they’re added, but never posts about upcoming feature discussions. I’m curious why changes always feel like surprises.

dgkf,
@dgkf@fosstodon.org avatar

@eddelbuettel Gotcha. The answer I expected, but was hoping I had a blind spot. I really like following the enhancement proposals for other languages and would love to see that adopted in R land.

Thanks for reporting out when you see cool changes! Sounds like it’s the best we have for now.

dgkf, to random
@dgkf@fosstodon.org avatar

RStudio being so widely used in is such a double-edged sword.

Because RStudio doesn’t use a standard language server, contributed IDE features are introduced as RStudio Add-ins instead of LSP code actions like all other modern languages.

If you’re building a code action RStudio Add-in, consider contributing first to {languageserver}, and then exposing that action as a Add-in to avoid splitting our communities.

Wish RStudio used an LSP. Would save a lot of redundant effort.

dgkf, to random
@dgkf@fosstodon.org avatar

And here it is! Implementing tail recursion wasn't the overhaul I thought it would be.

After a night of rest and a few "first pancake" implementations, I realized that a small re-framing of the problem would let me slot it nicely into my current evaluation model.

1/3, implementation details below

dgkf,
@dgkf@fosstodon.org avatar

The first hint was when I realized I never implemented "return". I already had it mocked up as an R-style condition, and adding it was an easy fix. In rust world, intercepting conditions is the norm, and we could use the same tools to handle "tails".

A "tail" is just like a return, but instead of returning the result, it returns the expression. It bubbles back up to where the last frame was introduced and gets evaluated there with some extra legwork to pass the arguments back properly.

2/3

dgkf,
@dgkf@fosstodon.org avatar

Unlike normal expressions, recursive tail calls need their arguments to be eagerly evaluated because we are going to throw away each recursive frame in favor of a fresh frame at the same depth.

This subtle evaluation difference is probably why R's version wraps recursive tail calls in a Tailcall(). Without a way to differentiate evaluation schemes, a function like (below) will error on its first iteration, not its last as expected.

3/3

dgkf,
@dgkf@fosstodon.org avatar

Following up on my little sprint to mimic new Tailcall() feature.

Although disabled by default, this behavior is now available as an optional feature in https://github.com/dgkf/R using cargo run --features tail-call-optimization

Waiting to play with R's version a bit before deciding on the semantics.

4/3

coolbutuseless, to random
@coolbutuseless@fosstodon.org avatar

TIL: someone once attempted refactoring R from C to C++

Project name: CXXR

https://www.cs.kent.ac.uk/projects/cxxr/

dgkf,
@dgkf@fosstodon.org avatar
dgkf,
@dgkf@fosstodon.org avatar

@hrbrmstr @jonocarroll @coolbutuseless maybe some day, but for now I work on it sporadically at my leisure. I wouldn’t feel comfortable taking money for it knowing there are long stretches where nothing happens.

I’m flattered that the thought even crossed your mind.

hrbrmstr, to random
@hrbrmstr@mastodon.social avatar

Today's Typography Tuesday edition of the Drop has font pairings, games (well, a game), and a WASM-fueled experiment to embed a video into a typeface.

Drop (2023-09-05)

— If You're 👀 This It's Day 100;
— Bad 🍎;
— The 👁️ing Game

Read/sub: https://dailyfinds.hrbrmstr.dev/p/drop-328-2023-09-05-typography-tuesday

dgkf,
@dgkf@fosstodon.org avatar

@hrbrmstr now I want some animated ligatures for my R “<-“ assignment and “|>” pipe operators to really drive home the directionality.

(Please nobody actually do this, I don’t need my code to look like it’s crawling around my screen)

(But also, please somebody do it because I am a little curious what it would look like)

mdsumner, to random

mind blown 🤯 and also excited 🤠

a CRAN package can use ::: for another's internal function ... and pass check ... if, the maintainer emails are the same ⚡🙏🔥

TIL, thanks to @gaborcsardi 👌

dgkf,
@dgkf@fosstodon.org avatar

@mdsumner @gaborcsardi what happens if you change maintainers? I assume this means you’d be archived unless all packages are transferred to the same person?

barbone, to random

I recently found out I can do parenthetical method chaining (there's a real term for this right?) in like the examples below.

args &lt;- (  
 scribe::command_args()  
 $add_argument("foo", action = "flag")  
 $add_argument("bar", action = "list", default = 1)  
 $parse()  
)  
wb &lt;- (  
 openxlsx2::wb_workbook()  
 $add_worksheet()  
 $add_data(x = datasets::attitude)  
)  

I think I'm going to update a lot of scripts now.
@RStats

dgkf,
@dgkf@fosstodon.org avatar

@barbone Another option which might be a bit more idiomatic in the pipe-loving R world is to use the lesser-known %$% operator from magrittr - naturally not a viable path if you're trying to limit dependencies.

library(magrittr)

args &lt;- scribe::command_args() %$%  
 add_argument("foo", action = "flag")  

(also, TIL about scribe and it looks awesome)

dgkf,
@dgkf@fosstodon.org avatar

@barbone Ah, I didn't even think of that (and clearly didn't write out enough of the example to see it for myself). It would totally bite me half way through a script.

Mehrad, to emacs
@Mehrad@fosstodon.org avatar

I'm super interested to know/see the Venn diagram of :emacs: Emacs and :rstats: R users. 😏

I myself use Rstudio for work and Emacs ESS for my personal projects. So far I have managed to have a very comfortable setup for my Rstudio, but my ESS config can use some feedback/comment, especially from seasoned ESS users.

dgkf,
@dgkf@fosstodon.org avatar

@Mehrad is the assumption here that if you're not using emacs you're using rstudio? I was in the vim for R camp for a while and recently started using helix primarily.

dgkf, to random
@dgkf@fosstodon.org avatar

I just got a few extra Mastodon invites. If anyone has friends that are still stuck on bluesky or X, feel free to use my personalized invite codes (should work until invites run out, act fast!)

https://mastodon.social/auth/sign_up
https://fosstodon.org/auth/sign_up

If you’re looking for another instance, I might be able to ask around for a code.

dgkf,
@dgkf@fosstodon.org avatar

@benjaminhollon I had no idea! Thanks for the info! I just meant it tongue-in-cheek because I keep being reminded of the existence of bluesky, only because of their artificial scarcity invite program. A small nudge to people that they can advocate for things even if they aren’t exclusive.

claudius, to ps1graphics

I have this scan, which is essentially a bunch of points in 3d space. They are (seemingly?) randomly connected as edges and faces, in a way that makes no sense to me (or ).

This is a .obj file that was generated by a Laser-Line 3d scanner ~15 years ago. The object file starts with a comment saying "TecMath GmbH".

Do any of you have hints for me on how I could turn that into a usable mesh? Just good enough so that I can see the actual surface.

dgkf,
@dgkf@fosstodon.org avatar

@claudius I'm sure there are better tools out there, but if you're just looking for something quick you can use geonodes to make a volume from the points, then create a mesh from the shell of the volume.

You'll probably need to tinker with the point-to-volume radius and voxel size.

dgkf, to random
@dgkf@fosstodon.org avatar

On macOS. I misclicked and created an empty folder on my desktop. Naturally I then delete it. I’ve now been staring at a stalled progress bar for “Moving untitled folder to Trash” for 5 minutes. Finally broke down and popped open a terminal to give it the ol’ rmdir treatment.

For anyone who throws themselves at the feet of Apple in the name of superior UX, I’m just not seeing it.

mbonsma, to random
@mbonsma@mastodon.social avatar

I'm in a machine learning workshop and we're talking about image recognition and computer vision. I asked the facilitators, "Do you think self-driving cars will ever work?"
Them: "No, because of the sticker on your laptop."

The sticker:

@TheWarOnCars

dgkf,
@dgkf@fosstodon.org avatar

@mbonsma @TheWarOnCars the only thing holding me back from flaunting my pedestrian right of way at all times is the knowledge that there’s some (most likely under-caffeinated and mildly flustered) human driver just trying to get somewhere in a car-first world. If I start having to relinquish my right of way to empty automated vehicles…

https://slate.com/business/2023/07/autonomous-vehicles-traffic-cones-san-francisco-cruise-waymo-cpuc.html

Private
dgkf,
@dgkf@fosstodon.org avatar

@eliocamp @rstats

I like @noamross's bash solution for its modularity, but if you are set on a DIY R solution you can catch and re-emit messages with timestamps:

withCallingHandlers(
for (i in 1:3) {
message("Hello, World")
Sys.sleep(0.2)
},
condition = function(cond) {
message(Sys.time(), cond$msg)
}
)

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