首页
网站开发
桌面应用
管理软件
微信开发
App开发
嵌入式软件
工具软件
数据采集与分析
其他
首页
>
> 详细
program程序代写、代做Java,Python编程
项目预算:
开发周期:
发布时间:
要求地区:
• For questions involving answers in English or mathematics or a combination of the two, put your
answers to the question in an answer box like in the example below.
• For programming questions, please put your answers into a file called ps2-lastname-firstname.clj.
Be careful to follow the instructions exactly and be sure that all of your function definitions use the
precise names, number of inputs and input types, and output types as requested in each question.
For the code portion of the assignment, it is crucial to submit a standalone file that runs.
Before you submit ps2-lastname-firstname.clj, make sure that your code executes correctly without
any errors when run at the command line by typing clojure ps2-lastname-firtname.clj at a terminal
prompt. We cannot grade any code that does not run correctly as a standalone file, and if the preceding
command produces an error, the code portion of the assignment will receive a 0.
To do the computational problems, we recommend that you install Clojure on your local machine and
write and debug the answers to each problem in a local copy of ps2-lastname-firstname.clj. You can
find information about installing and using Clojure here https://clojure.org/.
Note there is a built-in function called reverse. Do not use the built-in function reverse in this
problem set! We remove reverse from the namespace when we grade, so using it anywhere will lead
to an error and a result in a 0.
Once you have entered your answers, please compile your copy of this LATEX file1
into a PDF and submit
(i) the compiled PDF renamed to ps2-lastname-firstname.pdf
(ii) the raw LATEX file renamed to ps2-lastname-firstname.tex and
(iii) your ps2-lastname-firstname.clj
to the Problem Set 2 folder under ‘Assignments’ on MyCourses.
Example Problem: This is an example question using some fake math like this L =
P∞
0
Gδx.
Example Answer: Put your answer in the box provided, like this:
Example answer is L =
P∞
0
Gδx.
1To compile a file file.tex to file.pdf, you can use the command pdflatex file.tex at the command line, or make use of an
online service such as https://overleaf.com. You can find more information about LATEX here https://www.latex-project.org/.
1
MAIN PROBLEM SET
Problem 1: Write a single-argument function called absval that, when passed a number, computes its
absolute value. It should do this by finding the square root of the square of the argument. (Note: you should
use the Math/sqrt function built in to Clojure (from Java), which returns the square root of a number.)
Answer 1: Please put your answer in ps2-lastname-firstname.clj.
Problem 2: In both of the following definitions, there are one or more errors of some kind. In each case,
explain what’s wrong and why, and fix it:
(defn take-square
(* x x))
(defn sum-of-squares [(take-square x) (take-square y)]
(+ (take-square x) (take-square y)))
Answer 2: Please put the fixed functions in ps2-lastname-firstname.clj and describe what is wrong
and why in the box below.
Problem 3: The expression (+ 11 2) evaluates to 13. Write four other different Clojure expressions which
also evaluate to the number 13 (either the integer 13 or the float 13.0). Using def, assign these expressions
to the symbols exp-13-1, exp-13-2, exp-13-3, and exp-13-4.
In each def statement, be sure to quote the expression (as below for our example), so it is not evaluated
before being assigned to the symbol.
(def exp-13-0 '(+ 11 2))
Answer 3: Please put your answer in ps2-lastname-firstname.clj.
Problem 4: Define a function called third, that selects the third element of a list. For example, given the
list '(4 5 6) as its argument, third should return the number 6.
Answer 4: Please put your answer in ps2-lastname-firstname.clj.
Problem 5: Define a function called compose, that takes two one-place functions f and g as arguments.
It should return a new function, the composition of its input functions, which computes f of g of x when
passed the argument x. For example, the function Math/sqrt (built in to Clojure from Java) takes the square
root of a number, and the function Math/abs (likewise) takes the absolute value of a number. If we use defn
to define functions sqrt and abs as
(defn sqrt [x] (Math/sqrt x))
(defn abs [x] (Math/abs x))
then ((compose sqrt abs) -36) should return 6, since the square root of the absolute value of -36 equals 6.
2
Answer 5: Please put your answer in ps2-lastname-firstname.clj.
Problem 6: Define a function called first-two that takes a list as its sole argument, and returns a
two-element list containing the first two elements of the argument. For example, given the list '(4 5 6),
first-two should return the list '(4 5).
You may assume that the list passed in has at least two elements.
Answer 6: Please put your answer in ps2-lastname-firstname.clj.
Problem 7: Define a function called remove-second that takes a list, and returns a new list that is the
same as the input list, but with the second value removed. For example, given '(3 1 4), remove-second
should return the list '(3 4).
Answer 7: Please put your answer in ps2-lastname-firstname.clj.
Problem 8: Define a function called add-to-end that takes in two arguments: a list lst and a value x. It
should return a new list which is the same as lst, except that it has x appended as its final element. For
example, (add-to-end (list 5 6 4) 0) should return the list '(5 6 4 0).
Answer 8: Please put your answer in ps2-lastname-firstname.clj.
Problem 9: Define a function called reverse-list, that takes in a list, and returns the reverse of the list.
For example, if it takes in the list '(a b c), it will output the list '(c b a).
Do not use the built-in function reverse (in this problem, nor anywhere in this problem set).
Answer 9: Please put your answer in ps2-lastname-firstname.clj.
Problem 10: Define a function called count-to-1, that takes a positive integer n, and returns a list of the
integers counting down from n to 1. For example, given input 3, it will return the list (list 3 2 1).
Answer 10: Please put your answer in ps2-lastname-firstname.clj.
Problem 11: Define a function called count-to-n, that takes a positive integer n, and returns a list of the
integers from 1 to n. For example, given input 3, it will return the value of (list 1 2 3).
Hint: Use the procedures reverse-list and count-to-1 that you wrote in the previous problems.
Answer 11: Please put your answer in ps2-lastname-firstname.clj.
3
Problem 12: Define a function called get-max, that takes a list of numbers, and returns the maximum
value. So, (get-max '(2 3 3)) should return 3.
Don’t use the built-in max function.
Answer 12: Please put your answer in ps2-lastname-firstname.clj.
Problem 13: Define a function called greater-than-five?, that takes a list of numbers, and returns a list
of equal length to the input list, but where each number is replaced with true if the number is greater than
5, and false otherwise. For example, given input (list 5 4 7), it will return the list '(false false true).
Hint: Use the built in function map.
Answer 13: Please put your answer in ps2-lastname-firstname.clj.
Problem 14: Define a function called concat-three, that takes three sequences (represented as lists), x,
y, and z, and returns the concatenation of the three sequences. For example, given the arguments (list 'a
'b), (list 'b 'c), and (list 'd 'e), the procedure should return the value of (list 'a 'b 'b 'c 'd 'e).
Don’t use the built-in concat function.
Answer 14: Please put your answer in ps2-lastname-firstname.clj.
Problem 15: Define a function called sequence-to-power, that takes a sequence (represented as a list) x,
and a nonnegative integer n, and returns the sequence x
n. For example, given the sequence (list 'a 'b) as
the first argument and the number 3 as the second, the procedure should return the value of (list 'a 'b
'a 'b 'a 'b).
You may use the built-in concat function for this problem.
Answer 15: Please put your answer in ps2-lastname-firstname.clj.
Problem 16: Define L as a language containing a single sequence, L = {a}.
In Clojure, we can represent the sequence a as the list '(a).
Define a function called in-L-star? that takes a sequence (represented as a list), and returns true if and
only if the sequence is a member of the language L
∗
. For example, given a sequence such as '(a b), the
procedure should return false, because ab is not a member of L
∗
.
Answer 16: Please put your answer in ps2-lastname-firstname.clj.
Problem 17: Let A and B be two distinct formal languages. We’ll use (A·B) to denote the concatenation
of A and B, in that order. Find an example of languages A and B such that (A · B) = (B · A).
4
Answer 17: Please put your answer in the box below.
Problem 18: Let A and B be languages. Find an example of languages A and B such that (A · B) does
not equal (B · A)
Answer 18: Please put your answer in the box below.
Problem 19: Find an example of a language L such that L = L
2
, i.e. L = (L · L).
Answer 19: Please put your answer in the box below.
Problem 20: Argue that the intersection of any two languages L and L
′
is always contained in L.
Answer 20: Please put your answer in the box below.
Problem 21: Let L1, L2, L3, and L4 be languages. Argue that the union of Cartesian products (L1 ×
L3) ∪ (L2 × L4) is always contained in the Cartesian product of unions (L1 ∪ L2) × (L3 ∪ L4).
Answer 21: Please put your answer in the box below.
Problem 22: Let L and L
′ be finite languages. Show that the number of elements in the Cartesian product
L × L
′
is always equal to the number of elements in L
′ × L.
Answer 22: Please put your answer in the box below.
Problem 23: Suppose L is a language, and that concatenation of L with itself is equal to itself: (L·L) = L.
Show that L is either the empty set, the set {ϵ}, or an infinite language.
Answer 23: Please put your answer in the box below.
5
LONG FORM READING QUESTION:
(This section is optional for students in LING/COMP 445, but must be completed if taking
LING 645.)
You must answer this question on your own.
Andreas et al. (2022) lay out a framework for how to think about data collection and ML model design
when trying to study language representation. Though they use sperm whale communication as their driving
example, much of the points they make are applicable to any communication system, including humans.
What is the difference between supervised learning and self-supervised learning in ML models? What are
some of the benefits and downfalls of using self-supervision to train a model of language representation?
(give at least 2 benefits and 2 downfalls - your answer should be 1/2 a page to a page in length.)
Answer: Please put your answer in the box below.
6
软件开发、广告设计客服
QQ:99515681
邮箱:99515681@qq.com
工作时间:8:00-23:00
微信:codinghelp
热点项目
更多
代写dts207tc、sql编程语言代做
2024-12-25
cs209a代做、java程序设计代写
2024-12-25
cs305程序代做、代写python程序...
2024-12-25
代写csc1001、代做python设计程...
2024-12-24
代写practice test preparatio...
2024-12-24
代写bre2031 – environmental...
2024-12-24
代写ece5550: applied kalman ...
2024-12-24
代做conmgnt 7049 – measurem...
2024-12-24
代写ece3700j introduction to...
2024-12-24
代做adad9311 designing the e...
2024-12-24
代做comp5618 - applied cyber...
2024-12-24
代做ece5550: applied kalman ...
2024-12-24
代做cp1402 assignment - netw...
2024-12-24
热点标签
mktg2509
csci 2600
38170
lng302
csse3010
phas3226
77938
arch1162
engn4536/engn6536
acx5903
comp151101
phl245
cse12
comp9312
stat3016/6016
phas0038
comp2140
6qqmb312
xjco3011
rest0005
ematm0051
5qqmn219
lubs5062m
eee8155
cege0100
eap033
artd1109
mat246
etc3430
ecmm462
mis102
inft6800
ddes9903
comp6521
comp9517
comp3331/9331
comp4337
comp6008
comp9414
bu.231.790.81
man00150m
csb352h
math1041
eengm4100
isys1002
08
6057cem
mktg3504
mthm036
mtrx1701
mth3241
eeee3086
cmp-7038b
cmp-7000a
ints4010
econ2151
infs5710
fins5516
fin3309
fins5510
gsoe9340
math2007
math2036
soee5010
mark3088
infs3605
elec9714
comp2271
ma214
comp2211
infs3604
600426
sit254
acct3091
bbt405
msin0116
com107/com113
mark5826
sit120
comp9021
eco2101
eeen40700
cs253
ece3114
ecmm447
chns3000
math377
itd102
comp9444
comp(2041|9044)
econ0060
econ7230
mgt001371
ecs-323
cs6250
mgdi60012
mdia2012
comm221001
comm5000
ma1008
engl642
econ241
com333
math367
mis201
nbs-7041x
meek16104
econ2003
comm1190
mbas902
comp-1027
dpst1091
comp7315
eppd1033
m06
ee3025
msci231
bb113/bbs1063
fc709
comp3425
comp9417
econ42915
cb9101
math1102e
chme0017
fc307
mkt60104
5522usst
litr1-uc6201.200
ee1102
cosc2803
math39512
omp9727
int2067/int5051
bsb151
mgt253
fc021
babs2202
mis2002s
phya21
18-213
cege0012
mdia1002
math38032
mech5125
07
cisc102
mgx3110
cs240
11175
fin3020s
eco3420
ictten622
comp9727
cpt111
de114102d
mgm320h5s
bafi1019
math21112
efim20036
mn-3503
fins5568
110.807
bcpm000028
info6030
bma0092
bcpm0054
math20212
ce335
cs365
cenv6141
ftec5580
math2010
ec3450
comm1170
ecmt1010
csci-ua.0480-003
econ12-200
ib3960
ectb60h3f
cs247—assignment
tk3163
ics3u
ib3j80
comp20008
comp9334
eppd1063
acct2343
cct109
isys1055/3412
math350-real
math2014
eec180
stat141b
econ2101
msinm014/msing014/msing014b
fit2004
comp643
bu1002
cm2030
联系我们
- QQ: 9951568
© 2021
www.rj363.com
软件定制开发网!