Advertisement · 728 × 90
#
Hashtag
#macros
Advertisement · 728 × 90
Can we have the Standard Library for Macros?

Here are slides from by talk at @scalar-conf.com about #macros in #scala

mateuszkubuszok.github.io/ScalaStandar...

2 0 0 0
use loess::quote_into_mixed_site;
use proc_macro2::{Span, TokenStream};

fn my_quote(span: Span, root: &TokenStream, output: &mut TokenStream) {
	quote_into_mixed_site!(span, root, output, {
	
		// Emits `b`.
		{#if false {
			a
		} else {
			b
		}}
		
		// Emits `e`.
		{#if false {
			a
		} else for _ in 0..0 {
			b
		} else while let Some(0) = None {
			c
		} else match 0 {
			1 => { d }
			_ => { e }
		}}
	
	});
}

use loess::quote_into_mixed_site; use proc_macro2::{Span, TokenStream}; fn my_quote(span: Span, root: &TokenStream, output: &mut TokenStream) { quote_into_mixed_site!(span, root, output, { // Emits `b`. {#if false { a } else { b }} // Emits `e`. {#if false { a } else for _ in 0..0 { b } else while let Some(0) = None { c } else match 0 { 1 => { d } _ => { e } }} }); }

Interlaced (procedural) templating can be really nice I think, as long as the syntax is clean and bracket-nesting is strict.

This loess macro is pretty clean too by the way, it's (mostly) not a muncher and you can use `{#raw { … }}` to emit long runs of token trees more efficiently also at runtime.

0 0 1 0

why do protein bars and drinks have to taste like chalk

who hurt you

"food is fuel, not fun!"

I shouldnt have to eat a damn floor tile to get my macros, bub

#protein #macros

0 0 0 0
Preview
a man in a suit and tie is screaming and saying it was me ! ALT: a man in a suit and tie is screaming and saying it was me !

#ibefartin #protein #macros

according a macros calculator, I need 269 (nice) grams of protein

sooooo much

I'mma be like

0 0 0 0
Preview
GitHub - nguyenyou/circe-sanely-auto: Sanely-automatic Encoder/Decoder derivation for Circe on Scala 3 Sanely-automatic Encoder/Decoder derivation for Circe on Scala 3 - nguyenyou/circe-sanely-auto

One more proof by construction that we can improve derivation in #scala with #macros:

github.com/nguyenyou implemented sanely automatic derivation for Circe, and got some really nice numbers.

github.com/nguyenyou/ci...

1 0 0 0
Preview
Blue Lake Regional Park in Portland, Oregon is a great place for Nature Photography! — Joe's Notes Shot with Canon 80D Tamron 70-300 and Canon 100mm Macro Blue Lake Follow me on Instagram @g_grins and @fractalfocus.nature CLICK TO ENLARGE

Photo Journal 10/11/2021 (Blue Lake)

joesnotesblog.com/blog/photo-j...

#birds #blog #BlueLake #flowers #journal #nature #naturephotography #OR #Oregon #photoblog #photography #PNW #Portland #squirrel #ducks #ducks #parks #waterfowl #macros #macrophotography #mushrooms

9 0 0 0

Last night's bacon cheese fries are this morning's breakfast hash #health #protein #macros

2 0 0 0

Last week I went out for a Friday night beer with friends, and left Claude running. After recent batches of improvements I hoped that Hearth was finally at the stage when I would be able to write a whole type class derivation with no bugs in my macro utilities. #scala #macros

0 0 1 0
A close-up photograph showcases the vibrant pink blooms of a cactus, emphasizing their intricate details and lively yellow centers, symbolizing the beauty of desert flora.

A close-up photograph showcases the vibrant pink blooms of a cactus, emphasizing their intricate details and lively yellow centers, symbolizing the beauty of desert flora.

Barrel cactus bloom. Found in the White Tank hills in Arizona.

#photography #macros #macrophotography #flowers #cactus

20 0 0 0
Post image

Morning Two-spotted Longhorn #Bee on Cosmo #flower from my summer #Philly #garden. 🌞 #FlyDay #macros #pollinator #insects #nature #eastcoastkin #bugsky

47 2 1 0
Post image

Here comes the sun
#winter #frozen #bubbles #monday #sunrise #akron #ohio #macro #macrophotography #macros #macrophoto

4 0 0 0
Frozen soap bubble catching the light of the sunset - looks like a fiery ice ball

Frozen soap bubble catching the light of the sunset - looks like a fiery ice ball

Frozen sunrise
#winter #frozen #bubbles #fire #sunset #akron #ohio #macro #macrophotography #macros #macrophoto

7 2 0 0
Post image

#Makros #Insekten #Makrofotografie #Macros #Insects #Fotografie #Foto #Close-up #Macrophotographie #Photographie

7 0 0 0
Post image

#Makros #Insekten #Makrofotografie #Macros #Insects #Fotografie #Foto #Close-up #Macrophotographie #Photographie

4 0 0 0
Soap bubble freezing

Soap bubble freezing

Frozen sunrise
#winter #frozen #bubbles #rainbow #sunrise #akron #ohio #macro #macrophotography #macros

4 0 0 0
water droplet reflecting a Japanese maple

water droplet reflecting a Japanese maple

Water droplet and flower

Water droplet and flower

Experimenting with #macros of #water #droplets after some much needed #rain.

#macro #macrophotography #closeup #photography #reflections #waterIsLife #nikon #nature #naturePhotography

33 3 0 0

Saturday protein check: if your lunch had less than 25g of protein, that wasn't lunch. That was a snack with ambitions.

Track it. Fix it. Repeat.

#macros #protein #nutrition

0 0 0 0
A fierce predator with venomous front legs:  the Centipede, Lithobiidae sp
A fierce predator with venomous front legs: the Centipede, Lithobiidae sp YouTube video by Sylvia Meller

A fierce predator, it feeds on small invertebrates such as insects and spiders. It is nocturnal, using its venomous front legs (forcipules) to paralyze prey.
#UKWildlife, #UKNature, #Invertebrates, #Macros, #Wildlife, #Nature
youtu.be/Do4XqSveGH4

2 0 0 0
A striking close-up image of an Echinacea flower showcases its vibrant orange and yellow petals surrounded by a blurred natural background, highlighting the intricate details of its structure.

A striking close-up image of an Echinacea flower showcases its vibrant orange and yellow petals surrounded by a blurred natural background, highlighting the intricate details of its structure.

Very new prairie coneflower from spring of 25.

#photography #macrophotography #macros #flowers

22 0 0 0

Saturday morning protein check: if your breakfast had less than 25g of protein, that wasn't breakfast. That was a snack with ambition.

Track it. Know it. Fix it. chowdown.me is free forever 🍳

#macros #proteinintake #caloriecounting

0 0 0 0
Frozen bubble catching the morning sunrise

Frozen bubble catching the morning sunrise

Frozen sunrise
#winter #frozen #bubbles #rainbow #sunrise #akron #ohio #macro #macrophotography #macros

4 0 0 0

A Greggs sausage roll: 19g of protein.

A £3.50 "protein bar" from the gym: 20g of protein.

One costs 65p and brings genuine joy. The other tastes like chocolate-flavoured ambition.

Track your food for a week. Protein is hiding everywhere.

#macros #protein #sausageroll

0 0 0 0
Today I've been playing around with Immutable.js as a library that supplies immutable collection for JavaScript and TypeScript.

Something that's relatively annoying at first sight (cause _verbose_) is how they handle typed Objects (_Records_).

I'm not completely sure yet, but I _think_ in TypeScript you want to declare sums of products using those records something like this:

```js
import { Record } from 'immutable'

type IdleT = { kind: 'Idle' }
type Idle = Record<IdleT>
const Idle = Record<IdleT>({ kind: 'Idle' })

type TrackT = { id: string; url: string; title: string }
type Track = Record<TrackT>
const Track = Record<TrackT>({ id: '', url: '', title: '' })

type LoadingT = { kind: 'Loading'; track: Track }
type Loading = Record<LoadingT>
const Loading = Record<LoadingT>({ kind: 'Loading', track: Track() })
// ..

export type State = Idle | Loading // | ..
```

This is, compared to

```js
export type Track = { id: string; url: string; title: string }

type Idle = { kind: 'Idle' }
type Loading = { kind: 'Loading'; track: Track }
// ..


export type State = Idle | Loading // | ..
```

quite the feat syntax-wise.

It can be alleviated a bit by doing something like this:

```js

export const makeRecord = <T extends object>(defaults: T) => Record<T>(defaults)

const Idle = makeRecord({ kind: 'Idle' as const })
type Idle = RetureType<typeof Idle>
```

But even that is still double the code and more mental workload payed as a price for immutability.

So I wondered:

> Are there people writing Macros in TypeScript?

And as it turns out, there are:

- ts-macros
- macro-ts

But nope, I'm not gonna use them.

Today I've been playing around with Immutable.js as a library that supplies immutable collection for JavaScript and TypeScript. Something that's relatively annoying at first sight (cause _verbose_) is how they handle typed Objects (_Records_). I'm not completely sure yet, but I _think_ in TypeScript you want to declare sums of products using those records something like this: ```js import { Record } from 'immutable' type IdleT = { kind: 'Idle' } type Idle = Record<IdleT> const Idle = Record<IdleT>({ kind: 'Idle' }) type TrackT = { id: string; url: string; title: string } type Track = Record<TrackT> const Track = Record<TrackT>({ id: '', url: '', title: '' }) type LoadingT = { kind: 'Loading'; track: Track } type Loading = Record<LoadingT> const Loading = Record<LoadingT>({ kind: 'Loading', track: Track() }) // .. export type State = Idle | Loading // | .. ``` This is, compared to ```js export type Track = { id: string; url: string; title: string } type Idle = { kind: 'Idle' } type Loading = { kind: 'Loading'; track: Track } // .. export type State = Idle | Loading // | .. ``` quite the feat syntax-wise. It can be alleviated a bit by doing something like this: ```js export const makeRecord = <T extends object>(defaults: T) => Record<T>(defaults) const Idle = makeRecord({ kind: 'Idle' as const }) type Idle = RetureType<typeof Idle> ``` But even that is still double the code and more mental workload payed as a price for immutability. So I wondered: > Are there people writing Macros in TypeScript? And as it turns out, there are: - ts-macros - macro-ts But nope, I'm not gonna use them.

TypeScript Macros

#TypeScript #Macros #FunctionalProgramming #Immutable.js

1 0 1 0
We found a (Pseudo) Scorpion!!!
We found a (Pseudo) Scorpion!!! YouTube video by Sylvia Meller

Looking through the leaf litter, under rocks and roots in the woods we found a scorpion!
Well, not a real one with a venomous sting , but a Pseudoscorpion.
#UKWildlife, #Wildlife, #Invertebrates , #Arachnophiles, #Macros
youtu.be/_qSg9c3FJA0

5 0 0 0
Post image Post image Post image Post image

High Calorie Nutrition without Junk Bulking 🥗🥩

🥔 Use “clean calorie density” staples

🫒 Add calories through “mix-ins,” not extra meals

🥤 Lean on liquid calories when appetite is the bottleneck

#nutrition #diet #calories #protein #macros

0 0 0 0
Post image

Setting up button designs for my Elgato Stream Deck! I didn't save the old profile when I was updating my PC, but I think it's time to make a fresh profile anyways.

Got the first page sorted, now... what else to add?

#twitch #streamer #streaming #macros

0 0 0 0
Post image Post image Post image Post image

Training Day 🆚 Rest Day Nutrition 🥗

These points matter because they let you lose fat without sacrificing gym performance or muscle.

🍗 Keep protein the same on both days.

🍞 Shift carbs toward training days.

🫒 Let fats “fill the gap” on rest days.

#nutrition #diet #calories #macros

0 0 0 0
Post image Post image

#dinner and #macros for today!
I would have taken a picture of the delicious burger that my partner made for me, but I was so fat I inhaled it 😁 hopefully we can get some rest and not get called in. Sweet dreams, munchkins!

#weightlossjourney
#delicious
#meals

0 0 0 0
Post image Post image Post image Post image

🥩 High Protein Snack Swaps 🍗

Protein snack swaps matter because they let you increase muscle-building nutrition without “trying harder.”

You keep the same snacking habit, but you change what that habit does for your body.

🎯 Aim for 15–30g Protein Per Snack

#highprotein #macros #snacks #diet

0 0 0 0

It always makes me apprehensive when I write #lisp #macros but when it comes together and works… there’s nothing quite like it!

1 0 0 0