0

I am trying to implement the full function of the Substring signature in the following way :

val x = Substring.full "straight"

The output returned is :

val x = - : substring

As I see, the function is not returning any value to the variable x.

What must be going wrong? ( I am using V110.77 of SML/NJ on Windows 8.1.)

Gaurav
  • 398
  • 8
  • 23
  • you try to implement? could you show us your code? – Jason Hu Mar 30 '15 at 13:09
  • @HuStmpHrrr : The code is written in the question. The function `full` is already defined in the signature `Substring`. – Gaurav Mar 30 '15 at 13:10
  • you mean you try to use. ok. try `Substring.string(Substring.full "straight");`. you over-concern. – Jason Hu Mar 30 '15 at 13:13
  • @HuStmpHrrr : Oops !! I am trying to 'use' the function. But what you are suggesting, will convert the substring back to string. I need to convert the string to just substring so that I can use the 'Substring.position' function, i.e. at the end, I am trying to use the 'Substring.position' function. – Gaurav Mar 30 '15 at 13:19
  • 1
    what my code did told you the string had been converted to a substring. you don't worry when it couldn't be printed. – Jason Hu Mar 30 '15 at 13:21

1 Answers1

3

The function is fine. But substring is an abstract type, and values of abstract type cannot be printed by the SML/NJ prompt. So they are just indicated by "-".

Andreas Rossberg
  • 34,518
  • 3
  • 61
  • 72