Clean3.0 get directory contentsHow to list the files of a directory in CleanSplit string to a list of strings in Clean

Class Action - which options I have?

Sequence of Tenses: Translating the subjunctive

Would a high gravity rocky planet be guaranteed to have an atmosphere?

How do I rename a Linux host without needing to reboot for the rename to take effect?

Integer addition + constant, is it a group?

Why didn't Theresa May consult with Parliament before negotiating a deal with the EU?

Inappropriate reference requests from Journal reviewers

Lay out the Carpet

Do sorcerers' Subtle Spells require a skill check to be unseen?

Applicability of Single Responsibility Principle

Sort a list by elements of another list

Proof of work - lottery approach

How did Arya survive the stabbing?

Roman Numeral Treatment of Suspensions

Detecting if an element is found inside a container

How to run a prison with the smallest amount of guards?

What does "I’d sit this one out, Cap," imply or mean in the context?

How to pronounce the slash sign

What is the opposite of 'gravitas'?

How do scammers retract money, while you can’t?

Customer Requests (Sometimes) Drive Me Bonkers!

Hostile work environment after whistle-blowing on coworker and our boss. What do I do?

Is oxalic acid dihydrate considered a primary acid standard in analytical chemistry?

Large drywall patch supports



Clean3.0 get directory contents


How to list the files of a directory in CleanSplit string to a list of strings in Clean













1















I am using Cleanide for Clean3.0 programming language.
What I am trying to do is to implement a function that receive name of a directory in my system, and return a list of all the files in that directory.



I don't know if the defintion of such function needs to be like File -> [string] or maybe something else, even that directory is a file maybe this is not the developers of Clean meant...



Thank a lot!










share|improve this question


























    1















    I am using Cleanide for Clean3.0 programming language.
    What I am trying to do is to implement a function that receive name of a directory in my system, and return a list of all the files in that directory.



    I don't know if the defintion of such function needs to be like File -> [string] or maybe something else, even that directory is a file maybe this is not the developers of Clean meant...



    Thank a lot!










    share|improve this question
























      1












      1








      1








      I am using Cleanide for Clean3.0 programming language.
      What I am trying to do is to implement a function that receive name of a directory in my system, and return a list of all the files in that directory.



      I don't know if the defintion of such function needs to be like File -> [string] or maybe something else, even that directory is a file maybe this is not the developers of Clean meant...



      Thank a lot!










      share|improve this question














      I am using Cleanide for Clean3.0 programming language.
      What I am trying to do is to implement a function that receive name of a directory in my system, and return a list of all the files in that directory.



      I don't know if the defintion of such function needs to be like File -> [string] or maybe something else, even that directory is a file maybe this is not the developers of Clean meant...



      Thank a lot!







      clean-language






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Mar 7 at 12:54









      Z E NirZ E Nir

      5219




      5219






















          1 Answer
          1






          active

          oldest

          votes


















          0














          This functionality is not available in the StdEnv environment, but there are two libraries that can help with this:



          • The Directory library contains a module Directory which has a function getDirectoryContents :: !Path !*env -> (!(!DirError, [DirEntry]), !*env) | FileSystem env.


          • The Platform library contains a module System.Directory which has a function readDirectory :: !FilePath !*w -> (!MaybeOSError [FilePath], !*w).


          In both cases the first argument is a path to the directory and the second argument is the *World, which is the typical way of Clean to perform impure operations (see chapter 9 of the language report).



          Code examples



          With Directory:



          import Directory

          Start w
          # (dir,w) = getDirectoryContents (RelativePath []) w
          = dir


          With Platform:



          import System.Directory

          Start w
          # (dir,w) = readDirectory "." w
          = dir





          share|improve this answer

























          • Thanks a lot. Please consider the fact that I'm beginner, can you post a code example?

            – Z E Nir
            Mar 7 at 13:23












          • @ZENir I have updated the answer with examples for both modules.

            – Keelan
            Mar 7 at 13:39











          • Thanks. I still not sure how to get the contents of a specific directory. lets say "C:UsersUsermyDir" can you help me with that?

            – Z E Nir
            Mar 7 at 14:12






          • 1





            @ZENir You would use that as the first argument. So e.g. "C:\Users\User\myDir" for Platform or AbsolutePath "C" [PathDown "Users",PathDown "User",PathDown "myDir"] for Directory.

            – Keelan
            Mar 7 at 14:15










          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55044305%2fclean3-0-get-directory-contents%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          0














          This functionality is not available in the StdEnv environment, but there are two libraries that can help with this:



          • The Directory library contains a module Directory which has a function getDirectoryContents :: !Path !*env -> (!(!DirError, [DirEntry]), !*env) | FileSystem env.


          • The Platform library contains a module System.Directory which has a function readDirectory :: !FilePath !*w -> (!MaybeOSError [FilePath], !*w).


          In both cases the first argument is a path to the directory and the second argument is the *World, which is the typical way of Clean to perform impure operations (see chapter 9 of the language report).



          Code examples



          With Directory:



          import Directory

          Start w
          # (dir,w) = getDirectoryContents (RelativePath []) w
          = dir


          With Platform:



          import System.Directory

          Start w
          # (dir,w) = readDirectory "." w
          = dir





          share|improve this answer

























          • Thanks a lot. Please consider the fact that I'm beginner, can you post a code example?

            – Z E Nir
            Mar 7 at 13:23












          • @ZENir I have updated the answer with examples for both modules.

            – Keelan
            Mar 7 at 13:39











          • Thanks. I still not sure how to get the contents of a specific directory. lets say "C:UsersUsermyDir" can you help me with that?

            – Z E Nir
            Mar 7 at 14:12






          • 1





            @ZENir You would use that as the first argument. So e.g. "C:\Users\User\myDir" for Platform or AbsolutePath "C" [PathDown "Users",PathDown "User",PathDown "myDir"] for Directory.

            – Keelan
            Mar 7 at 14:15















          0














          This functionality is not available in the StdEnv environment, but there are two libraries that can help with this:



          • The Directory library contains a module Directory which has a function getDirectoryContents :: !Path !*env -> (!(!DirError, [DirEntry]), !*env) | FileSystem env.


          • The Platform library contains a module System.Directory which has a function readDirectory :: !FilePath !*w -> (!MaybeOSError [FilePath], !*w).


          In both cases the first argument is a path to the directory and the second argument is the *World, which is the typical way of Clean to perform impure operations (see chapter 9 of the language report).



          Code examples



          With Directory:



          import Directory

          Start w
          # (dir,w) = getDirectoryContents (RelativePath []) w
          = dir


          With Platform:



          import System.Directory

          Start w
          # (dir,w) = readDirectory "." w
          = dir





          share|improve this answer

























          • Thanks a lot. Please consider the fact that I'm beginner, can you post a code example?

            – Z E Nir
            Mar 7 at 13:23












          • @ZENir I have updated the answer with examples for both modules.

            – Keelan
            Mar 7 at 13:39











          • Thanks. I still not sure how to get the contents of a specific directory. lets say "C:UsersUsermyDir" can you help me with that?

            – Z E Nir
            Mar 7 at 14:12






          • 1





            @ZENir You would use that as the first argument. So e.g. "C:\Users\User\myDir" for Platform or AbsolutePath "C" [PathDown "Users",PathDown "User",PathDown "myDir"] for Directory.

            – Keelan
            Mar 7 at 14:15













          0












          0








          0







          This functionality is not available in the StdEnv environment, but there are two libraries that can help with this:



          • The Directory library contains a module Directory which has a function getDirectoryContents :: !Path !*env -> (!(!DirError, [DirEntry]), !*env) | FileSystem env.


          • The Platform library contains a module System.Directory which has a function readDirectory :: !FilePath !*w -> (!MaybeOSError [FilePath], !*w).


          In both cases the first argument is a path to the directory and the second argument is the *World, which is the typical way of Clean to perform impure operations (see chapter 9 of the language report).



          Code examples



          With Directory:



          import Directory

          Start w
          # (dir,w) = getDirectoryContents (RelativePath []) w
          = dir


          With Platform:



          import System.Directory

          Start w
          # (dir,w) = readDirectory "." w
          = dir





          share|improve this answer















          This functionality is not available in the StdEnv environment, but there are two libraries that can help with this:



          • The Directory library contains a module Directory which has a function getDirectoryContents :: !Path !*env -> (!(!DirError, [DirEntry]), !*env) | FileSystem env.


          • The Platform library contains a module System.Directory which has a function readDirectory :: !FilePath !*w -> (!MaybeOSError [FilePath], !*w).


          In both cases the first argument is a path to the directory and the second argument is the *World, which is the typical way of Clean to perform impure operations (see chapter 9 of the language report).



          Code examples



          With Directory:



          import Directory

          Start w
          # (dir,w) = getDirectoryContents (RelativePath []) w
          = dir


          With Platform:



          import System.Directory

          Start w
          # (dir,w) = readDirectory "." w
          = dir






          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Mar 7 at 13:39

























          answered Mar 7 at 13:16









          KeelanKeelan

          5,5761553111




          5,5761553111












          • Thanks a lot. Please consider the fact that I'm beginner, can you post a code example?

            – Z E Nir
            Mar 7 at 13:23












          • @ZENir I have updated the answer with examples for both modules.

            – Keelan
            Mar 7 at 13:39











          • Thanks. I still not sure how to get the contents of a specific directory. lets say "C:UsersUsermyDir" can you help me with that?

            – Z E Nir
            Mar 7 at 14:12






          • 1





            @ZENir You would use that as the first argument. So e.g. "C:\Users\User\myDir" for Platform or AbsolutePath "C" [PathDown "Users",PathDown "User",PathDown "myDir"] for Directory.

            – Keelan
            Mar 7 at 14:15

















          • Thanks a lot. Please consider the fact that I'm beginner, can you post a code example?

            – Z E Nir
            Mar 7 at 13:23












          • @ZENir I have updated the answer with examples for both modules.

            – Keelan
            Mar 7 at 13:39











          • Thanks. I still not sure how to get the contents of a specific directory. lets say "C:UsersUsermyDir" can you help me with that?

            – Z E Nir
            Mar 7 at 14:12






          • 1





            @ZENir You would use that as the first argument. So e.g. "C:\Users\User\myDir" for Platform or AbsolutePath "C" [PathDown "Users",PathDown "User",PathDown "myDir"] for Directory.

            – Keelan
            Mar 7 at 14:15
















          Thanks a lot. Please consider the fact that I'm beginner, can you post a code example?

          – Z E Nir
          Mar 7 at 13:23






          Thanks a lot. Please consider the fact that I'm beginner, can you post a code example?

          – Z E Nir
          Mar 7 at 13:23














          @ZENir I have updated the answer with examples for both modules.

          – Keelan
          Mar 7 at 13:39





          @ZENir I have updated the answer with examples for both modules.

          – Keelan
          Mar 7 at 13:39













          Thanks. I still not sure how to get the contents of a specific directory. lets say "C:UsersUsermyDir" can you help me with that?

          – Z E Nir
          Mar 7 at 14:12





          Thanks. I still not sure how to get the contents of a specific directory. lets say "C:UsersUsermyDir" can you help me with that?

          – Z E Nir
          Mar 7 at 14:12




          1




          1





          @ZENir You would use that as the first argument. So e.g. "C:\Users\User\myDir" for Platform or AbsolutePath "C" [PathDown "Users",PathDown "User",PathDown "myDir"] for Directory.

          – Keelan
          Mar 7 at 14:15





          @ZENir You would use that as the first argument. So e.g. "C:\Users\User\myDir" for Platform or AbsolutePath "C" [PathDown "Users",PathDown "User",PathDown "myDir"] for Directory.

          – Keelan
          Mar 7 at 14:15



















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55044305%2fclean3-0-get-directory-contents%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          1928 у кіно

          Захаров Федір Захарович

          Ель Греко