Communities

Writing
Writing
Codidact Meta
Codidact Meta
The Great Outdoors
The Great Outdoors
Photography & Video
Photography & Video
Scientific Speculation
Scientific Speculation
Cooking
Cooking
Electrical Engineering
Electrical Engineering
Judaism
Judaism
Languages & Linguistics
Languages & Linguistics
Software Development
Software Development
Mathematics
Mathematics
Christianity
Christianity
Code Golf
Code Golf
Music
Music
Physics
Physics
Linux Systems
Linux Systems
Power Users
Power Users
Tabletop RPGs
Tabletop RPGs
Community Proposals
Community Proposals
tag:snake search within a tag
answers:0 unanswered questions
user:xxxx search by author id
score:0.5 posts with 0.5+ score
"snake oil" exact phrase
votes:4 posts with 4+ votes
created:<1w created < 1 week ago
post_type:xxxx type of post
Search help
Notifications
Mark all as read See all your notifications »

Activity for Arpad Horvath‭

Type On... Excerpt Status Date
Edit Post #290104 Post edited:
Thanks
about 1 year ago
Comment Post #290104 The problem is fixed, and thanks to the walrus operator I can still use the lambda function. And it is even shorter than the wrong version.
(more)
about 1 year ago
Edit Post #290104 Post edited:
More readable version
about 1 year ago
Comment Post #290106 I can do f=(\n->(scanl(*)1$cycle[5,2])!!(length$takeWhile(/=n)"IVXLCDM")) but without the parenthesis it failes. You use the parenthesis after the map, and Haskell don't need a parenthesis after the function name just to call the function. It is needed to show what exactly is the first argumen...
(more)
about 1 year ago
Edit Post #290104 Post edited:
Comment
about 1 year ago
Edit Post #290104 Post edited:
walrus to be able to use lambda
about 1 year ago
Comment Post #290104 I've changed both. I made lambda functions from both expressions. Is this enough?
(more)
about 1 year ago
Edit Post #290106 Post edited:
about 1 year ago
Edit Post #290104 Post edited:
about 1 year ago
Edit Post #290106 Post edited:
about 1 year ago
Edit Post #290106 Post edited:
about 1 year ago
Edit Post #290106 Post edited:
about 1 year ago
Edit Post #290106 Initial revision about 1 year ago
Answer A: Single digit Roman numeral
Haskell, 62 bytes ``` (\n->(scanl()1$cycle[5,2])!!(length$takeWhile(/=n)"IVXLCDM")) ``` No import needed. It just uses standard Prelude functions. ``` scanl()1$cycle[5,2] ``` will give you the infinite list of [1,5,10,50...]. With ``` length$takeWhile(/=n)"IVXLCDM" ``` you ...
(more)
about 1 year ago
Edit Post #290104 Initial revision about 1 year ago
Answer A: Single digit Roman numeral
Python 3.8+, 51 byte ```python lambda n:((i:="IVXLCDM".index(n))%24+1)10(i//2) ``` Testing the code: ```python f=lambda n:((i:="IVXLCDM".index(n))%24+1)10(i//2) for s in "IVXLCDM": print(s, f(s)) ``` The walrus operator stores the index in the variable `i`, that is used in the...
(more)
about 1 year ago