Computer Science  >  QUESTIONS & ANSWERS  >  CS 342 Principles of Programming Languages<Homework: FuncLang (Part II)> (All)

CS 342 Principles of Programming Languages<Homework: FuncLang (Part II)>

Document Content and Description Below

Questions: 1. (20 pt) Goal of the question is to understand the semantics and implementation of conditional expressions by extending the interpreter to support other features like equality on all dat ... a types. Current implementation of Funclang allows equality check only for the numeric values. Comparing two string values, Boolean values or list values results in DynamicError. For example, following transcript shows the result of comparing two Strings $ (= "name" "name") funclang.Value$StringVal cannot be cast to funclang.Value$NumVal Extend the Funclang language and its implementation such that the equality operator works for each kind of value supported by the language. For example, $ (= "abc" "abc") #t $ (= "abc" "abcdef") #f $ (= #t #t) #t $ (= #t #f) #f Two list values are considered equal if they have the same size and each element of the list is equal to corresponding element in the other list. $ (= (list) (list)) #t $ (= (list 1 2 3 4) (list 1 2 3 4)) #t $ (= (list 1 2 3 4) (list 1 2 3 4 5)) #f $ (= (list 1 2 3 4 5) (list 1 2 3 4)) #f $ (= (list 1 2 3 4 (list)) (list 1 2 3 4 (list))) #t $ (= (car (list 1 2 3)) 1) #t $ (= (car (list 1 2 3)) 2) #f $ (= (cdr (list 1 2 3)) 2) #f $ (= (cdr (list 1 2 3)) (list 2 3)) #t Fall 2016 page 1 of 4CS 342 Principles of Programming Languages Homework 5 $ (= (cdr (list 1 2 3)) (cdr (list 4 2 3))) #t $ (= (cons 0 (list 1 2)) (list 0 (list 1 2))) #f $ (= (cons 0 (list 1 2)) (list 0 1 2)) #t Two function values are only considered equal, if they point to the same FunVal object. $ (define test (lambda (x) x)) $ (define test1 (lambda (y) y)) $ (= test test1) #f $ (= test test) #t [Show More]

Last updated: 3 years ago

Preview 1 out of 10 pages

Buy Now

Instant download

We Accept:

Payment methods accepted on Scholarfriends (We Accept)
Preview image of CS 342 Principles of Programming Languages<Homework: FuncLang (Part II)> document

Buy this document to get the full access instantly

Instant Download Access after purchase

Buy Now

Instant download

We Accept:

Payment methods accepted on Scholarfriends (We Accept)

Reviews( 0 )

$7.00

Buy Now

We Accept:

Payment methods accepted on Scholarfriends (We Accept)

Instant download

Can't find what you want? Try our AI powered Search

97
0

Document information


Connected school, study & course


About the document


Uploaded On

Apr 15, 2021

Number of pages

10

Written in

All

Seller


Profile illustration for Expert Tutor
Expert Tutor

Member since 4 years

58 Documents Sold

Reviews Received
6
2
0
0
3
Additional information

This document has been written for:

Uploaded

Apr 15, 2021

Downloads

 0

Views

 97

Document Keyword Tags


$7.00
What is Scholarfriends

Scholarfriends.com Online Platform by Browsegrades Inc. 651N South Broad St, Middletown DE. United States.

We are here to help

We're available through e-mail, Twitter, Facebook, and live chat.
 FAQ
 Questions? Leave a message!

Follow us on
 Twitter

Copyright © Scholarfriends · High quality services·