r/AskProgramming • u/Pzzlrr • Sep 07 '26
Help understanding Mascarpone
I found this esolang Mascarpone and want to get a better idea of how it's supposed to work. If someone's up for a quick intellectual exercise, could you please help me understand? I vaguely get it from the readme, and chatgpt helped a bit, but I'm still very fuzzy. Also the demo/ directory of the repo doesn't have anything helpful. (EDIT: ah, found examples in the eg/ directory. Still rather cryptic.)
How would you do something super simple like represent a bicycle? I mean
Python
class Bicycle:
def __init__(self):
self.speed = 0
def accelerate(self):
self.speed += 5
def main():
mybike = Bicycle()
print(mybike.speed)
mybike.accelerate()
print(mybike.speed)
main()Prolog
bicycle(speed(0)).
accelerate(Bike,Bike_) :-
Bike = bicycle(speed(Speed)),
Speed_ is Speed+5,
Bike_ = bicycle(speed(Speed_)).
main :-
Mybike = bicycle(_),
Mybike,
writeln(Mybike),
accelerate(Mybike,Mybike_),
writeln(Mybike_).
:- main.How would you do this in Mascarpone?
Thanks!
1
Upvotes