Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
lab5-metaprogramming-and-debugging-lab
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor 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
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Daniel Olsson
lab5-metaprogramming-and-debugging-lab
Commits
5cd8e705
Commit
5cd8e705
authored
5 years ago
by
Daniel Olsson
Browse files
Options
Downloads
Patches
Plain Diff
Try commit
parent
9aff870b
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
julia/run.jl
+12
-0
12 additions, 0 deletions
julia/run.jl
with
12 additions
and
0 deletions
julia/run.jl
+
12
−
0
View file @
5cd8e705
...
...
@@ -4,8 +4,20 @@ in the blanks, but most parts of the code are very similar."""
for
(
name
,
op
)
in
[(
:
add
,
:+
),
(
:
sub
,
:-
),
(
:
mul
,
:*
)]
# Create a function that is named for example add and returns the
# sum of its two arguments
#name = eval(Expr(:call, op, 1, 1))
function
temp
(
x
,
y
)
return
eval
(
Expr
(
:
call
,
op
,
x
,
y
))
end
print
(
name
)
name
=
temp
println
(
" for 1 and 1"
)
println
(
name
(
1
,
1
))
end
@assert
3
==
add
(
1
,
2
)
@assert
-
1.0
==
sub
(
1.0
,
2.0
)
@assert
"abc"
==
mul
(
"ab"
,
"c"
)
...
...
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