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
4a59f7aa
Commit
4a59f7aa
authored
5 years ago
by
Daniel Olsson
Browse files
Options
Downloads
Patches
Plain Diff
Fixed first julia assignment
parent
c647f8a7
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
julia/dowhile.jl
+3
-2
3 additions, 2 deletions
julia/dowhile.jl
julia/run.jl
+6
-5
6 additions, 5 deletions
julia/run.jl
with
9 additions
and
7 deletions
julia/dowhile.jl
+
3
−
2
View file @
4a59f7aa
macro
doWhile
(
block
,
cond
)
macro
doWhile
(
block
,
cond
)
#println("__source__ ", __source__)
#
println("__source__ ", __source__)
#println("cond ", cond)
#println("cond ", cond)
#println("block ", block)
#println("block ", block)
...
@@ -11,6 +11,7 @@ macro doWhile(block, cond)
...
@@ -11,6 +11,7 @@ macro doWhile(block, cond)
$
(
esc
(
block
))
$
(
esc
(
block
))
end
end
end
end
println
(
res
)
# Should not print any lines referencing dowhile.jl
#print(__source__.line)
#println(res) # Should not print any lines referencing dowhile.jl
res
res
end
end
This diff is collapsed.
Click to expand it.
julia/run.jl
+
6
−
5
View file @
4a59f7aa
...
@@ -8,13 +8,14 @@ end
...
@@ -8,13 +8,14 @@ end
for
(
name
,
op
)
in
[(
:
add
,
:+
),
(
:
sub
,
:-
),
(
:
mul
,
:*
)]
for
(
name
,
op
)
in
[(
:
add
,
:+
),
(
:
sub
,
:-
),
(
:
mul
,
:*
)]
# Create a function that is named for example add and returns the
# Create a function that is named for example add and returns the
# sum of its two arguments
# sum of its two arguments
eval
(
quote
(
$
name
)(
x
,
y
)
=
eval
(
Expr
(
:
call
,
$
op
,
x
,
y
))
end
)
end
end
@assert
3
==
add
(
1
,
2
)
#@assert 3 == add(1, 2)
@assert
-
1.0
==
sub
(
1.0
,
2.0
)
#@assert -1.0 == sub(1.0, 2.0)
@assert
"abc"
==
mul
(
"ab"
,
"c"
)
#@assert "abc" == mul("ab", "c")
"""Reflective programming often has to do with accessing or creating functions
"""Reflective programming often has to do with accessing or creating functions
at runtime, but it is so similar to template programming that you could
at runtime, but it is so similar to template programming that you could
...
...
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