Racket: change dotted pair to list
Posted
by
user2963128
on Stack Overflow
See other posts from Stack Overflow
or by user2963128
Published on 2013-11-10T03:38:52Z
Indexed on
2013/11/10
3:53 UTC
Read the original article
Hit count: 429
I have a program that recursively calls a hashtable and prints out data from it.
Unfortunately my hashtable seems to be saving data as dotted pairs so when I call the hashtable I get an error saying that there is no data for it because its tryign to search the hashtable for a dotted pair instead of a list. Is there an easy way to make the dotted pair into a regular list? IE im getting '("was" . "beginning") instead of '("was" "beginning") Is there a way to change this without re-writing how my hashtable store stuff?
im using the let function to set a variable to this and then calling another function based on this variable (let ((data ( list-ref(hash-ref Ngram-table key) (random (length (hash-ref Ngram-table key))))))
is there a way to make the value stored in data just a list like this '("var1" "var2") instead of a dotted pair?
edit: im getting dotted pairs because im using let to set data to the part of the hashtable's key and one of the elements in that hash.
© Stack Overflow or respective owner