Skip to content

Instantly share code, notes, and snippets.

@honki12345
Created September 25, 2025 16:12
Show Gist options
  • Select an option

  • Save honki12345/a0fc6e45a48c47617316d56519ff2cf9 to your computer and use it in GitHub Desktop.

Select an option

Save honki12345/a0fc6e45a48c47617316d56519ff2cf9 to your computer and use it in GitHub Desktop.
ex1
// Q. 리스트가 빈 리스트([])인지, 또는 첫 번째 요소가 빈 리스트인지([[], ['a','b']]와 같은)를 확인하는 표현식을 작성하세요.
hasOnlyOneElement t = null t || null (head t)
// Q. 다른 리스트 안에 주어진 두 리스트를 연결하는 표현식을 작성하세요. 예를 들어, ["abc","de"]에 대해 "abcde"를 반환해야 합니다.
concatTwoElement t = head t ++ head (tail t)
// Q. Q. 리스트가 단 하나의 요소만 가지고 있는지 확인하는 표현식을 작성하세요. ['a']에 대해서는 True를, []나 ['a','b']에 대해서는 False를 반환해야 합니다.
hasOneElement t = not (null t) && null (tail t)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment