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

          Save data to MySQL database using ExtJS and PHP [closed]2019 Community Moderator ElectionHow can I prevent SQL injection in PHP?Which MySQL data type to use for storing boolean valuesPHP: Delete an element from an arrayHow do I connect to a MySQL Database in Python?Should I use the datetime or timestamp data type in MySQL?How to get a list of MySQL user accountsHow Do You Parse and Process HTML/XML in PHP?Reference — What does this symbol mean in PHP?How does PHP 'foreach' actually work?Why shouldn't I use mysql_* functions in PHP?

          Compiling GNU Global with universal-ctags support Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 23:30 UTC (7:30pm US/Eastern) Data science time! April 2019 and salary with experience The Ask Question Wizard is Live!Tags for Emacs: Relationship between etags, ebrowse, cscope, GNU Global and exuberant ctagsVim and Ctags tips and trickscscope or ctags why choose one over the other?scons and ctagsctags cannot open option file “.ctags”Adding tag scopes in universal-ctagsShould I use Universal-ctags?Universal ctags on WindowsHow do I install GNU Global with universal ctags support using Homebrew?Universal ctags with emacsHow to highlight ctags generated by Universal Ctags in Vim?

          Add ONERROR event to image from jsp tldHow to add an image to a JPanel?Saving image from PHP URLHTML img scalingCheck if an image is loaded (no errors) with jQueryHow to force an <img> to take up width, even if the image is not loadedHow do I populate hidden form field with a value set in Spring ControllerStyling Raw elements Generated from JSP tagds with Jquery MobileLimit resizing of images with explicitly set width and height attributeserror TLD use in a jsp fileJsp tld files cannot be resolved