Find Jobs
Hire Freelancers

assignment help

$30-250 USD

已完成
已发布超过 10 年前

$30-250 USD

货到付款
dec2bin: Write a predicate dec2bin(N, L) that takes a positive integer N and returns a list L that is the binary representation of N. For instance: dec2bin(1,L) should succeed with L=[1] and dec2bin(2,L) should succeed with L=[1,0] dec2bin(26,L) should succeed with L=[1,1,0,1,0] eval: Consider expression trees represented as a Prolog data structure, as discussed in class (Sep 20). Write a predicate eval(E, V) that takes an expression tree E and returns in V the value of the expression. For instance: eval(plus(num(4), num(2)), V) succeeds with V=6 eval(star(plus(num(4), num(2)),minus(num(3), num(1))), V) succeeds with V=12 You may assume that the first argument is always a valid expression tree. comp: This question also deals with expression trees. Write a predicate traverse(E, L) that takes an expression tree E and returns in L the list of stack machine instructions that evaluate E. The relevant instructions for this exercise are: ildc(n) which pushes a given integer n on the stack; iadd, isub, imul and idiv that add, subtract, multiply or divide the top two elements of the stack. For instance: comp(plus(num(4), num(2)), C) succeeds with C=[ildc(4), ildc(2), iadd] comp(minus(num(4), num(2)), C) succeeds with C=[ildc(4), ildc(2), isub] comp(star(plus(num(4), num(2)),minus(num(3), num(1))), C) succeeds with C=[ildc(4), ildc(2), iadd, ildc(3), ildc(1), isub, imul] You may assume that the first argument is always a valid expression tree.
项目 ID: 5195986

关于此项目

1条提案
远程项目
活跃10 年前

想赚点钱吗?

在Freelancer上竞价的好处

设定您的预算和时间范围
为您的工作获得报酬
简要概述您的提案
免费注册和竞标工作
颁发给:
用户头像
Hi. I am good at functional programming. Check out my previous work where I did haskell assignments, also on functional programming. PM me if you want me to do this job. Also send me the source of the assignment. Thanks. Price is negotiable over chat. Cheers.
$50 USD 在1天之内
0.0 (0条评论)
0.0
0.0

关于客户

SINGAPORE的国旗
singapore, Singapore
5.0
1
付款方式已验证
会员自12月 4, 2013起

客户认证

谢谢!我们已通过电子邮件向您发送了索取免费积分的链接。
发送电子邮件时出现问题。请再试一次。
已注册用户 发布工作总数
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
加载预览
授予地理位置权限。
您的登录会话已过期而且您已经登出,请再次登录。