Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
G
Guix
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ogs
inf
Guix
Commits
593c3fe6
Commit
593c3fe6
authored
11 years ago
by
Ludovic Courtès
Browse files
Options
Downloads
Patches
Plain Diff
monads: Fix 'anym'.
* guix/monads.scm (anym): Fix successful case. * tests/monads.scm ("anym"): New test.
parent
f7faff88
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
guix/monads.scm
+4
-3
4 additions, 3 deletions
guix/monads.scm
tests/monads.scm
+12
-0
12 additions, 0 deletions
tests/monads.scm
with
16 additions
and
3 deletions
guix/monads.scm
+
4
−
3
View file @
593c3fe6
...
@@ -228,9 +228,10 @@ (define (anym monad proc lst)
...
@@ -228,9 +228,10 @@ (define (anym monad proc lst)
(()
(()
(
return
#f
))
(
return
#f
))
((
head
tail
...
)
((
head
tail
...
)
(
mlet
monad
((
value
head
))
(
mlet*
monad
((
value
head
)
(
or
(
and=>
(
proc
value
)
return
)
(
result
->
(
proc
value
)))
head
(
if
result
(
return
result
)
(
loop
tail
))))))))
(
loop
tail
))))))))
(
define-syntax
listm
(
define-syntax
listm
...
...
This diff is collapsed.
Click to expand it.
tests/monads.scm
+
12
−
0
View file @
593c3fe6
...
@@ -163,6 +163,18 @@ (define (frob i)
...
@@ -163,6 +163,18 @@ (define (frob i)
%monads
%monads
%monad-run
))
%monad-run
))
(
test-assert
"anym"
(
every
(
lambda
(
monad
run
)
(
eq?
(
run
(
with-monad
monad
(
let
((
lst
(
list
(
return
1
)
(
return
2
)
(
return
3
))))
(
anym
monad
(
lambda
(
x
)
(
and
(
odd?
x
)
'odd!
))
lst
))))
'odd!
))
%monads
%monad-run
))
(
test-end
"monads"
)
(
test-end
"monads"
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment