random must take a dict #45

Closed
opened 2024-05-23 17:29:42 +00:00 by scott · 2 comments
Owner

Should have a clause (d as :dict) that selects a random member.

Expected: returns a random member of a dict.
Actual: panics with a match error.

Should have a clause `(d as :dict)` that selects a random member. Expected: returns a random member of a dict. Actual: panics with a match error.
scott added the
bug
now
labels 2024-05-23 21:00:22 +00:00
scott added this to the Computer Class milestone 2024-05-23 21:00:24 +00:00
scott self-assigned this 2024-05-23 21:00:28 +00:00
Author
Owner

Here's the actual error: not a problem with a missing clause, but a problem with the code in the matching clause:

random(#{:a 1, :b 2}) 

& => Ludus panicked!: Match Error: No match found for (#{:a 1, :b 2}, :a) in function get
On line 879 in prelude
		get (d, key)

I think I just got get backwards: should be get(:a, #{:a 1, :b 2})?

Here's the actual error: not a problem with a missing clause, but a problem with the code in the matching clause: ``` random(#{:a 1, :b 2}) & => Ludus panicked!: Match Error: No match found for (#{:a 1, :b 2}, :a) in function get On line 879 in prelude get (d, key) ``` I think I just got `get` backwards: should be `get(:a, #{:a 1, :b 2})`?
Author
Owner

Fixed with 9db10edd5c

Fixed with https://alea.ludus.dev/twc/ludus/commit/9db10edd5cc9853b296257cdb15382f9524d6ed0
scott closed this issue 2024-06-07 20:48:16 +00:00
Sign in to join this conversation.
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: twc/ludus#45
No description provided.