ANU COMP1100 Lab1简介


现在可以开始写lab1了朋友们:https://cs.anu.edu.au/courses/comp1100/labs/01/
没注册的同学火速去注册lab: https://cs.anu.edu.au/streams/

安装虚拟机 (可以去csit的同学请跳过!)

lab1不需要在自己电脑上安装haskell,必须远程anu电脑使用Linux。

想安装Haskell的同学看这里: https://cs.anu.edu.au/courses/comp1100/resources/10-install/

  1. 下载安装global protection
    a) 下载链接:https://student-access.anu.edu.au/global-protect/login.esp
    在这里插入图片描述
    b) 安装成功忽略此条!如果安装的时候提示权限不够,windows试试:打开powershell(admin)然后输入 msiexec /package 文件路径\GlobalProtect64.msi
    在这里插入图片描述
    c) 使用教程:安装好以后打开软件,portal填:student-access.anu.edu.au,然后用uid密码登录连接
    Alt在这里插入图片描述
    不明白的同学有视频给大家:

Global Protect 安装连接教程 - ANU

  1. 下载安装VMWare
    a) 下载链接:https://linuxvdi.anu.edu.au/
    第一个是安装,第二个是网页直接访问
    可能要科学上网,可以连上global protect下载。也可以网页上直接访问,但会慢一些。

    b) 使用教程:https://cs.anu.edu.au/courses/comp1100/resources/02-working-remotely/

lab1正题:

网站介绍

COMP1100课程网站: https://cs.anu.edu.au/courses/comp1100

  • 包含所有lecture/lab/assessment信息

Piaza论坛: https://piazza.com/anu.edu.au

  • 按照规范提问,tutor/student看到会尽快回答

GitLab: https://gitlab.cecs.anu.edu.au/users/sign_in

  • 下载和上传作业的地方!

按照instruction创建comp1100及子目录

在这里插入图片描述
截图自: https://cs.anu.edu.au/courses/comp1100/labs/01/

按照instruction打开workspace

在这里插入图片描述
截图自: https://cs.anu.edu.au/courses/comp1100/labs/01/在这里插入图片描述
截图自: https://cs.anu.edu.au/courses/comp1100/labs/01/

按照instruction配置VSCodium

在这里插入图片描述
截图自: https://cs.anu.edu.au/courses/comp1100/labs/01/在这里插入图片描述
截图自: https://cs.anu.edu.au/courses/comp1100/labs/01/在这里插入图片描述
截图自: https://cs.anu.edu.au/courses/comp1100/labs/01/

打开terminal 输入ghci, 尝试:

-- 复制自:https://cs.anu.edu.au/courses/comp1100/labs/01/
6 < 4
compare 4 5
compare (Just 5) Nothing
Nothing
True && False
True || False -- The ‘|’ character is called a “pipe” (found near the <Enter> key).
(1 + 1 == 2) || (1 + 1 == 3)
2 ^ 5
lcm 4 14
sqrt 2.0
sqrt 4*100 -- Think carefully about the output you get from this one.
sin (pi/2.0)
[1 .. 10]
sum [1 .. 100]
product [1, 3 .. 10]Out++shinedlengthRoom a thousand years widewordsFell on black days

输入 :q退出ghci

打开VSCodium

视频版说明

ANU COMP1100 LAB1 - Haskell示范

文字版说明

新建文件另存为Area.hs, 输入:

module Area where
-- add 1 to an integer              <- this a comment that tells the user what the function does.
addOne :: Integer -> Integer
addOne int = int + 1

按Ctrl+Shift+P,输入terminal打开terminal,输入:ghci -Wall Area.hs
显示:

GHCi, version 8.6.5: http://www.haskell.org/ghc/  :? for help
[1 of 1] Compiling Area         ( Area.hs, interpreted )
Ok, modules loaded: Area.
*Area>

说明文件读取成功,尝试:

*Area> addOne 1
2
*Area> addOne 5
6
*Area> addOne 10
11

在Area.hs文件里面添加并修复:

-- calculate area of a square with only integer lengths
areaSquare :: Integer -> Integer
areaSquare len = undefined

terminal输入::r
重新加载Area.hs文件

尝试:

*Area> areaSquare 3
9
*Area> areaSquare 10
100

在这里插入图片描述
剩下的Exercise就交给大家自己解决了噢!关于function/type signiture及后续更多内容我们就以后再见咯!

其他

  1. 遇到这个问题的同学在指令后面加 --force,可以强制安装
    在这里插入图片描述
  2. 遇到这个问题的同学先:q退出ghci,然后cd 到hs文件所在的地址
    在这里插入图片描述
  3. VMWare/Haskell必须装吗?lab1必须要用VMWare! 如果虚拟机用的不卡顿的话, Haskell不是必须要在自己电脑上安装!
  4. 如果出现这个问题试试看运行powershell(admin)
    在这里插入图片描述

在这里插入图片描述

  • 2
    点赞
  • 4
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

失眠软糖12

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值