@coolbutuseless@fosstodon.org
@coolbutuseless@fosstodon.org avatar

coolbutuseless

@coolbutuseless@fosstodon.org

Nerd.

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

coolbutuseless, to random
@coolbutuseless@fosstodon.org avatar

Today I am pleased to annouce the c64-verse!

I trio of packages for c64 development in

  1. {c64vice} talks to a running VICE c64 emulator to send/receive info, cpu registers, memory dumps etc

  2. {c64asm} is a revamp of {r64}, a pure-R assembler for c64 6502 machine code - including syntax for including R data into code

  3. {c64tass} a wrapper for TASS - the de factor standard in c64 assemblers.

Logo for c64tass package. A hexagon with a Commodore computing logo in the centre.
Logo for c64asm package. A hexagon with a Commodore computing logo in the centre.
Logo for c64vice package. A hexagon with a Commodore computing logo in the centre.

coolbutuseless,
@coolbutuseless@fosstodon.org avatar

Currently, with {c64asm}, you can compile 6502 assembly to machine code, incorporate data and text from R objects, and use calculations on R variables when compiling.

Once compiled to standard c64 program format (.prg), you can inject the program directly into a running VICE c64 emulator using {c64vice}.

The ultimate desired workflow is using RStudio as a c64 IDE.

coolbutuseless,
@coolbutuseless@fosstodon.org avatar

With {c64vice} R communicates with the VICE emulator over a socketConnection() to send/receive requests/responses.

This allows for things such as:

  • Getting/setting memory
  • Manipulating the program counter
  • Dumping the full machine state
  • Injecting text into the keyboard buffer
  • Taking screenshots.

In the example pictured, {c64asm} used to compile code, {c64vice} used to inject code into VICE emulator and run it.

Screenshot showing how {c64vice} can be used to construct and send requests to a running VICE c64 emulator.
Screenshot taken from VICE using a command sent from R

coolbutuseless,
@coolbutuseless@fosstodon.org avatar

{c64asm} is based on an older package of mind called {r64}, but it has been tidied up and simplified a bit.

{c64tass} used to reside within the {c64asm} package but was split off for the sake of simplicity.

{c64vice} is totally new and makes development faster as you can set memory and breakpoints in the machine much much easier than trying to do so from the command line.

coolbutuseless, to random
@coolbutuseless@fosstodon.org avatar

Excluding {spongebob} what's the weirdest, most useless package on CRAN?

Https://cran.dev/SpongeBob

gabbspalomo, to random
@gabbspalomo@fosstodon.org avatar

Wait a minute. So there’s purrr and furrr. So furrr is purrr but in parallel? 🙀 Is this correct? Oh I am so going to learn more about furrr now! Also what’s up with those names? 😹😹😹

coolbutuseless,
@coolbutuseless@fosstodon.org avatar

@hrbrmstr would using {yyjsonr} instead of {jsonlite} help here at all?

@rmflight @gabbspalomo

coolbutuseless, to random
@coolbutuseless@fosstodon.org avatar

Package suggestions wanted:

From R, I want to send raw bytes to a server and receive raw bytes back.

It's not a HTTP server.

What packages do you recommend?

coolbutuseless,
@coolbutuseless@fosstodon.org avatar

@gaborcsardi socketconnection() worked! Thanks for the tip.

coolbutuseless, to random
@coolbutuseless@fosstodon.org avatar

Waiting for videos to come online ...

coolbutuseless, to random
@coolbutuseless@fosstodon.org avatar

Nothing says safety like running "eval(parse(text = string)))" on input from the user.

coolbutuseless,
@coolbutuseless@fosstodon.org avatar

@Mehrad fork bomb?

coolbutuseless, to random
@coolbutuseless@fosstodon.org avatar

If anyone manages to produce this error, I will grant you a gold star.

"math1 compiler/interpreter mismatch"

I'd also be very interested to hear how you got there!

This almost seems like a superfluous check that could be dropped for a 0.000001% speed increase.

coolbutuseless,
@coolbutuseless@fosstodon.org avatar

@LukeTierney4 :)

I realise the check is probably there to ensure the math1 ops don't get out of order between R and C.

It was interesting to find an error that could not be triggered by doing something in R.

coolbutuseless, to Discord
@coolbutuseless@fosstodon.org avatar

I passed 3 "Are you human?" checks, reset my password, and did authentication for signing in from a new location.

I'm now on discord and remembering it's an incomprehensible interface of colour and movement :)

coolbutuseless,
@coolbutuseless@fosstodon.org avatar

@jonthegeek Maybe there should be an #I'mTooOldForThis :)

coolbutuseless, to random
@coolbutuseless@fosstodon.org avatar

Anyone familiar with WASM/webr? i.e. running R via WASM in the browser.

Is it running the R interpreter in WASM, or is it running the JIT compiled R bytecode?

I have code that I think can tell whether it's running interpreted or compiled - and it thinks that the WASM webR is only running the R interpreter.

https://docs.r-wasm.org/webr/latest/

@gws

milesmcbain, to random
@milesmcbain@fosstodon.org avatar

Vector index recycling is convenient but it would be really great if core could sort it so that it plays a sound effect of some chimes tinkling when it’s happening so I know to check I want that magic right now. Next R sprint maybe? ✨🧙‍♂️🪄

coolbutuseless,
@coolbutuseless@fosstodon.org avatar

@milesmcbain I'd appreciate only recycling for length = 1.

All other cases you have to do an explicit rep() / rep_along()

coolbutuseless, to random
@coolbutuseless@fosstodon.org avatar

{yyjsonr} Update v0.1.7. Fast read/write of JSON/GeoJSON/NDJSON.

I did a great renaming of the user-facing functions.

It's not perfect, but it's better than it was before (see image).

https://github.com/coolbutuseless/yyjsonr

Table showing comparison of features across R JSON packages.
Image showing speed comparison of R JSON packages.

coolbutuseless, to random
@coolbutuseless@fosstodon.org avatar

relax-a-coding

library(magick)
i <- image_read(system.file("img", "Rlogo.png", package="png"))
i <- image_scale(i, geometry_size_percent(100, 50))
i <- image_data(i)[2,,]
d <- dim(i)
i <- c(' ',"\u00B7","\U2025","\U1805","\u238a")[cut(as.integer(i), 5, F)]
i <- matrix(i, d[1], d[2])
cat(apply(i, 2, (x) paste(x, collapse = '')), sep="\n")

image/png

coolbutuseless, to random
@coolbutuseless@fosstodon.org avatar

one-liner wanted:

Turn a character vector into a 0-indexed character vector.

Shortest answer wins*

  • winnings = 10 Shrute bucks
hrbrmstr, to random
@hrbrmstr@mastodon.social avatar
coolbutuseless,
@coolbutuseless@fosstodon.org avatar

@hrbrmstr if only there were more hours in the day!

coolbutuseless, to random
@coolbutuseless@fosstodon.org avatar

{yyjsonr} package for fast read/write of json, geojson and ndjson.

Update v0.1.6

  • more compatibility options w.r.t. jsonlite
  • bugfixes for geojson GeometryCollection
  • refactor of test infrastructure for geojson comparisons with reference objects when attributes differ only in sort order.

https://github.com/coolbutuseless/yyjsonr

Screenshot of test counts for yyjsonr package.

coolbutuseless, to random
@coolbutuseless@fosstodon.org avatar

the {emphatic} package got an update!

In addition to programmable highlighting of data.frames (see the following toot) it now also:

  • Highlights string differences - hl_str_diff()
  • colours regular expression matching.

Outputs to console, html and SVG (with a bit of wrangling).

https://github.com/coolbutuseless/emphatic

Screenshot showing how the "emphatic" package can highlight regular expression matching with ANSI colouring.
Screenshot showing how the "emphatic" package can highlight data.frame elements with ANSI colouring using regular expressions.

coolbutuseless, to random
@coolbutuseless@fosstodon.org avatar

Recently I learned (by RTFMing) that all(?) tests in {testthat} support a 'label' argument to produce more verbose error messages.

I've found this handy when I have lots of test inputs and reference results stored in a named lists:

for (nm in names(test)) {
expect_equal(test[[nm]], ref[[nm]], label = nm)
}

coolbutuseless, to random
@coolbutuseless@fosstodon.org avatar

Free internals idea:

Add support for 3-digit hex colours e.g. ""

File to change: src/library/grDevices/src/color.c

Need to

  • add a "case 4:" to the switch statement
  • Write 4 lines of code. (including a break statement)
  • Change Line:1365 to include case when strlen = 4

Anyone else annoyed by this?

coolbutuseless,
@coolbutuseless@fosstodon.org avatar

It's been less than 3 days, and thanks to pmur002, @malcolmbarrett @ellakaye and everyone else at a patch has been made and accepted into R!!

R now supports 3 and 4 digit hex codes!

https://github.com/wch/r-source/commit/0cad8c3fa75f402db464cbfde93284106a12a69f

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